QSplashScreen *Application::buildSplashScreen() { const QPixmap logoPixmap(":/images/logo.png"); QDesktopWidget *desktop = QApplication::desktop(); QRect desktopRect = desktop->availableGeometry(); QPixmap splashPixmap(desktopRect.width(), desktopRect.height()); QPainter painter; painter.begin(&splashPixmap); QLinearGradient backgroundGradient( splashPixmap.rect().width() / 2, 0, splashPixmap.rect().width() / 2, splashPixmap.rect().height()); backgroundGradient.setColorAt(0, QColor::fromRgb(40, 50, 57)); backgroundGradient.setColorAt(1, QColor::fromRgb(19, 25, 29)); painter.fillRect(splashPixmap.rect(), backgroundGradient); QRect logoRect((splashPixmap.width() - logoPixmap.width()) / 2, (splashPixmap.height() - logoPixmap.height()) / 2, logoPixmap.width(), logoPixmap.height()); painter.drawPixmap(logoRect, logoPixmap); painter.end(); QScopedPointer<QSplashScreen> splashScreen(new QSplashScreen(splashPixmap)); if (desktopRect.width() > desktopRect.height()) { splashScreen->setAttribute(Qt::WA_LockLandscapeOrientation, true); } else { splashScreen->setAttribute(Qt::WA_LockPortraitOrientation, true); } return splashScreen.take(); }
int main(int argc, char *argv[]) { BrowserApplication a(argc, argv); //MainWindow w; BrowserMainWindow w; QRect maxRect; { QDesktopWidget desktop; maxRect = desktop.availableGeometry(); maxRect.adjust(50,50,-50,-50); } w.setGeometry(maxRect); qDebug() << QApplication::applicationDirPath() << QApplication::applicationFilePath(); { QPixmap splashPixmap(QApplication::applicationDirPath() + "/comm/conf/pics/splash.png"); QSplashScreen splash(splashPixmap); splash.show(); enum { splashTime = 1500 }; QTimer timer; timer.start(splashTime); do { a.processEvents(); splash.showMessage(QString("Loading Process: %1%").arg(timer.remainingTime()*100.0/splashTime),Qt::AlignBottom); } while(timer.remainingTime() > 1); splash.finish(&w); } w.show(); a.processEvents(); return a.exec(); }
/* 1 Thessalonians 5:9 - For God hath not appointed us to wrath, * but to obtain salvation by our Lord Jesus Christ. * <-||--> What an AmaZinG TRUTH!!! */ int main(int argc, char* argv[]) { QApplication App(argc, argv); std::ios::sync_with_stdio(false); QApplication::setApplicationVersion(PROGRAM_VERSION_FULL_STRING); QApplication::setApplicationDisplayName("DupLichaSe"); QApplication::setApplicationName("DupLichaSe"); QApplication::setOrganizationName("DeltoidCoorp"); QApplication::setOrganizationDomain("blog.whiztim.com"); QString fileName; const QStringList arguments = App.arguments(); if(arguments.size() > 2) { std::cerr << QObject::tr("Invalid Argumentss passed!\n" "NOTE: Only One parameter Needed; and that is" "\ta path to an existing .dlsr file(DupLichaSe Result file)\nor\n" "NOTE: Start the Program without arguments!\n").toStdString(); return -1; } else if(arguments.size() == 2) { fileName = arguments.at(1); if(!QFile::exists(fileName)) { QString msg(QObject::tr("Failed to access: \"") + fileName + QObject::tr("\"\n\tmaybe DupLichaSe does not have read permission here")); std::cerr << msg.toStdString() << std::endl; return -1; } if(not fileName.endsWith(".dlsr")) { QMessageBox msg(QMessageBox::Critical, QObject::tr("DupLichaSe -- Error"), QObject::tr("Invalid DupLichaSe Result file... Aborting The program"), QMessageBox::Ok); return msg.exec(); } } QPixmap splashPixmap(":/main/splashScreen.png"); QSplashScreen splashScreen(splashPixmap); splashScreen.show(); DLSMainWindow window; splashScreen.show(); QTimer::singleShot(3300, &window, SLOT(show())); QTimer::singleShot(4400, &splashScreen, SLOT(close())); if(not fileName.isEmpty()) window.loadResultsFromFile(fileName); return App.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QCoreApplication::setOrganizationName("Scary HalloSoft"); QCoreApplication::setOrganizationDomain("hallosoft.de"); QCoreApplication::setApplicationName("Hallos Inspection Tool"); // Version QString versionString = QString("%1.%2.%3.%4").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(VERSION_REVISION).arg(VERSION_BUILD); a.setApplicationVersion(versionString); qDebug() << "Version" << versionString; // splash screen QPixmap splashPixmap(":/pic/icons/Slpash.png"); Q_ASSERT(!splashPixmap.isNull()); QSharedMemory sharedMemory; sharedMemory.setKey("HallosInspectionTool"); if (!sharedMemory.create(1)) { qDebug() << "Shared memory:" << sharedMemory.errorString(); QMessageBox::warning(0, QApplication::tr("Warning!"), QApplication::tr("An instance of HIT is running!") ); exit(0); // Exit, a process is already running } QSplashScreen splash(splashPixmap); splash.show(); qApp->processEvents(); splash.showMessage(QString("Version %1").arg(versionString), Qt::AlignBottom); qApp->processEvents(); MainWindow w; w.show(); splash.finish(&w); return a.exec(); }