int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextCodec *codec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForLocale(codec); QSplashScreen *splash = new QSplashScreen; MainWindow w; splash->setPixmap(QPixmap(":/data/splash.jpg").scaled(640, 480)); // splash->setPixmap(QPixmap(":/dataplash.png").scaled(400, 300, Qt::KeepAspectRatio)); splash->show(); w.show(); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; w.move ((QApplication::desktop()->width() - w.width()) / 2, (QApplication::desktop()->height() - w.height()) / 2); splash->showMessage(QObject::tr("Setting up the main window...")); sleep(1); splash->showMessage(QObject::tr("Loading modules..."), topRight, Qt::black); splash->finish(&w); delete splash; return a.exec(); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(icons); /** Initializing the icon images for the application. */ /** Application object for creating the application */ QApplication app(argc, argv); /** Providing application settings */ app.setOrganizationName("NITK Surathkal"); app.setApplicationName("Talk To The Hand"); app.setApplicationVersion("Version 1.0"); app.setWindowIcon(QIcon(":/images/logo.jpg")); /** Initializing splash screen for the application */ QSplashScreen *splash = new QSplashScreen; QImage *splashImage = new QImage(":/images/SplashScreen.jpg"); *splashImage = splashImage->scaledToHeight(300); splash->setPixmap(QPixmap::fromImage(*splashImage)); splash->show(); Qt::Alignment topRight = Qt::AlignLeft | Qt::AlignBottom; splash->showMessage(QObject::tr("Initializing..."),topRight, Qt::black); sleep(3); /** Creating mainwindow of the application and then showing it*/ MainWindow mainWin; mainWin.show(); //mainWin.showFullScreen(); /** Remove splash screen as soon as the window loads */ splash->finish(&mainWin); delete splash; return app.exec(); }
int Qt_Gui_by_ABK (int a,char *b[]) { CvCapture *capture ; IplImage *frame=0; capture = cvCreateCameraCapture(0); int n = 0; //resoulution // cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,1024); //cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,768); QApplication app(a,b,true); QLabel label ; QSplashScreen * splash = new QSplashScreen; while(1) { frame = cvQueryFrame(capture); printf("the camera resoulution is %dx%d\n",frame->width,frame->height); cvCvtColor(frame,frame,CV_BGR2RGB); QImage image =QImage((uchar*)frame->imageData,frame->width,frame->height,QImage::Format_RGB888); splash->setPixmap(QPixmap::fromImage(image)); splash->show(); //label.update(); n++; } return app.exec(); }
int main(int argc, char *argv[]) { g_app = new QApplication(argc, argv); // Create a splash screen. QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/images/splash.bmp")); splash->show(); // Set message alignment for splash screen. Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; // Display message while bringing up main window state. splash->showMessage(QObject::tr("Setting up the main window ..."), topRight, Qt::black); g_app->processEvents(); // Accept a click on the screen so that user can cancel the screen. // Switch from splash state to main window. MainWindow mainWindow; //SplashUtil::sleep(3); // Splash page is shown for 3 seconds. mainWindow.show(); splash->finish(&mainWindow); delete splash; return g_app->exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); Q_INIT_RESOURCE(images); // Show a loading screen, I am not sure this is showed even on slow computers... QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap("../resources/images/splash.jpg")); splash->show(); splash->showMessage(QObject::tr("ROS GUI is launching...."),Qt::AlignBottom,Qt::black); //Make the main window appear MainWindow w; w.show(); w.setArguments(argc,argv); // The main window is fully loaded, we can now delete the splash screen splash->finish(&w); delete splash; a.setStyle("gtk+"); a.exec(); return 0; }
//----------------------------------------------------------------- int main(int argc, char *argv[]) { QApplication app(argc, argv); QSharedMemory global("your_unique_key"); if (!global.create(1)) return 1; cool_tsmfb tsmfbWin; QSplashScreen *splash = new QSplashScreen; QObject::connect(&tsmfbWin, SIGNAL(quit()), &app, SLOT(quit())); splash->setPixmap(QPixmap(":/images/TSMFB.png")); splash->show(); loadModules(splash); tsmfbWin.setMinimumSize(minWinWidth, minWinHeight); QRect rect = QApplication::desktop()->availableGeometry(&tsmfbWin); tsmfbWin.move(rect.center() - tsmfbWin.rect().center()); tsmfbWin.show(); splash->finish(&tsmfbWin); delete splash; return app.exec(); }
int main(int argc, char *argv[]) { QoccApplication app( argc, argv ); QSplashScreen *mySplash = new QSplashScreen; mySplash->setPixmap(QPixmap(QString::fromUtf8(":/images/style/FMD_SPLASH.png")).scaledToWidth(600)); mySplash->show(); Qt::Alignment topright = Qt::AlignRight | Qt::AlignTop; mySplash->showMessage(QString::fromUtf8("Loading More CowBell ..."),topright,Qt::white); #if defined(Q_WS_WIN) //QtDotNetStyle* style = new QtDotNetStyle(); //QCDEStyle* style = new QCDEStyle(); //app.setStyle(QStyleFactory::create("motif")); //cleanlooks,"motif", "cde", "plastique" and "cleanlooks #endif qGeomApp->msleep ( 100 ); QoccMainWindow *window = new QoccMainWindow(); window->showMaximized(); mySplash->finish(window); delete mySplash; int retval = app.exec(); return retval; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/ICO_Home.gif")); splash->show(); Qt::Alignment toRight = Qt::AlignTop | Qt::AlignTop; splash->showMessage(QObject::tr("Seeting up the main windows ..."), toRight, Qt::black); MainWindow w; for(int i=0;i<90000;i++) for(int j=0;j<900;j++); splash->showMessage(QObject::tr("Loading modules..."), toRight, Qt::black); for(int i=0;i<90000;i++) for(int j=0;j<900;j++); splash->showMessage(QObject::tr("Etablishing connections..."), toRight, Qt::black); for(int i=0;i<90000;i++) for(int j=0;j<6000;j++); w.setWindowState(w.windowState() ^ Qt::WindowMaximized); w.show(); splash->finish(&w); delete splash; return a.exec(); }
int main(int argc, char *argv[]) { QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QApplication a(argc, argv); RMMSMain w; QSplashScreen *splash = new QSplashScreen; splash->setStyleSheet("font-size: 16px"); splash->setPixmap(QPixmap(":/splash/1.png"));//设置图片 splash->show();//显示图片 Qt::Alignment topRight = Qt::AlignCenter | Qt::AlignBottom; splash->showMessage(QObject::tr("Setting up the main window..."), topRight, Qt::white);//显示信息 QDateTime curtime = QDateTime::currentDateTime(); QDateTime nowtime; do{ nowtime = QDateTime::currentDateTime(); } while(curtime.secsTo(nowtime) <= 3); w.setWindowTitle(SystemName); w.show(); splash->finish(&w);//图片一直显示到mainWin加载完成 delete splash; return a.exec(); }
int main(int argc, char *argv[]) { #ifdef HAS_GUI if (argc > 1){ // using terminal mode if (argc < 2){ printf("Usage: %s input _file\n", argv[0]); exit(1); } else { TEMP_SCHEME* RunEngine = new TEMP_SCHEME(argc, argv); RunEngine->evaluation(); return(0); } } else { // using GUI QApplication app(argc, argv); app.setOrganizationName(ORGANIZATION); app.setApplicationName(NAME); app.setApplicationVersion(VERSION); /* QFile stylesheetfile(":/css/stylesheet.css"); if (stylesheetfile.open(QFile::ReadOnly)){ app.setStyleSheet(stylesheetfile.readAll()); stylesheetfile.close(); } */ QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/libel.png")); splash->show(); splash->showMessage(app.organizationName()); QIcon windowIcon(":/libel.png"); GUI gui; gui.setWindowIcon(windowIcon); QTimer::singleShot(1000, splash, SLOT(close())); QTimer::singleShot(1000, &gui, SLOT(showMaximized())); return app.exec(); } #else if (argc > 1){ // using terminal mode if (argc < 2){ printf("Usage: %s input_file\n", argv[0]); exit(1); } else { TEMP_SCHEME* RunEngine = new TEMP_SCHEME(argc, argv); RunEngine->evaluation(); return(0); } } #endif }
/** Application launch functionn. */ int main(int argc, char *argv[]) { using namespace ews::app::model; using namespace ews::app::widget; #if defined(QT_DEBUG) osg::setNotifyLevel(osg::INFO); #endif // To see Qt object dumps on macos, run with the environment variable // "DYLD_IMAGE_SUFFIX" set to "_debug". QApplication mainQApp(argc, argv); mainQApp.setQuitOnLastWindowClosed(true); QApplication::setOrganizationName(EWS_ORGANIZATION_NAME); QApplication::setOrganizationDomain(EWS_BUNDLE_ID); QApplication::setApplicationVersion(EWS_VERSION); QApplication::setApplicationName(EWS_APP_NAME); // First register the dialog error handler, then // get the function pointer to it by passing zero to the handler installer // then install our own. QErrorMessage::qtHandler(); saveHandler(qInstallMsgHandler(0)); qInstallMsgHandler(errHandler); QSplashScreen splash; QPixmap img(":/images/splash"); if (img.isNull()) { qWarning() << "Couldn't load splash image"; } splash.setPixmap(img); splash.showMessage(QObject::tr("Starting up....")); splash.show(); mainQApp.connect(&mainQApp, SIGNAL(lastWindowClosed()), &mainQApp, SLOT(quit())); SimulationState state; state.setObjectName("root"); EWSMainWindow w(&state); w.setWindowTitle(EWS_APP_NAME); #if defined(__APPLE__) w.setWindowIcon(QIcon(":/images/appicon")); #else QApplication::setWindowIcon(QIcon(":/images/appicon")); #endif w.show(); splash.finish(&w); return mainQApp.exec(); }
BibleTime::BibleTime() : m_WindowWasMaximizedBeforeFullScreen(false) { namespace DU = util::directory; QSplashScreen splash; bool showSplash = CBTConfig::get(CBTConfig::logo); QString splashHtml; if (showSplash) { splashHtml = "<div style='background:transparent;color:white;font-weight:bold'>%1" "</div>"; const QDate date(QDate::currentDate()); const int day = date.day(); const int month = date.month(); QString splashImage(DU::getPicsDir().canonicalPath().append("/")); if ((month >= 12 && day >= 24) || (month <= 1 && day < 6)) { splashImage.append("startuplogo_christmas.png"); } else { splashImage.append("startuplogo.png"); } QPixmap pm; if (!pm.load(splashImage)) { qWarning("Can't load startuplogo! Check your installation."); } splash.setPixmap(pm); splash.show(); splash.showMessage(splashHtml.arg(tr("Initializing the SWORD engine...")), Qt::AlignCenter); } initBackends(); if (showSplash) { splash.showMessage(splashHtml.arg(tr("Creating BibleTime's user interface...")), Qt::AlignCenter); } initView(); if (showSplash) { splash.showMessage(splashHtml.arg(tr("Initializing menu- and toolbars...")), Qt::AlignCenter); } initActions(); initConnections(); readSettings(); setWindowTitle("BibleTime " BT_VERSION); setWindowIcon(DU::getIcon(CResMgr::mainWindow::icon)); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); MainWindow mw; QSplashScreen splash; splash.setPixmap(QPixmap(":/images/welcome")); splash.show(); QTimer::singleShot(2500, &splash, SLOT(close())); QTimer::singleShot(2500, &mw, SLOT(show())); return app.exec(); }
void splashScreen() { QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap("./image/splash.jpg")); splash->show(); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; splash->showMessage(QObject::tr("Setting up the Login Window..."), topRight, Qt::red); QTest::qSleep(3000); splash->showMessage(QObject::tr("Loading modules..."), topRight, Qt::blue); QTest::qSleep(3000); delete splash; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap("/media/shreyas/DATA/Photography/Shortlisted/splashscreen.png")); splash->show(); Login w; //Splash Screen will appear for 2.5sec (2500msec) and then start the application QTimer::singleShot(2500,splash,SLOT(close())); QTimer::singleShot(2500,&w,SLOT(show())); return a.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/images/splash.jpg")); splash->show(); splash->showMessage(QApplication::tr("Setting up the main window..."), Qt::AlignRight | Qt::AlignTop); MainWindow w; w.show(); splash->finish(&w); splash->close(); delete splash; return a.exec(); }
sint main(int argc, char **argv) { // go nel! { // use log.log if NEL_LOG_IN_FILE and NLQT_USE_LOG_LOG defined as 1 createDebug(NULL, NLQT_USE_LOG_LOG, false); #if NLQT_USE_LOG // create toverhex_client.log // filedisplayer only deletes the 001 etc if (NLQT_ERASE_LOG && CFile::isExists(NLQT_LOG_FILE)) CFile::deleteFile(NLQT_LOG_FILE); // initialize the log file NLQT::s_FileDisplayer = new CFileDisplayer(); NLQT::s_FileDisplayer->setParam(NLQT_LOG_FILE, NLQT_ERASE_LOG); DebugLog->addDisplayer(NLQT::s_FileDisplayer); InfoLog->addDisplayer(NLQT::s_FileDisplayer); WarningLog->addDisplayer(NLQT::s_FileDisplayer); AssertLog->addDisplayer(NLQT::s_FileDisplayer); ErrorLog->addDisplayer(NLQT::s_FileDisplayer); #endif nlinfo("Welcome to NeL!"); NLMISC::CPath::remapExtension("tga", "png", true); } QApplication app(argc, argv); QSplashScreen *splash = new QSplashScreen(); splash->setPixmap(QPixmap(":/images/nel_ide_load.png")); splash->show(); Modules::init(); // load and set remap extensions from config Modules::config().configRemapExtensions(); // load and set search paths from config Modules::config().configSearchPaths(); Modules::mainWin().showMaximized(); splash->finish(&Modules::mainWin()); int result = app.exec(); Modules::release(); return result; }
// Start method main int main(int argc, char *argv[]) { QApplication a(argc, argv); // Create splashscreen object QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/img/images/splash.png")); splash->show(); // Create database object Database *db = new Database(); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; splash->showMessage(QObject::tr("Establishing connections..."), topRight, Qt::white); // Database connection if(!db->createConnection()) return 1; // Client connection Clock clock; clock.show(); splash->showMessage(QObject::tr("Setting up main window..."), topRight, Qt::white); // Create game window GameWindow gameWindow; splash->showMessage(QObject::tr("Setting up game..."), topRight, Qt::white); // create game Game *game = new Game(); gameWindow.setCentralWidget(game); gameWindow.show(); splash->finish(&gameWindow); delete splash; return a.exec(); }// End method main
/*! * \brief Software entry point. * \param[in] argc Number of arguments. * \param[in] argv Arguments. * \return Execution status. */ int main(int argc, char *argv[]) { QApplication a(argc, argv); // Set application info. qApp->setOrganizationName("DKrepsky"); qApp->setOrganizationDomain("dkrepsky.blogspot.com.br"); qApp->setApplicationName("QuickFlow"); qApp->setApplicationVersion(version); QSplashScreen *splash = new QSplashScreen(); // Load splash screen if arg -nosplash is not present. if(!QApplication::arguments().contains("-nosplash")) { QPixmap pixmap(qApp->applicationDirPath() + QDir::separator() + "images" + QDir::separator() + "splash.png"); splash->setPixmap(pixmap); splash->show(); splash->showMessage(QString("Version: ") + version, Qt::AlignBottom | Qt::AlignRight); qApp->processEvents(); } // Load and configure main window. QuickFlow w; QIcon appicon(qApp->applicationDirPath() + QDir::separator() + "images" + QDir::separator() + "appicon.png"); qApp->setWindowIcon(appicon); w.setWindowIcon(appicon); // Show mainWindow. if(!QApplication::arguments().contains("-nosplash")) { // Close splash screen and open main windows after 2500 msec. QTimer::singleShot(2500, splash, SLOT(close())); QTimer::singleShot(2500, &w, SLOT(show())); } else { // Show it right way. w.show(); } // Process application messages. return a.exec(); }
//C:\QT\Qt5.3.1\5.3\mingw482_32\plugins\sqldriver int main(int argc, char *argv[]) { // para ver conexion name git remote // git pull origin // git add * // git commit // git push origin master QApplication a(argc, argv); QWebSettings::setMaximumPagesInCache(0); QWebSettings::setObjectCacheCapacities(0, 0, 0); QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap("Splashscreen.jpg")); splash->show(); MainWindow p; QTimer::singleShot(2500, splash, SLOT(close())); QTimer::singleShot(2500, &p, SLOT(showMaximized())); // delete splash; return a.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); Q_INIT_RESOURCE(QtOME); MainWindow w; QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/splash")); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; splash->show();splash->showMessage(QObject::tr("Setting up the main window..."), topRight, Qt::black); w.setSplash(splash); //QObject::connect(w.action_Quit, SIGNAL(triggered()), MainWindow, SLOT(close())); w.showMaximized(); return a.exec(); }
int main(int argc, char *argv[]) { KAboutData aboutData( "WebPhonon", "WebPhonon", ki18n("WebPhonon"), "1.4", ki18n("Media Player"), KAboutData::License_GPL, ki18n("Copyright (c) 2013 Zakhrov") ); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineOptions options; //new options.add("+[file]", ki18n("Document to open")); //new KCmdLineArgs::addCmdLineOptions(options); //new QApplication a(argc, argv); QCoreApplication::setApplicationName("WebPhonon"); MainWindow w; QPixmap img; img.load(":/splash/WebPhonon-Master-text2.png"); QSplashScreen spl; spl.setPixmap(img); spl.show(); QStringList cmd=a.arguments(); // QTextStream cout(stdout); // cout<<argv[0]<<endl; // cout<<argv[1]<<endl; // if(!cmd.isEmpty()) // { // w.cmdopen(cmd.last()); // } KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new if(args->count()) //new { w.cmdopen(args->url(0).url()); //new } w.showMaximized(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap("C:/Users/Nate/Desktop/Qtstuff/texteditor/Splash.png")); //splash->setPixmap(QPixmap("C:/Users/Byron/CSE-20212/Images/Splash.png")); splash->show(); a.setWindowIcon(QIcon("C:/Users/Nate/Desktop/Qtstuff/texteditor/Icon.png")); // a.setWindowIcon(QIcon("C:/Users/Byron/CSE-20212/Images/Icon.png")); a.processEvents(); sleep(3); QFont font("Lucida", 10, 0, false); MainWindow * mainWin = new MainWindow; a.setFont(font, "QPlainTextEdit"); mainWin->show(); splash->finish(mainWin); return a.exec(); }
/** * Main function for the parameterGUI. * The parameterGUI is a graphical user interface for editing parameter files based on the XML format, * created by the ParameterHandler::print_parameters() function with ParameterHandler::XML as second argument. * * @image html logo_dealii_gui.png * * @note This class is used in the graphical user interface for the @ref ParameterHandler class. * It is not compiled into the deal.II libraries and can not be used by applications using deal.II. * * * <p>This program uses Qt version > 4.3. Qt is licensed under the GNU General Public License * version 3.0. Please see http://qt.nokia.com/products/licensing for an overview of Qt licensing. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). Qt is a Nokia product. * See http://qt.nokia.com/ for more information.</p> * * * @ingroup ParameterGui * @author Martin Steigemann, Wolfgang Bangerth, 2010 */ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(application); // init resources such as icons or graphics QApplication app(argc, argv); QSplashScreen * splash = new QSplashScreen; // setup a splash screen splash->setPixmap(QPixmap(":/images/logo_dealii_gui.png")); splash->show(); QTimer::singleShot(3000, splash, SLOT(close())); // and close it after 3000 ms app.setApplicationName("parameterGUI for deal.II"); // setup the application name dealii::ParameterGui::MainWindow * main_win = new dealii::ParameterGui::MainWindow (argv[1]); // give command line arguments to main_win // if a parameter file is specified at the // command line, give it to the MainWindow. QTimer::singleShot(1500, main_win, SLOT(show())); // show the main window with a short delay // so we can see the splash screen return app.exec(); }
int main(int argc, char *argv[]) { qRegisterMetaType<byte>("byte"); qRegisterMetaType<word>("word"); qRegisterMetaType<dword>("dword"); QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/icon/icon/splash.png")); splash->setDisabled(true); splash->show(); splash->showMessage(QObject::tr("Starting..."), Qt::AlignRight | Qt::AlignTop, Qt::white); MainWindow w; w.show(); splash->finish(&w); delete splash; return a.exec(); }
int main(int argc, char *argv[]) { QDir dir; QString path=dir.absolutePath(); QDate data = QDate::currentDate(); int DaysInMonths = data.daysInMonth(); int ActualDay = data.day(); int currentExitCode = 0; do { QApplication a(argc, argv); a.setStyle("fusion"); QFont font("Calibri Light", 12, QFont::Light ,false); QFont font_main("Calibri Light", 10, QFont::Light ,false); QFont splash_font("Calibri Light", 24, QFont::Bold); LoginDialog *logindialog = new LoginDialog; MainWindow w; logindialog->setWindowFlags(((logindialog->windowFlags() | Qt::CustomizeWindowHint) & Qt::WindowCloseButtonHint & ~Qt::WindowContextHelpButtonHint) ); /* Ekran startowy*/ if(currentExitCode != MainWindow::EXIT_CODE_REBOOT) { QSplashScreen * splash = new QSplashScreen; splash->setPixmap(QPixmap(path+"/obrazy/splash.png")); splash->setFont(splash_font); splash->show(); splash->showMessage(QObject::tr("Uruchamianie programu "), Qt::AlignLeft | Qt::AlignTop, Qt::black); //This line represents the alignment of text, color and position qApp->processEvents(); QTimer::singleShot(2000,splash,SLOT(close())); QString Splash_string = "Uruchamianie programu"; QString Splash_string_add = "Uruchamianie programu"; for(int i=0;i<12;i++) { QThread::msleep(150); Splash_string_add = Splash_string_add + "."; if(i==3 || i==7 || i==11) Splash_string_add = Splash_string; splash->showMessage(Splash_string_add, Qt::AlignLeft | Qt::AlignTop, Qt::black); //This line represents the alignment of text, color and position } } /* signal-slot - connect login and password from logindialog with MainWindow */ QObject::connect(logindialog, SIGNAL(sendAccess(QString,QString)), &w, SLOT(receiveAccess(QString,QString))); logindialog->setWindowIcon(QIcon(path+"/obrazy/log_icon.png")); logindialog->setWindowTitle("SERWIS - Logowanie"); logindialog->setFont(font); if (logindialog->exec() != QDialog::Accepted) { a.quit(); return 0; } else { delete logindialog; w.showMaximized(); w.setWindowTitle("SERWIS"); w.setWindowIcon(QIcon(path+"/obrazy/services_icon.png")); w.setFont(font_main); w.show(); QFile file; QString file_name="AUTO_BACKUP.txt"; file.setFileName(file_name); if(!file.exists() && (DaysInMonths-ActualDay)==1){ QMessageBox::warning(&w,"Informacja","****************** Do końca miesiąca został 1 dzień! *******************\n" "Wykonany zostanie automatyczny zapis kopii zapasowej bazy danych. \n" "*************************************************************************"); QTimer::singleShot(500,&w,SLOT(create_backup())); qDebug() << "Doesn't exists: "<<file_name; file.open(QIODevice::ReadWrite | QIODevice::Text); QTextStream stream(&file); file.close(); }else if (file.exists() && (DaysInMonths-ActualDay)!=1){ qDebug() << file_name <<" removing ..."; file.remove(); }else if (file.exists() && (DaysInMonths-ActualDay)==1) { qDebug() << file_name <<" already created ..."; } } currentExitCode = a.exec(); } while( currentExitCode == MainWindow::EXIT_CODE_REBOOT ); return currentExitCode; }
int runSingleSession(int argc, char *argv[]){ //QTime clock; //clock.start(); Backend::checkLocalDirs(); // Create and fill "/usr/local/share/PCDM" if needed Backend::openLogFile("/var/log/PCDM.log"); //qDebug() << "Backend Checks Finished:" << QString::number(clock.elapsed())+" ms"; //Check for the flag to try and auto-login bool ALtriggered = FALSE; if(QFile::exists(TMPAUTOLOGINFILE)){ ALtriggered=TRUE; QFile::remove(TMPAUTOLOGINFILE); } QString changeLang; // Load the configuration file QString confFile = "/usr/local/etc/pcdm.conf"; if(!QFile::exists(confFile)){ qDebug() << "PCDM: Configuration file missing:"<<confFile<<"\n - Using default configuration"; confFile = ":samples/pcdm.conf"; } Config::loadConfigFile(confFile); //qDebug() << "Config File Loaded:" << QString::number(clock.elapsed())+" ms"; // Startup the main application QApplication a(argc,argv); // Show our splash screen, so the user doesn't freak that that it takes a few seconds to show up QSplashScreen splash; if(!Config::splashscreen().isEmpty()){ splash.setPixmap( QPixmap(Config::splashscreen()) ); //load the splashscreen file } splash.show(); QCoreApplication::processEvents(); //Process the splash screen event immediately //qDebug() << "SplashScreen Started:" << QString::number(clock.elapsed())+" ms"; //Initialize the xprocess XProcess desktop; //*** STARTUP THE PROGRAM *** bool goodAL = FALSE; //Flag for whether the autologin was successful // Start the autologin procedure if applicable if( ALtriggered && Config::useAutoLogin() ){ //Setup the Auto Login QString user = Backend::getALUsername(); QString pwd = Backend::getALPassword(); QString dsk = Backend::getLastDE(user); if( user.isEmpty() || dsk.isEmpty() ){ goodAL=FALSE; }else{ desktop.loginToXSession(user,pwd, dsk); splash.close(); if(desktop.isRunning()){ goodAL=TRUE; //flag this as a good login to skip the GUI } } } //qDebug() << "AutoLogin Finished:" << QString::number(clock.elapsed())+" ms"; if(!goodAL){ // ------START THE PCDM GUI------- // Check what directory our app is in QString appDir = "/usr/local/share/PCDM"; // Load the translator QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); //Check for a language change detected if ( ! changeLang.isEmpty() ) langCode = changeLang; //Load the proper locale for the translator if ( QFile::exists(appDir + "/i18n/PCDM_" + langCode + ".qm" ) ) { translator.load( QString("PCDM_") + langCode, appDir + "/i18n/" ); a.installTranslator(&translator); Backend::log("Loaded Translation:" + appDir + "/i18n/PCDM_" + langCode + ".qm"); } else { Backend::log("Could not find: " + appDir + "/i18n/PCDM_" + langCode + ".qm"); langCode = ""; } //qDebug() << "Translation Finished:" << QString::number(clock.elapsed())+" ms"; Backend::log("Starting up PCDM interface"); PCDMgui w; //qDebug() << "Main GUI Created:" << QString::number(clock.elapsed())+" ms"; splash.finish(&w); //close the splash when the GUI starts up // Set full-screen dimensions QRect dimensions = QApplication::desktop()->screenGeometry(); int wid = dimensions.width(); // returns desktop width int hig = dimensions.height(); // returns desktop height w.setGeometry(0, 0, wid, hig); //Set the proper size on the Application w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint); w.setWindowState(Qt::WindowMaximized); //Qt::WindowFullScreen); //Setup the signals/slots to startup the desktop session if(USECLIBS){ QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString)), &desktop,SLOT(setupDesktop(QString,QString,QString))); } else{ QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString)), &desktop,SLOT(loginToXSession(QString,QString,QString)) ); } //Setup the signals/slots for return information for the GUI QObject::connect( &desktop, SIGNAL(InvalidLogin()), &w, SLOT(slotLoginFailure()) ); QObject::connect( &desktop, SIGNAL(started()), &w, SLOT(slotLoginSuccess()) ); QObject::connect( &desktop, SIGNAL(ValidLogin()), &w, SLOT(slotLoginSuccess()) ); //qDebug() << "Showing GUI:" << QString::number(clock.elapsed())+" ms"; w.show(); a.exec(); } // end of PCDM GUI running int retcode = 0; //Wait for the desktop session to finish before exiting if(USECLIBS){ desktop.startDesktop(); } else{ desktop.waitForSessionClosed(); } splash.show(); //show the splash screen again splash.showMessage(QObject::tr("System Shutting Down"), Qt::AlignHCenter | Qt::AlignBottom, Qt::white); //check for shutdown process if(QFile::exists("/var/run/nologin")){ //Pause for a few seconds to prevent starting a new session during a shutdown QTime wTime = QTime::currentTime().addSecs(30); while( QTime::currentTime() < wTime ){ //Keep processing events during the wait (for splashscreen) QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } //set the return code for a shutdown retcode = -1; //make sure it does not start a new session } //Clean up Code delete &desktop; delete &a; delete &splash; return retcode; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QSplashScreen *splash; splash = new QSplashScreen; splash->setPixmap(QPixmap(":/Resources/cfesplash.png")); splash->show(); Qt::Alignment bottomLeft = Qt::AlignLeft | Qt::AlignBottom; splash->showMessage(QObject::tr("Cargando Ajustes..."), bottomLeft, Qt::white); splash->showMessage(QObject::tr("Creando Interfaces..."), bottomLeft, Qt::white); /* SQLite sl; sl.IniciaBD(); sl.VaciarTxtBD("C:/SiTTuGAs/Punteros.csv");//*/ // Recuperamos la configuración Config *config = SQLite::getConfig(); if(config == NULL) { qDebug()<<"Ha fallado la configuración..."; } //Determinamos que modo es el adecuado if(config->getMode() == 0) { // Creamos la consola Console *w = new Console(config); w->show(); splash->finish(w); } else { HTTPRequest *http = new HTTPRequest(config); //Proporciona acceso a informacion de la pantalla en los sistemas multi-cabeza QDesktopWidget *m = QApplication::desktop(); //Lista de instancias a las interfaces QList <SiTTuGAs *> list; //variable auxiliar para la instancia de cada interfaz SiTTuGAs *w; //En base al numero de pantallas es como itera este lazo for(int i=0; i<m->screenCount(); i++) { //Creamos el gestor de las interfaces *(se cargan todas las interfaces) w = new SiTTuGAs(config, http); //lista que contiene referencias a todos los gestores creados list.push_front(w); //Devuelve la geometria disponible por la pantalla QRect r1=m->availableGeometry(i); //Movemos la interfaz de acuerdo con los valores recabados anteriormente w->move(r1.x(),r1.y()); } //Terminamos splash splash->finish(w); //Iteramos hasta desplegar todas las GUI de SiTTuGAs foreach(SiTTuGAs *W, list) { //Las pantallas mantienen un tamaño de 1024 X 662 por lo que para presentar la interfaz adecuadamente la pantalla debe tener la misma resolución //W->showFullScreen(); //temporalmete utilizaremos solo el desplegado normal de la pantalla para cada instancia generada W->show(); } } return a.exec(); }
/** * Start point of the program which executes the main window * @param argc Slots of command line parameter * @param argv Values of command line parameter * @return The executing main window */ int main(int argc, char *argv[]) { QApplication a(argc, argv); #ifdef LOGFILE QString fileName = QCoreApplication::applicationFilePath() + ".log"; QFile *log = new QFile(fileName); if (log->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { out = new QTextStream(log); qInstallMessageHandler(messageOutput); } else { qDebug() << "Error opening log file '" << fileName << "'. All debug output redirected to console."; } #endif // Check language QTranslator translator; QString current = QLocale::system().name(); if ( current.contains("de_DE") ) { translator.load("scribo_de", ":/translations"); a.installTranslator(&translator); } // Load splash screen QSplashScreen *splash = new QSplashScreen; splash->setPixmap( QPixmap(":/img/splash.jpg") ); splash->show(); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; splash->setStyleSheet("font-size: 10px;"); splash->showMessage(QObject::tr("Loading modules..."), topRight, Qt::white); QCoreApplication::setApplicationName("Scribo"); QCoreApplication::setApplicationVersion("0.1"); // Create directories QString scriboDir = QDir::home().absolutePath() + QDir::separator() + "scribo"; if ( !QDir(scriboDir).exists() ) QDir().mkdir(scriboDir); splash->showMessage(QObject::tr("Establishing connections..."), topRight, Qt::white); // Create database connection Database db; if ( !db.open() ) { qDebug() << "Failed to open the database.\n" "Please check the database settings"; } else { qDebug() << "Connected to the database"; } splash->showMessage(QObject::tr("Loading..."), topRight, Qt::white); MainWindow w; QTimer::singleShot(3000, splash, SLOT(close())); QTimer::singleShot(3000, &w, SLOT(show())); //w.show(); qDebug() << "Application started..."; return a.exec(); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(icons); QApplication a(argc, argv); // 系统图标 if (!QSystemTrayIcon::isSystemTrayAvailable()) { QMessageBox::critical(0, QObject::tr("Systray"), QObject::tr("I couldn't detect any system tray " "on this system.")); return 1; } QApplication::setQuitOnLastWindowClosed(false); QApplication::addLibraryPath("./plugins"); QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码 QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码 bool isrunning = CheckIfRunning("lz_master_gui.exe", false); if (isrunning) { return 1; } isrunning = CheckIfRunning("lz_master_monitor.exe", true); if (isrunning) { return 1; } QSplashScreen *splash = new QSplashScreen(); splash->setPixmap(QPixmap(":/image/start.png")); QTimer::singleShot(3000, splash, SLOT(close())); splash->show(); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; splash->showMessage(QObject::tr("正在初始化..."),topRight,Qt::yellow); // 加载本地文件存储目录 QFile file("master_datastore_path.txt"); if (!file.open(QIODevice::ReadOnly)) { qDebug() << QObject::tr("无文件master_datastore_path.txt,无法加载主控机数据存储目录位置"); return 1; } else { QString parentpath = file.readLine().trimmed(); MasterSetting::getSettingInstance()->setParentPath(parentpath); file.close(); } // 【标记2】此处作废-因为MasterProgram类的run函数作废 // 【注意】顺序:先有masterProgramInstance,才run,能连接信号槽 //MasterProgram::getMasterProgramInstance()->run(); /*******************************/ MainWidget *w = new MainWidget(true, Collecting); w->show(); // 【注意】顺序:先有masterProgramInstance,才能连接信号槽 MasterProgram::getMasterProgramInstance(); // connect函数必在MasterProgram::getMasterProgramInstance()之后 MasterProgram::getMasterProgramInstance()->init(); splash->showMessage(QObject::tr("正在启动程序..."),topRight,Qt::yellow); splash->finish(w); delete splash; return a.exec(); }