int main(int argc, char *argv[]) { Q_INIT_RESOURCE(application); QApplication app(argc, argv); QPixmap pixmap("images/rap_logo.png"); QSplashScreen* splash = new QSplashScreen(pixmap,Qt::WindowStaysOnTopHint); bool error = false; splash->setMask(pixmap.mask()); splash->show(); app.processEvents(); cout << "Loading settings..." << endl; if (!gSettings.LoadFromFile("settings.xml")) { cout << "Error while loading settings from settings.xml" << endl; return 1; } cout << "Loaded settings." << endl; LoginDialog* loginDialog; loginDialog = new LoginDialog(0); QTimer::singleShot(1500,loginDialog,SLOT(show())); QTimer::singleShot(1500,splash,SLOT(close())); // gMainWindow = new MainWindow(); // gMainWindow->show(); return app.exec(); }
int main(int argc, char *argv[]) { #ifndef Q_OS_MAC Q_INIT_RESOURCE(SonicPi); #endif QApplication app(argc, argv); qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage"); QString systemLocale = QLocale::system().name(); QTranslator qtTranslator; qtTranslator.load("qt_" + systemLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); QTranslator translator; bool i18n = translator.load("sonic-pi_" + systemLocale, ":/lang/") || systemLocale.startsWith("en") || systemLocale == "C"; app.installTranslator(&translator); app.setApplicationName(QObject::tr("Sonic Pi")); app.setStyle("gtk"); #ifdef Q_OS_MAC app.setAttribute( Qt::AA_UseHighDpiPixmaps ); QMainWindow* splashWindow = new QMainWindow(0, Qt::FramelessWindowHint); QLabel* imageLabel = new QLabel(); splashWindow->setAttribute( Qt::WA_TranslucentBackground); QPixmap image(":/images/[email protected]"); imageLabel->setPixmap(image); splashWindow->setCentralWidget(imageLabel); splashWindow->setMinimumHeight(image.height()/2); splashWindow->setMaximumHeight(image.height()/2); splashWindow->setMinimumWidth(image.width()/2); splashWindow->setMaximumWidth(image.width()/2); splashWindow->raise(); splashWindow->show(); MainWindow mainWin(app, i18n, splashWindow); return app.exec(); #else QPixmap pixmap(":/images/splash.png"); QSplashScreen *splash = new QSplashScreen(pixmap); splash->setMask(pixmap.mask()); splash->show(); splash->repaint(); MainWindow mainWin(app, i18n, splash); return app.exec(); #endif }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QTranslator t; QDate today = QDate::currentDate(); if ( today.month() == 4 && today.day() == 1 ) { t.load(":/translations/koi7.qm"); } else { t.load(":/translations/ru.qm"); } QApplication::installTranslator(&t); Settings::instance(); Logger::logger(); QPixmap logo(":/resources/logo.png"); QSplashScreen *splash = new QSplashScreen(logo, Qt::FramelessWindowHint | Qt::SplashScreen); splash->setMask( logo.mask() ); splash->show(); Settings::instance()->updateLocalData(); splash->close(); delete splash; LauncherWindow w; w.show(); return a.exec(); }
DianVoteControl::DianVoteControl(QWidget *parent) : QWidget(parent), ui(new Ui::DianVoteControl), drawer(NULL), hidControl(NULL), stopWatch(NULL), splash(NULL), voteMode(SINGLE_VOTE), curState(STOP) { QDir dir; dir.setCurrent(QCoreApplication::applicationDirPath()); windowIcon = new QIcon(dir.absoluteFilePath("res/images/app-icon.png")); this->setWindowIcon(*windowIcon); // show splash. QPixmap pixmap(dir.absoluteFilePath("res/images/logo.png")); QSplashScreen *splash = new QSplashScreen(pixmap); splash->setWindowIcon(*windowIcon); splash->setWindowFlags(Qt::WindowStaysOnTopHint); splash->setMask(pixmap.mask()); splash->show(); ui->setupUi(this); pbStart = new QPushButton(this); pbStart->setObjectName(tr("pbStart")); ui->buttonLayout->addWidget(pbStart, 0, 0); pbAuto = new QPushButton(this); pbAuto->setObjectName(tr("pbAuto")); ui->buttonLayout->addWidget(pbAuto, 0, 1); pbPause = new QPushButton(this); pbPause->setObjectName(tr("pbPause")); ui->buttonLayout->addWidget(pbPause, 0, 0); pbPause->hide(); pbStop = new QPushButton(this); pbStop->setObjectName(tr("pbStop")); ui->buttonLayout->addWidget(pbStop, 0, 1); pbStop->hide(); pbResult = new QPushButton(this); pbResult->setObjectName(tr("pbResult")); ui->buttonLayout->addWidget(pbResult, 0, 2); pbOption = new QToolButton(this); pbOption->setObjectName(tr("pbOption")); ui->buttonLayout->addWidget(pbOption, 0, 3); qaSingleMode = new QAction(tr("SingleVoteMode"), this); // 单选模式 qaSingleMode->setCheckable(true); qaSingleMode->setChecked(true); // 默认模式 qaMutipleMode = new QAction(tr("MutipleVoteMode"), this); // 多选 qaMutipleMode->setCheckable(true); qaRaceMode = new QAction(tr("RaceVoteMode"), this); // 抢答 qaRaceMode->setCheckable(true); pbOption->addAction(qaSingleMode); pbOption->addAction(qaMutipleMode); pbOption->addAction(qaRaceMode); connect(qaSingleMode, SIGNAL(triggered()), this, SLOT(DoSingleMode())); connect(qaMutipleMode, SIGNAL(triggered()), this, SLOT(DoMutipleMode())); connect(qaRaceMode, SIGNAL(triggered()), this, SLOT(DoRaceVoteMode())); pbClose = new QPushButton(this); pbClose->setObjectName(tr("pbClose")); ui->buttonLayout->addWidget(pbClose, 0, 4); connect(pbClose, SIGNAL(clicked()), this, SLOT(close())); connect(pbStart, SIGNAL(clicked()), this, SLOT(VoteStart())); connect(pbAuto, SIGNAL(clicked()), this, SLOT(VoteAuto())); connect(pbPause, SIGNAL(clicked()), this, SLOT(VotePause())); connect(pbStop, SIGNAL(clicked()), this, SLOT(VoteStop())); connect(pbResult, SIGNAL(clicked()), this, SLOT(DoShowResults())); drawer = new DianVoteDrawer(); drawer->setWindowIcon(*windowIcon); drawer->setWindowTitle(tr("Result")); connect(pbClose, SIGNAL(clicked()), this->drawer, SLOT(close())); connect(this, SIGNAL(setOptionNum(int)), drawer->histgram, SLOT(SetOptionNums(int))); connect(this, SIGNAL(setOptionNum(int)), drawer->pie, SLOT(SetOptionNums(int))); connect(this, SIGNAL(clearDrawData()), drawer->histgram, SLOT(ClearData())); connect(this, SIGNAL(clearDrawData()), drawer->pie, SLOT(ClearData())); connect(this, SIGNAL(updateGraph(int)), drawer->histgram, SLOT(HandleData(int))); connect(this, SIGNAL(updateGraph(int)), drawer->pie, SLOT(HandleData(int))); LoadStyleSheet("Default"); // 记录初始化窗口大小 initSize = this->size(); this->setMaximumWidth(this->width()); this->setMaximumHeight(this->height() + 100); this->move(0, 0); // 创建Log文件,并打开,程序退出是关闭 VoteLog->open(QIODevice::WriteOnly | QIODevice::Append); // 初始化log记录链表 log = new QList< RevData* >(); }
int main(int argc, char *argv[]) { CApplication app(argc, argv); QPixmap pixmap(":/res/icons/app-start.png"); QSplashScreen *splash = NULL; QString tpl = "\n %1"; QColor c(0, 0, 0, 168); CWorkbench *bench = NULL; QCoreApplication::setOrganizationName("JetMind"); QCoreApplication::setOrganizationDomain("jetmind.com"); QCoreApplication::setApplicationName("JetMind"); app.setWindowIcon(QIcon(QString::fromUtf8(":/res/icons/app-logo.png"))); #if defined(__APPLE__) && defined(__MACH__) app.setFont( QFont("Arial", 12) ); #else app.setFont( QFont("Arial", 9) ); #endif // splash = new QSplashScreen(pixmap); splash->setMask(pixmap.mask()); splash->show(); app.processEvents(); splash->showMessage(tpl.arg( QObject::tr("Initing Environment...") ), Qt::AlignBottom | Qt::AlignRight , c); app.processEvents(); initEnvironment(); splash->showMessage(tpl.arg( QObject::tr("Loading Templates...") ), Qt::AlignBottom | Qt::AlignRight , c); app.processEvents(); loadTemplates(); splash->showMessage(tpl.arg( QObject::tr("Starting Workbench...") ), Qt::AlignBottom | Qt::AlignRight , c); app.processEvents(); bench = new CWorkbench(); bench->setWindowTitle("JetMind"); bench->resize(800, 600); bench->show(); bench->loadStyleSheet(); app.setWorkbench(bench); CDiagramContext::env()->setMainUI(bench); splash->finish(bench); // set url handler QDesktopServices::setUrlHandler("topic", (QObject*)bench, "onOpenUrl"); QDesktopServices::setUrlHandler("sheet", (QObject*)bench, "onOpenUrl"); #if defined(__APPLE__) && defined(__MACH__) bench->createFile(); #else QStringList args; args = app.arguments(); if (args.length() > 1) { bench->loadFile(args.at(1)); } else { bench->createFile(); } #endif // return app.exec(); }
/* * @brief Constructor of the main class * The Constructor initializes all needed variables and one instance of every used dialog. */ CReaderTool::CReaderTool(QWidget *parent) : QMainWindow(parent) , QrfeTraceModule("Reader_Tool") { m_updateThread = NULL; int alignment = Qt::AlignHCenter | Qt::AlignBottom; //Mod by yingwei tseng for hiding AMS code, 2010/03/10 #if 0 QPixmap logo(":/ams logos/amsStartupLogo"); #endif QPixmap logo(":/ams logos/mtiRfidLogo"); //End by yingwei tseng for hiding AMS code, 2010/03/10 //clark 2011.12.15 //logo.setMask(logo.createHeuristicMask()); QSplashScreen *splash = new QSplashScreen(logo); splash->setMask(logo.mask()); splash->setWindowOpacity(0); splash->show(); for(double i = 0; i < 1; i += 0.05) { splash->setWindowOpacity(i); Sleep(50); } /* Init variables */ m_scanActive = false; splash->showMessage(tr("Initialize GUI..."), alignment); /* Setup the ui */ ui.setupUi(this); this->setWindowTitle(QString(APPLICATION_NAME)); splash->showMessage(tr("Create Handlers..."), alignment); /* Create Action Handler */ m_actionHandler = new CActionHandler(&m_dataHandler, this); /* Create Read Rate Calculator */ m_readRateCalc = new CReadRateCalc(this); /* Create Tag Manager */ m_tagManager = new CTagManager(this); m_amsComWrapper = new USBHIDWrapper(0x0); splash->showMessage(tr("Create Dialogs..."), alignment); /* Create Dialogs */ m_aboutDialog = new QrfeAboutDialog(this); m_keyDialog = new QrfeKeyWindow(this); m_tagListDialog = new CTagListView(m_tagManager, this); m_settingsDialog = new CSettingsDialog(this); m_tagSettingsDialog = new CTagSettingsDialog(&m_dataHandler, this); m_gen2SettingsDialog = new CGen2TagDialog(this); /* Create the view manager */ m_tagViewManager = new CTagViewManager(ui.readerTreeWidget, &m_dataHandler, m_readRateCalc, this); m_tagViewManager->setUp( m_settingsDialog->showAlias(), m_settingsDialog->useTtl(), m_settingsDialog->msecsToShowInactive(), m_settingsDialog->msecsToShowOutOfRange(), m_settingsDialog->msecsToDelete()); QObject::connect(m_tagViewManager, SIGNAL(requestTagSettings(QString)), this, SLOT(requestTagSettingsDialog(QString))); QObject::connect(m_tagViewManager, SIGNAL(requestTagAdvancedSettings(QString, QString)), this, SLOT(requestTagAdvancedSettingsDialog(QString, QString))); QObject::connect(m_tagViewManager, SIGNAL(requestReaderAdvancedSettings(QString)), this, SLOT(requestReaderAdvancedSettingsDialog(QString))); QObject::connect(m_tagViewManager, SIGNAL(requestReaderRegisterMap(QString)), this, SLOT(requestReaderRegisterMap(QString))); QObject::connect(m_tagViewManager, SIGNAL(newTagCount(int)), ui.tagCountNumber, SLOT(display(int))); QObject::connect(m_tagViewManager, SIGNAL(newDifferentTagCount(int)), ui.differentTagCountNumber, SLOT(display(int))); QObject::connect(m_tagViewManager, SIGNAL(newOverallDifferentTagCount(int)), ui.overallDifferentTagCountNumber, SLOT(display(int))); QObject::connect(m_tagViewManager, SIGNAL(oldTagEntryRemoved(QString,QString)), m_tagManager, SLOT(oldTagEntryRemoved(QString,QString))); QObject::connect(m_tagViewManager, SIGNAL(currentReaderChanged(QString)), this, SLOT(currentReaderChanged(QString))); QObject::connect(m_tagViewManager, SIGNAL(countTotalTags(QString)), this, SLOT(countTotalTags(QString))); splash->showMessage(tr("Connect..."), alignment); /* Connect the signals of the gui to the right slots */ QObject::connect(QrfeTrace::getInstance(), SIGNAL(traceSignal(QString)), ui.traceBrowser, SLOT(append(QString))); QObject::connect(ui.actionAboutReaderTool, SIGNAL(triggered (bool)), m_aboutDialog, SLOT(exec())); QObject::connect(ui.actionShow_TagList, SIGNAL(triggered (bool)), m_tagListDialog, SLOT(exec())); QObject::connect(ui.readerTabWidget, SIGNAL(currentChanged(int)), this, SLOT(selectReader(int))); QObject::connect(ui.startScanButton, SIGNAL(toggled (bool)), this, SLOT(startScan(bool))); QObject::connect(ui.handleActionPushButton, SIGNAL(toggled(bool)), this, SLOT(handleActionsToggled(bool))); QObject::connect(ui.actionAdd_Serial_Reader, SIGNAL(triggered(bool)), this, SLOT(addSerialReader())); //Del by yingwei tseng for hiding AMS code, 2010/03/10 //QObject::connect(ui.actionAdd_Tcp_Reader, SIGNAL(triggered(bool)), this, SLOT(addTcpReader())); //End by yingwei tseng for hiding AMS code, 2010/03/10 QObject::connect(ui.actionHandle_Actions, SIGNAL(triggered(bool)), this, SLOT(handleActionsToggled(bool))); QObject::connect(ui.actionShow_Alias_Names, SIGNAL(triggered ( bool)), this, SLOT(showAliasNames(bool))); QObject::connect(ui.actionUse_Time_To_Live, SIGNAL(triggered ( bool)), this, SLOT(useTimeToLive(bool))); QObject::connect(ui.actionPreferences, SIGNAL(triggered ( bool)), this, SLOT(showSettings())); QObject::connect(ui.actionOpen_Register_Map, SIGNAL(triggered ( bool)), this, SLOT(showRegisterMap())); QObject::connect(ui.clearButton, SIGNAL(clicked()), m_readRateCalc, SLOT(clearResults())); QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), m_readRateCalc, SLOT(clearResults())); QObject::connect(ui.clearButton, SIGNAL(clicked()), m_tagViewManager, SLOT(clearTags())); QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), m_tagViewManager, SLOT(clearTags())); QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), m_tagViewManager, SLOT(clearOfflineReader())); QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), this, SLOT(clearOfflineReader())); QObject::connect(ui.actionClear_Offline_Reader, SIGNAL(triggered(bool)), m_tagViewManager, SLOT(clearOfflineReader())); QObject::connect(m_gen2SettingsDialog, SIGNAL(easterKeyUnlocked()), this, SLOT(easterKeyUnlocked())); /* Create the scan timer to get the end of the scan */ m_scanTimer = new QTimer(this); m_scanTimer->setSingleShot(true); QObject::connect(m_scanTimer, SIGNAL(timeout()), this, SLOT(stopScan())); /* Create timer for the scan progress bar */ m_scanProgressTimer = new QTimer(this); m_scanProgressTimer->setSingleShot(false); m_scanProgressTimer->setInterval(1000); m_regMapWindow = NULL; /* Connect to the Reader Manager */ QObject::connect(this, SIGNAL(currentReaderChanged(QrfeReaderInterface*)), m_amsComWrapper, SLOT(gotReader(QrfeReaderInterface*))); QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), m_amsComWrapper, SLOT(lostReader(QrfeReaderInterface*))); QObject::connect(&m_readerManager, SIGNAL(gotReader(QrfeReaderInterface*)), this, SLOT(gotReader(QrfeReaderInterface*))); QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), this, SLOT(lostReader(QrfeReaderInterface*))); //Add by yingwei tseng for using bar to set power, 2010/07/09 QObject::connect(ui.powerSlider, SIGNAL(valueChanged(int)), this, SLOT(powerSliderChange(int))); //End by yingwei tseng for using bar to set power, 2010/07/09 /* Create the timer for the multiplexer control */ m_multiplexTimer = new QTimer(this); m_multiplexTimer->setSingleShot(true); m_multiplexTimer->setInterval(m_settingsDialog->multiplexTime()); QObject::connect(m_multiplexTimer, SIGNAL(timeout()), this, SLOT(multiplexISR())); /* Finally set up the gui */ ui.traceDockWidget->setVisible(false); ui.informationBox->setVisible(false); ui.actionShow_Alias_Names->setChecked(m_settingsDialog->showAlias()); ui.actionUse_Time_To_Live->setChecked(m_settingsDialog->useTtl()); splash->showMessage(tr("Starting up..."), alignment); ActivateSettings(); Sleep(1000); splash->close(); //Add by yingwei tseng for hiding AMS code, 2010/03/10 ui.handleActionPushButton->hide(); ui.clearOfflineReaderButton->hide(); //ui.actionAdd_Serial_Reader->setVisible(false); ui.actionAdd_USB->setVisible(false); ui.actionAdd_Tcp_Reader->setVisible(false); ui.actionHandle_Actions->setVisible(false); ui.actionClear_Offline_Reader->setVisible(false); //End by yingwei tseng for hiding AMS code, 2010/03/10 //Add by yingwei tseng for hiding items, 2010/12/08 ui.actionShow_Alias_Names->setVisible(false); ui.actionUse_Time_To_Live->setVisible(false); ui.actionShow_Trace_Browser->setVisible(false); ui.actionShow_TagList->setVisible(false); //End by yingwei tseng for hiding items, 2010/12/08 ui.groupBox_3->hide(); }
int main(int argc, char **argv) { try { /* Registering the below classes as metatypes in order to make them liable to be sent through signal parameters. */ qRegisterMetaType<ObjectType>("ObjectType"); qRegisterMetaType<Exception>("Exception"); qRegisterMetaType<ValidationInfo>("ValidationInfo"); //Install a signal handler to start crashhandler when SIGSEGV or SIGABRT is emitted signal(SIGSEGV, startCrashHandler); signal(SIGABRT, startCrashHandler); Application app(argc,argv); //Loading the application splash screen QSplashScreen splash; QPixmap pix(QPixmap(":imagens/imagens/pgmodeler_splash.png")); splash.setPixmap(pix); splash.setMask(pix.mask()); #ifndef Q_OS_MAC splash.setWindowFlags(Qt::SplashScreen | Qt::FramelessWindowHint); #else splash.setWindowFlags(Qt::SplashScreen | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint); #endif #ifdef Q_OS_WIN splash.show(); #else splash.showMaximized(); #endif app.processEvents(); //Creates the main form MainWindow fmain; //Loading models via command line on MacOSX are disabled until the file association work correclty on that system #ifndef Q_OS_MAC QStringList params=app.arguments(); params.pop_front(); //If the user specifies a list of files to be loaded if(!params.isEmpty()) fmain.loadModels(params); #endif splash.finish(&fmain); fmain.showMaximized(); return(app.exec()); } catch(Exception &e) { QTextStream ts(stdout); ts << e.getExceptionsText(); return(e.getErrorType()); } }