本文整理汇总了C++中QSplashScreen类的典型用法代码示例。如果您正苦于以下问题:C++ QSplashScreen类的具体用法?C++ QSplashScreen怎么用?C++ QSplashScreen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QSplashScreen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
//qDebug()<<QString::fromUtf8("主线程地址是:")<<QThread::currentThread();
#if defined(Q_OS_SYMBIAN)||defined(Q_WS_SIMULATOR)
QPixmap pixmap(":/Image/Symbian.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->show();
splash->raise();
#endif
#ifndef QT_NO_DEBUG
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName("localhost");
proxy.setPort(8888);
QNetworkProxy::setApplicationProxy(proxy);
#endif
//int width=QApplication::desktop()->width();
//int height=QApplication::desktop()->height();
app->setApplicationName (QString::fromUtf8("IT之家"));
app->setOrganizationName ("Stars");
app->setApplicationVersion ("1.2.2");
Settings *setting=new Settings;
Utility *unility=new Utility;
Cache *cacheContent=new Cache(setting);
//qmlRegisterType<MyXmlListModel>("myXmlListModel",1,0,"MyXmlListModel");
//qmlRegisterType<MyXmlRole>("myXmlListModel", 1, 0, "MyXmlRole");
QmlApplicationViewer viewer;
MyNetworkAccessManagerFactory *network = new MyNetworkAccessManagerFactory();
viewer.engine()->setNetworkAccessManagerFactory(network);
viewer.rootContext ()->setContextProperty ("cacheContent",cacheContent);
viewer.rootContext()->setContextProperty("settings",setting);
viewer.rootContext()->setContextProperty("utility",unility);
QWebSettings::globalSettings ()->setAttribute (QWebSettings::LocalContentCanAccessRemoteUrls,true);
QWebSettings::globalSettings ()->setAttribute (QWebSettings::SpatialNavigationEnabled,true);
QWebSettings::globalSettings ()->setAttribute (QWebSettings::SpatialNavigationEnabled, true);
#if defined(Q_OS_SYMBIAN)||defined(Q_WS_SIMULATOR)
#if defined(Q_OS_S60V5)//判断qt的版本
qWarning("build symbian s60v5");
viewer.setMainQmlFile(QLatin1String("qml/symbian-v5/main.qml"));
if(setting->getValue("night_mode",false).toBool())
unility->setCss("./qml/symbian-v5/theme_black.css",viewer.width()-20);//设置默认的css
else
unility->setCss("./qml/symbian-v5/theme_white.css",viewer.width()-20);
#elif defined(Q_OS_S60V3)
qWarning("build symbian s60v3");
viewer.setMainQmlFile(QLatin1String("qml/symbian-v3/main.qml"));
if(setting->getValue("night_mode",false).toBool())
unility->setCss("./qml/symbian-v3/theme_black.css",viewer.width()-20);//设置默认的css
else
unility->setCss("./qml/symbian-v3/theme_white.css",viewer.width()-20);
#else
qWarning("build symbian anna or simulator");
viewer.setMainQmlFile(QLatin1String("qml/symbian-anna/main.qml"));
if(setting->getValue("night_mode",false).toBool())
unility->setCss("./qml/symbian-anna/theme_black.css",viewer.width()-20);//设置默认的css
else
unility->setCss("./qml/symbian-anna/theme_white.css",viewer.width()-20);
#endif
viewer.showExpanded();
splash->finish(&viewer);
splash->deleteLater();
#elif defined(Q_OS_HARMATTAN)
qWarning("build meego");
viewer.setMainQmlFile(QLatin1String("qml/meego/main.qml"));
if(setting->getValue("night_mode",false).toBool())
unility->setCss("/opt/ithome/qml/meego/theme_black.css",460);//设置默认的css
else
unility->setCss("/opt/ithome/qml/meego/theme_white.css",460);
viewer.showExpanded();
#endif
return app->exec();
}
示例2: main
int main( int argc, char ** argv )
{
QApplication a( argc, argv );
// dSelectDB dselectdb;
dLogin dlogin;
// application = &a;
int rc = 1;
bool ok;
QPixmap pixmap;
BrInitError error;
QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") );
if ( parseCommandLine( qApp->argc(), qApp->argv() ) ) return 1;
qApp->installTranslator( &tr_app );
qApp->installTranslator( &tr_lib );
qApp->installTranslator( &tr_plugins );
pixmap = QPixmap::fromMimeSource( "engine-splash-"+lang+".png" );
if ( pixmap.isNull() )
#ifdef _Windows
pixmap = QPixmap::fromMimeSource( qApp->applicationDirPath()+"/engine-splash-"+lang+".png" );
qApp->addLibraryPath( qApp->applicationDirPath() );
#else
if (br_init_lib(&error) == 0 && error != BR_INIT_ERROR_DISABLED) {
aLog::print(aLog::MT_INFO, QObject::tr("Warning: BinReloc failed to initialize (error code %1)\n").arg(error));
aLog::print(aLog::MT_INFO, QObject::tr("Will fallback to hardcoded default path.\n"));
}
aLog::print(aLog::MT_DEBUG, QObject::tr("main - BinReloc path to data dir is %1.\n").arg( br_find_data_dir("/usr/share") ));
aLog::print(aLog::MT_DEBUG, QObject::tr("main - BinReloc path to lib dir is %1.\n").arg( br_find_data_dir("/usr/lib") ));
pixmap = QPixmap::fromMimeSource( QString(br_find_data_dir("/usr/share") ) + "/ananas/designer/locale/engine-splash-"+lang+".png");
qApp->addLibraryPath( QString( br_find_lib_dir("/usr/lib")) + "/ananas/qt3plugins" );
QStringList list = a.libraryPaths();
QString libPath = "";
QStringList::Iterator it = list.begin();
while( it != list.end() ) {
libPath += *it+":";
++it;
}
aLog::print(aLog::MT_DEBUG, QString("main - qt library path is '%1'\n").arg( libPath));
#endif
printf("extensions: \n%s\n",( const char *) AExtensionFactory::keys().join("\n") );
// Test create extension
// AExtension *e = AExtensionFactory::create("AExtTest");
// if (e) printf("EXT OK\n"); else printf("NO EXT OK\n");
if ( pixmap.isNull() )
pixmap = QPixmap::fromMimeSource( "engine-splash-en.png" );
QSplashScreen *splash = new QSplashScreen( pixmap );
if ( ananas_login( rcfile, username, userpassword ) ){
// if ( rcfile.isEmpty() ) {
// if (dselectdb.exec()==QDialog::Accepted) rcfile = dselectdb.rcfile;
// }
// if ( !rcfile.isEmpty() ) {
// if (dlogin.exec()==QDialog::Accepted) {
// username = dlogin.username;
// userpassword = dlogin.password;
// }
// if (dselectdb.rcfile.isEmpty()) return 0;
splash->show();
splash->message( QObject::tr("Init application"), Qt::AlignBottom, Qt::white );
MainForm *w = new MainForm( 0, "MainForm");
mainform = w;
mainformws = mainform->ws;
mainformwl = mainform->wl;
qApp->setMainWidget( w );
w->rcfile = rcfile;
// printf( "rcfile = %s\n", rcfile.ascii() );
w->show();
ok = w->init();
splash->clear();
splash->finish( w );
delete splash;
if ( ok ) {
qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
rc = qApp->exec();
if( w ) delete w;
w=0;
} else {
QMessageBox::critical(0, QObject::tr("Error"), QObject::tr("Ananas runtime init error. See message window and log file for details."));
}
aLog::close();
return rc;
}
else
{
aLog::close();
return 0;
}
}
示例3: main
int main(int argc, char *argv[])
{
int dummy = errno;
QApplication a(argc, argv);
Debug::init(0);
//mediaPipeline::init(argc, argv);
// Set the Application Language
#if 0
//if (QLocale::system().name() == "zh_CN")
{
QTranslator *translator = new QTranslator(&a);
bool ok = translator->load("vscloudnode_zh.qm",
QCoreApplication::applicationDirPath() + "/translations");
if (ok)
{
qDebug("Translation Files loaded.");
a.installTranslator(translator);
}
}
#endif
QPixmap pixmap(":/logo/resources/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
QFont splashFont;
//splashFont.setFamily("Arial");
splashFont.setBold(true);
splash->setStyleSheet(QStringLiteral("color : red;"));
splash->setFont(splashFont);
splash->show();
//QApplication::setStyle(QStyleFactory::create("Fusion"));
//QApplication::setStyle(QStyleFactory::create("Plastique"));
//QApplication::setStyle("WindowsVista");
#if 0
QFile f(":qdarkstyle/style.qss");
if (!f.exists())
{
printf("Unable to set stylesheet, file not found\n");
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
a.setStyleSheet(ts.readAll());
}
#endif
gFactory = new Factory;
splash->showMessage("Starting ...");
if (gFactory->Init() == FALSE)
{
#ifdef WIN32
astring strPath = "C:\\";//TODO get the hdd from hdd
VSCHddDevice hdd;
hdd.show();
hdd.exec();
s32 size = hdd.GetDiskSize();
hdd.GetDiskPath(strPath);
#else
astring strPath = "ve/";//TODO get the hdd from hdd
s32 size = 2;
#endif
gFactory->SetSystemPath(strPath);
splash->showMessage("Create Video Database ...");
gFactory->Init();
#ifndef WIN32
//gFactory->AddHDD(strPath, size);
#endif
}
VEvent::Init(*gFactory);
VServiceMgr *pServiceMgr = VServiceMgr::CreateObject(*gFactory);
VSCMainWindows w;
//w.setWindowIcon(QIcon(":/logo/resources/vscsmall.jpg"));
//w.show();
//Sleep(1000);
//w.setWindowFlags(Qt::FramelessWindowHint );
//w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::CustomizeWindowHint );
w.showMaximized();
//w.showFullScreen();
splash->finish(&w);
//stacked s;
//s.show();
delete splash;
/* Every thread is ready, start the factory thread */
gFactory->start();
return a.exec();
}
示例4: QMainWindow
/*
* @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()));
//.........这里部分代码省略.........
示例5: main
//.........这里部分代码省略.........
for (int i = -40; i < 40; i++) {
for (int j = -30; j < 30; j++) {
Ray ray(Vector3(-10, 0, 0), Vector3(1, i, j));
vector<double> qInter = qSphere.ensIntersect(ray);
vector<double> inter = sphere.ensIntersect(ray);
if (qInter.size() > 0 && inter.size() > 0) {
cerr << qInter.at(0) << " " << inter.at(0) << endl;
}
}
}
Ray ray(Vector3(-10, 0, 0), Vector3(1, 0, 0));
vector<double> qInter = qSphere.ensIntersect(ray);
vector<double> inter = sphere.ensIntersect(ray);
cerr << "qInter " << endl;
for (int k = 0; k < qInter.size(); k++) {
cerr << qInter.at(k) << endl;
}
cerr << "inter " << endl;
for (int k = 0; k < inter.size(); k++) {
cerr << inter.at(k) << endl;
}
Vector3 qNormal = qSphere.normal(ray.getPoint(qInter.at(0)));
cerr << "qNormal " << endl << qNormal << endl;
Vector3 normal = sphere.normal(ray.getPoint(inter.at(0)));
cerr << "normal " << endl << normal << endl;
/*
QStringList params;
params << "x^2-y^2-z^2" << "2xz" << "2xy" << "x^2+y^2+z^2";
Surface sphere = Surface(Color(), Material(), params);
Ray rayon(Vector3(0, -2, 0), Vector3(0, 1, 0));
cerr << "Intersections" << endl;
vector<double> inter = sphere.ensIntersect(rayon);
for (int k = 0; k < inter.size(); k++) {
cerr << inter.at(k) << endl;
}
MatrixOpp mo;
itpp::mat test = "7.11726e-16 0; 0 2.24717e-16";
cerr << test << endl;
cerr << mo.rank(test, pow(10, -10)) << endl;
//itpp::mat test = "1.40508 -1.2714; 0.354598 0.490605";
//itpp::vec testSing = svd(test);
//cerr << test << endl;
//cerr << testSing << endl;
//itpp::mat testDel = "1.40508 -1.2714 0.354598 -1.2714 0.490605; 1.40508 -1.2714 0.354598 -1.2714 0.490605";
//testDel.del_cols(3, 4);
//cerr << testDel << endl;
/*
itpp::mat MatA="-0.107357 -0.0510009 0.830732 0.216346 0.0731312 0.545236 0.598673 0.435944 -0.174946 -0.0154371 0.0188213; 0.394865 0.684388 -0.609272 -0.00989498 0.0179188 -0.0925767 0.445025 0.890383 -0.0217646 0.834316 -0.571974; -0.0386261 -0.126441 0.0246027 0.46594 0.752696 0.316755 0.543039 0.534491 -0.762077 -0.332822 0.558157; -0.172559 1.07088 -0.00299878 0.601361 -0.119217 -0.300484 -0.123059 0.256296 0.430866 -0.801376 0.317803; -0.178008 0.0443514 -0.322137 -0.269033 0.756054 0.325227 0.24626 0.29693 1.14214 0.472322 0.349494; -0.0274508 -0.259354 -0.383347 0.14874 0.275636 -0.348788 -0.0465805 0.731172 -0.188873 -0.609764 0.361292";
itpp::mat MatB="-0.119899 -0.0323817 0.428454 0.0186514 0.00329174 0.0354584 0.278651 0.233471 -0.0232638 -0.00133084 -0.00467978; 0.0330396 0.318083 -0.163199 0.0262524 0.0825663 -0.0136418 -0.0788958 0.43979 -0.104738 0.414932 -0.283949; 0.0191853 0.0191573 -0.132727 0.188931 0.385542 0.145688 0.177995 -0.032711 -0.386778 -0.0134809 0.245401; -0.00388032 0.542053 0.00900084 0.0919673 -0.0771502 -0.0154893 -0.0814925 0.164284 0.112838 -0.385796 0.260114; -0.100031 0.0119408 -0.136066 -0.21962 0.422891 0.168009 0.166844 0.0380245 0.507365 0.0156707 0.0228195; 0.0429022 -0.132374 -0.138398 0.0694264 -0.0216792 -0.0100782 -0.091603 0.366442 0.0347433 -0.304529 0.0720361";
Pencil pen(MatA, MatB);
std::cerr << "########################################" << std::endl;
std::cerr << "A=" << pen.A << std::endl;
std::cerr << "B=" << pen.B << std::endl;
std::cerr << "########################################" << std::endl;
//*/
//*
QApplication app(argc, argv);
QSplashScreen* splash = new QSplashScreen(QPixmap("misc/splash.png"), Qt::WindowStaysOnTopHint);
splash->show();
splash->showMessage("Loading...", Qt::AlignBottom, Qt::white);
MainWindow window;
window.show();
qApp->setStyleSheet("QStringListModel QAbstractItemView { border: 2px solid darkgray; selection-background-color: lightgray; }");
splash->finish(&window);
return app.exec();
//*/
}
示例6: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(companion);
QApplication app(argc, argv);
app.setApplicationName("OpenTX Companion");
app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org");
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
#ifdef __APPLE__
app.setStyle(new MyProxyStyle);
#endif
QTranslator companionTranslator;
companionTranslator.load(":/companion_" + g.locale());
QTranslator qtTranslator;
qtTranslator.load((QString)"qt_" + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&companionTranslator);
app.installTranslator(&qtTranslator);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
uint32_t sdlFlags = 0;
#ifdef JOYSTICKS
sdlFlags |= SDL_INIT_JOYSTICK;
#endif
#ifdef SIMU_AUDIO
sdlFlags |= SDL_INIT_AUDIO;
#endif
if (SDL_Init(sdlFlags) < 0) {
fprintf(stderr, "ERROR: couldn't initialize SDL: %s\n", SDL_GetError());
}
#endif
RegisterEepromInterfaces();
registerOpenTxFirmwares();
if (g.profile[g.id()].fwType().isEmpty()){
g.profile[g.id()].fwType(default_firmware_variant->getId());
g.profile[g.id()].fwName("");
}
QString splashScreen;
if ( g.profile[g.id()].fwType().contains("taranis")) splashScreen = ":/images/splasht.png";
else if ( g.profile[g.id()].fwType().contains("9xrpro")) splashScreen = ":/images/splashp.png";
else if ( g.profile[g.id()].fwType().contains("9xr")) splashScreen = ":/images/splashr.png";
else splashScreen = ":/images/splash.png";
QPixmap pixmap = QPixmap(splashScreen);
QSplashScreen *splash = new QSplashScreen(pixmap);
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
MainWindow *mainWin = new MainWindow();
if (g.showSplash()) {
splash->show();
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
}
else {
mainWin->show();
}
int result = app.exec();
delete splash;
delete mainWin;
UnregisterFirmwares();
UnregisterEepromInterfaces();
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
SDL_Quit();
#endif
return result;
}
示例7: main
int main(int argc, char *argv[])
{
GpioInput gpio(3);
QApplication a(argc, argv);
RightButtonFilter rbf;
QString currentLangCode;
bool runinstaller = false;
// Process command-line arguments
for (int i=1; i<argc; i++)
{
if (strcmp(argv[i], "-runinstaller") == 0)
runinstaller = true;
else if (strcmp(argv[i], "-lang") == 0)
if (argc > i+1)
currentLangCode = argv[++i];
}
// Intercept right mouse clicks sent to the title bar
a.installEventFilter(&rbf);
#ifdef Q_WS_QWS
QWSServer::setCursorVisible(false);
// Set wallpaper and icon, if we have resource files for that
if (QFile::exists(":/icons/raspberry_icon.png"))
a.setWindowIcon(QIcon(":/icons/raspberry_icon.png"));
//if (QFile::exists(":/wallpaper.png"))
// {
//#ifdef CENTER_BACKGROUND_IMAGE
// Using QSplashScreen to get a centered background image
QWSServer::setBackground(BACKGROUND_COLOR);
QSplashScreen *splash = new QSplashScreen(QPixmap(":/wallpaper.png"));
splash->show();
QApplication::processEvents();
//#else
// Scale background image to fit screen
// QRect dim = a.desktop()->availableGeometry();
// QWSServer::setBackground(QImage(":/wallpaper.png").scaled(dim.width(), dim.height()));
//#endif
// }
// else
// {
// QWSServer::setBackground(BACKGROUND_COLOR);
// }
//#endif
#endif
// If -runinstaller is not specified, only continue if SHIFT is pressed, GPIO is triggered or no OS is installed (/dev/mmcblk0p6 does not exist)
bool bailout = !runinstaller
&& gpio.value() != 0
&& !KeyDetection::isF10pressed()
&& QFile::exists(FAT_PARTITION_OF_IMAGE);
if (bailout)
{
reboot_to_extended();
//return 1;
}
// Keyboard detection done, load normal hid driver
QProcess::execute("/sbin/modprobe usbhid");
#ifdef Q_WS_QWS
QWSServer::setCursorVisible(true);
#endif
#ifdef ENABLE_LANGUAGE_CHOOSER
// Language chooser at the bottom center
LanguageDialog* ld = new LanguageDialog(¤tLangCode);
ld->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignHCenter | Qt::AlignBottom, ld->size(), a.desktop()->availableGeometry()));
ld->show();
#endif
// Main window in the middle of screen
MainWindow mw(¤tLangCode, splash, ld);
mw.setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mw.size(), a.desktop()->availableGeometry()));
mw.show();
a.exec();
reboot_to_extended();
return 0;
}
示例8: main
int main(int argc, char *argv[])
{
bool hasTouchScreen = QFile::exists("/sys/devices/platform/rpi_ft5406");
// Unless we have a touch screen, wait for keyboard to appear before displaying anything
if (!hasTouchScreen)
KeyDetection::waitForKeyboard();
int rev = readBoardRevision();
qDebug() << "Board revision is " << rev;
int gpioChannel;
if (rev == 2 || rev == 3)
gpioChannel = 0;
else
gpioChannel = 2;
QApplication a(argc, argv);
RightButtonFilter rbf;
LongPressHandler lph;
GpioInput gpio(gpioChannel);
bool runinstaller = false;
bool gpio_trigger = false;
bool keyboard_trigger = true;
bool force_trigger = false;
QString defaultLang = "en";
QString defaultKeyboard = "gb";
QString defaultDisplay = "0";
QString defaultPartition = "800";
// Process command-line arguments
for (int i=1; i<argc; i++)
{
// Flag to indicate first boot
if (strcmp(argv[i], "-runinstaller") == 0)
runinstaller = true;
// Enables use of GPIO 3 to force NOOBS to launch by pulling low
else if (strcmp(argv[i], "-gpiotriggerenable") == 0)
gpio_trigger = true;
// Disables use of keyboard to trigger recovery GUI
else if (strcmp(argv[i], "-keyboardtriggerdisable") == 0)
keyboard_trigger = false;
// Forces display of recovery GUI every time
else if (strcmp(argv[i], "-forcetrigger") == 0)
force_trigger = true;
// Allow default language to be specified in commandline
else if (strcmp(argv[i], "-lang") == 0)
{
if (argc > i+1)
defaultLang = argv[i+1];
}
// Allow default keyboard layout to be specified in commandline
else if (strcmp(argv[i], "-kbdlayout") == 0)
{
if (argc > i+1)
defaultKeyboard = argv[i+1];
}
// Allow default display mode to be specified in commandline
else if (strcmp(argv[i], "-dispmode") == 0)
{
if (argc > i+1)
defaultDisplay = --argv[i+1];
}
// Allow default boot partition to be specified in commandline
else if (strcmp(argv[i], "-partition") == 0)
{
if (argc > i+1)
defaultPartition = argv[i+1];
}
}
// Intercept right mouse clicks sent to the title bar
a.installEventFilter(&rbf);
// Treat long holds as double-clicks
if (hasTouchScreen)
a.installEventFilter(&lph);
#ifdef Q_WS_QWS
QWSServer::setCursorVisible(false);
#endif
QDir settingsdir;
settingsdir.mkdir("/settings");
// Set wallpaper and icon, if we have resource files for that
if (QFile::exists(":/icons/raspberry_icon.png"))
a.setWindowIcon(QIcon(":/icons/raspberry_icon.png"));
#ifdef Q_WS_QWS
QWSServer::setBackground(BACKGROUND_COLOR);
#endif
QSplashScreen *splash = new QSplashScreen(QPixmap(":/wallpaper.png"));
splash->show();
QApplication::processEvents();
//.........这里部分代码省略.........
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString openFilename = NULL;
if (a.arguments().count() > 1) {
QFile *oFile = new QFile(a.arguments()[1]);
if (oFile->exists()) {
openFilename = oFile->fileName();
}
}
QSplashScreen *splash = new QSplashScreen;
splash -> setPixmap(QPixmap(":/images/splash.png"));
splash->show();
QTimer::singleShot(2000,splash,SLOT(close())); //Start splash screen and keep it 2 seconds
#ifdef Q_OS_LINUX
systExp = "linuxAutre"; //Operating system of the user
QFile fileOs ("/etc/os-release");
if (fileOs.exists())
{
fileOs.open(QFile::ReadOnly);
QTextStream stream (&fileOs);
QString osTxt = stream.readAll();
if (osTxt.contains("ID=slackware")) {
systExp = "linuxSlackware";
}
else if (osTxt.contains("ID=ubuntu") || osTxt.contains("ID=debian")) {
systExp = "linuxDebian";
}
else if (osTxt.contains("ID=arch") || osTxt.contains("ID=manjaro")) {
systExp = "linuxArch";
}
fileOs.close();
}
#else
systExp = "windows";
#endif
//Define confFile:
confFile = confDir +".config";
//Set locale:
QString locale = QLocale::system().name();
appI18n = locale.split("_")[0] == "fr" ? "fr" : "en";
//Load config:
QFile configFile(confFile);
if (configFile.exists()) {
Functions::loadConfig();
}
QTranslator translator;
translator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
QString trFile = ":/i18n/qrecipewriter_"+ appI18n +".qm";
if (QFile(trFile).exists()) {
translator.load(trFile);
}
a.installTranslator(&translator);
//Define other variables:
QString tmp = confDir + ".cats";
confCatFile = new QFile(tmp);
#ifdef Q_OS_LINUX
QFile fileDictTest1 ("/usr/share/myspell/dicts/fr_FR.dic");
QFile fileDictTest2 ("/usr/share/myspell/dicts/fr_FR.aff");
if (fileDictTest1.exists() && fileDictTest2.exists())
{
corrOrtho = "/usr/share/myspell/dicts/fr_FR";
}
#else
#if _WIN64
QFile fileDictTest1 ("C:/hunspellX64/dicts/fr.dic");
QFile fileDictTest2 ("C:/hunspellX64/dicts/fr.aff");
if (fileDictTest1.exists() && fileDictTest2.exists())
{
corrOrtho = "C:/hunspellX64/dicts/fr";
}
#else
QFile fileDictTest1 ("C:/hunspellI686/dicts/fr.dic");
QFile fileDictTest2 ("C:/hunspellI686/dicts/fr.aff");
if (fileDictTest1.exists() && fileDictTest2.exists())
{
corrOrtho = "C:/hunspellI686/dicts/fr";
}
#endif
#endif
QRecipeWriter w;
w.openStartupFile = openFilename;
//Define Dialogs:
Apropos *apropos = new Apropos(&w);
ptr2apropos = apropos;
QDir tmpD (dirTmp);
if (configFile.exists())
{
w.init();
if (!tmpD.exists())
{
tmpD.mkpath(".");
}
QTimer::singleShot(2000,&w,SLOT(launch())); //Start the application
//.........这里部分代码省略.........
示例10: QMainWindow
MainWindow::MainWindow(QString file_adress, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
process = new QProcess(this);
pfad = QCoreApplication::applicationDirPath();
QString buffer = QCoreApplication::applicationDirPath();
buffer.append("\\update.exe");
if(QFile::exists(buffer) == true)
{
QDesktopServices::openUrl(QUrl::fromLocalFile(buffer));
process->terminate();
}
QSplashScreen *splash = new QSplashScreen(QPixmap(":/tbicons/img/logo.png"), Qt::WindowStaysOnTopHint);
splash->show();
splash->showMessage("Laden...", Qt::AlignBottom | Qt::AlignCenter);
ui->setupUi(this);
this->hide();
set = new settings(this);
icon = new favicon(this);
search_result = new gsuggests(ui->lineEdit);
versionspruefung = new update_vers(this);
versionspruefung->run_request_for_for_update();
cookie = new cookiejar(this, set->en_cookies);
bok = new bookmarks(this, ui->tree_bookmarks, ui->but_hinzu, ui->but_edit, ui->but_addFolder);
download = new DownloadManager(this, qnam);
m_faviconTimer = new QTimer(this);
m_editorTimer = new QTimer(this);
qnam = new QNetworkAccessManager(this);
page = new QWebPage(this);
ui->webView->setPage(page);
ui->webView->page()->setNetworkAccessManager(qnam);
QWebSettings::setIconDatabasePath(pfad);
QWebSettings::setOfflineStoragePath((pfad + tr("\\offline_cache")));
QString cache_path = pfad;
cache_path.append("\\cache");
cache = new QNetworkDiskCache(qnam);
cache->setCacheDirectory(cache_path);
qnam->setCache(cache);
qnam->setCookieJar(cookie);
// Bei klick auf Hme Button oder F6 funktion home aufrufen
connect(ui->home_button, SIGNAL(clicked()), this, SLOT(home()));
//Bei einem ändern der URl die neu_address auf rufen
connect(ui->webView, SIGNAL(urlChanged(QUrl)), this, SLOT(neu_adresse(QUrl)));
connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(neu_adresse_ein()));
connect(ui->webView, SIGNAL(loadStarted()), this, SLOT(load_in_progress()));
connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(load_finished(bool)));
connect(ui->reload_button, SIGNAL(clicked()), this, SLOT(reload_button()));
connect(ui->webView, SIGNAL(iconChanged()), this, SLOT(icon_changed()));
connect(ui->webView, SIGNAL(titleChanged(QString)), this, SLOT(titelChanged(QString)));
connect(ui->but_book, SIGNAL(clicked()), this, SLOT(showBar()));
connect(ui->webView, SIGNAL(loadProgress(int)), ui->barLoadProgress, SLOT(setValue(int)));
connect(ui->sliderrSiteZoom, SIGNAL(valueChanged(int)), this, SLOT(sliderSliding(int)));
connect(ui->butSetZoomToNorm, SIGNAL(clicked()), this, SLOT(sliderSliding()));
//für bookmarks
connect(ui->tree_bookmarks, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(openBookmark(QTreeWidgetItem*, int)));
//connections für favicons
connect(icon, SIGNAL(neuer_icon()), this, SLOT(neuer_icon()));
connect(icon, SIGNAL(standart_icon()), this, SLOT(set_standart_icon()));
connect(m_faviconTimer, SIGNAL(timeout()), this, SLOT(lookForNewFavicon()));
//connections für settings
connect(ui->but_settings, SIGNAL(clicked()), set, SLOT(show()));
connect(set, SIGNAL(requestForValues()), this, SLOT(returnRequestedValues()));
connect(set, SIGNAL(settingsChagned()), this, SLOT(settingsChanged()));
connect(set, SIGNAL(requestForCurrentPage()), this, SLOT(requestForCurrentPage()));
connect(set->ui->but_cl_cache, SIGNAL(clicked()), this, SLOT(requestForCacheClearing()));
//für qnam
connect(qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentification_requied(QNetworkReply*,QAuthenticator*)));
//für downloads
connect(page, SIGNAL(downloadRequested(QNetworkRequest)), download, SLOT(Download(QNetworkRequest)));
connect(ui->butDownloadManager, SIGNAL(clicked()), download, SLOT(show()));
//.........这里部分代码省略.........
示例11: main
QT_USE_NAMESPACE
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(linguist);
QApplication app(argc, argv);
QApplication::setOverrideCursor(Qt::WaitCursor);
QStringList files;
QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
QStringList args = app.arguments();
for (int i = 1; i < args.count(); ++i) {
QString argument = args.at(i);
if (argument == QLatin1String("-resourcedir")) {
if (i + 1 < args.count()) {
resourceDir = QFile::decodeName(args.at(++i).toLocal8Bit());
} else {
// issue a warning
}
} else if (!files.contains(argument)) {
files.append(argument);
}
}
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
if (qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir))
app.installTranslator(&qtTranslator);
else
app.removeTranslator(&translator);
}
app.setOrganizationName(QLatin1String("Trolltech"));
app.setApplicationName(QLatin1String("Linguist"));
QSettings config;
QWidget tmp;
tmp.restoreGeometry(config.value(settingPath("Geometry/WindowGeometry")).toByteArray());
QSplashScreen *splash = 0;
int screenId = QApplication::desktop()->screenNumber(tmp.geometry().center());
splash = new QSplashScreen(QApplication::desktop()->screen(screenId),
QPixmap(QLatin1String(":/images/splash.png")));
if (QApplication::desktop()->isVirtualDesktop()) {
QRect srect(0, 0, splash->width(), splash->height());
splash->move(QApplication::desktop()->availableGeometry(screenId).center() - srect.center());
}
splash->setAttribute(Qt::WA_DeleteOnClose);
splash->show();
MainWindow mw;
mw.show();
splash->finish(&mw);
QApplication::restoreOverrideCursor();
mw.openFiles(files, true);
return app.exec();
}
示例12: mUi
MainWindow::MainWindow()
: mUi(new Ui::MainWindowUi)
, mCloseEvent(NULL)
, mModels(NULL)
, mListenerManager(NULL)
, mPropertyModel(mEditorManager)
, mGesturesWidget(NULL)
, mVisualDebugger(NULL)
, mRobotInterpreter(NULL)
, mBluetoothCommunication(NULL)
, mErrorReporter(NULL)
{
QSettings settings("SPbSU", "QReal");
bool showSplash = settings.value("Splashscreen", true).toBool();
QSplashScreen* splash =
new QSplashScreen(QPixmap(":/icons/kroki3.PNG"), Qt::SplashScreen | Qt::WindowStaysOnTopHint);
QProgressBar *progress = new QProgressBar((QWidget*) splash);
progress->move(20, 270);
progress->setFixedWidth(600);
progress->setFixedHeight(15);
progress->setRange(0, 100);
// Step 1: splash screen loaded, progress bar initialized.
progress->setValue(5);
if (showSplash)
{
splash->show();
QApplication::processEvents();
}
mUi->setupUi(this);
mUi->tabs->setTabsClosable(true);
mUi->tabs->setMovable(true);
mUi->logicalModelDock->setVisible(false);
if (!showSplash)
mUi->actionShowSplash->setChecked(false);
mUi->minimapView->setRenderHint(QPainter::Antialiasing, true);
// Step 2: Ui is ready, splash screen shown.
progress->setValue(20);
mUi->actionShow_grid->setChecked(settings.value("ShowGrid", true).toBool());
mUi->actionShow_alignment->setChecked(settings.value("ShowAlignment", true).toBool());
mUi->actionSwitch_on_grid->setChecked(settings.value("ActivateGrid", true).toBool());
mUi->actionSwitch_on_alignment->setChecked(settings.value("ActivateAlignment", true).toBool());
connect(mUi->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
connect(mUi->actionShowSplash, SIGNAL(toggled(bool)), this, SLOT (toggleShowSplash(bool)));
connect(mUi->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
connect(mUi->actionSave, SIGNAL(triggered()), this, SLOT(saveAll()));
connect(mUi->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
connect(mUi->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(mUi->actionMakeSvg, SIGNAL(triggered()), this, SLOT(makeSvg()));
connect(mUi->actionDeleteFromDiagram, SIGNAL(triggered()), this, SLOT(deleteFromDiagram()));
connect(mUi->tabs, SIGNAL(currentChanged(int)), this, SLOT(changeMiniMapSource(int)));
connect(mUi->tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(mUi->actionGenerate_Editor, SIGNAL(triggered()), this, SLOT(generateEditor()));
connect(mUi->actionParse_Editor_xml, SIGNAL(triggered()), this, SLOT(parseEditorXml()));
connect(mUi->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferencesDialog()));
connect(mUi->actionPlugins, SIGNAL(triggered()), this, SLOT(settingsPlugins()));
connect(mUi->actionShow_grid, SIGNAL(toggled(bool)), this, SLOT(showGrid(bool)));
connect(mUi->actionShow_alignment, SIGNAL(toggled(bool)), this, SLOT(showAlignment(bool)));
connect(mUi->actionSwitch_on_grid, SIGNAL(toggled(bool)), this, SLOT(switchGrid(bool)));
connect(mUi->actionSwitch_on_alignment, SIGNAL(toggled(bool)), this, SLOT(switchAlignment(bool)));
connect(mUi->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(mUi->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
connect(mUi->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(mUi->actionShow, SIGNAL(triggered()), this, SLOT(showGestures()));
connect(mUi->minimapZoomSlider, SIGNAL(valueChanged(int)), this, SLOT(adjustMinimapZoom(int)));
connect(mUi->actionClear, SIGNAL(triggered()), this, SLOT(exterminate()));
connect(mUi->actionRun, SIGNAL(triggered()), this, SLOT(run()));
connect(mUi->actionStop_Running, SIGNAL(triggered()), this, SLOT(stop()));
connect(mUi->actionStop_Robot, SIGNAL(triggered()), this, SLOT(stopRobot()));
connect(mUi->actionRobot_Settings, SIGNAL(triggered()), this, SLOT(showRobotSettingsDialog()));
adjustMinimapZoom(mUi->minimapZoomSlider->value());
initGridProperties();
// Step 3: Ui connects are done.
progress->setValue(40);
mUi->paletteDock->setWidget(mUi->paletteToolbox);
mUi->errorDock->setWidget(mUi->errorListWidget);
mUi->errorListWidget->init(this);
mUi->errorDock->setVisible(false);
mUi->propertyEditor->setModel(&mPropertyModel);
mUi->propertyEditor->verticalHeader()->hide();
//.........这里部分代码省略.........
示例13: run_wallet
int run_wallet (QApplication & application, int argc, char * const * argv, boost::filesystem::path const & data_path)
{
rai_qt::eventloop_processor processor;
boost::filesystem::create_directories (data_path);
QPixmap pixmap (":/logo.png");
QSplashScreen * splash = new QSplashScreen (pixmap);
splash->show ();
application.processEvents ();
splash->showMessage (QSplashScreen::tr ("Remember - Back Up Your Wallet Seed"), Qt::AlignBottom | Qt::AlignHCenter, Qt::darkGray);
application.processEvents ();
qt_wallet_config config (data_path);
auto config_path ((data_path / "config.json"));
int result (0);
std::fstream config_file;
auto error (rai::fetch_object (config, config_path, config_file));
config_file.close ();
if (!error)
{
boost::asio::io_service service;
config.node.logging.init (data_path);
std::shared_ptr<rai::node> node;
std::shared_ptr<rai_qt::wallet> gui;
rai::set_application_icon (application);
auto opencl (rai::opencl_work::create (config.opencl_enable, config.opencl, config.node.logging));
rai::work_pool work (config.node.work_threads, opencl ? [&opencl](rai::uint256_union const & root_a) {
return opencl->generate_work (root_a);
}
: std::function<boost::optional<uint64_t> (rai::uint256_union const &)> (nullptr));
rai::alarm alarm (service);
rai::node_init init;
node = std::make_shared<rai::node> (init, service, data_path, alarm, config.node, work);
if (!init.error ())
{
auto wallet (node->wallets.open (config.wallet));
if (wallet == nullptr)
{
auto existing (node->wallets.items.begin ());
if (existing != node->wallets.items.end ())
{
wallet = existing->second;
config.wallet = existing->first;
}
else
{
wallet = node->wallets.create (config.wallet);
}
}
if (config.account.is_zero () || !wallet->exists (config.account))
{
rai::transaction transaction (wallet->store.environment, nullptr, true);
auto existing (wallet->store.begin (transaction));
if (existing != wallet->store.end ())
{
rai::uint256_union account (existing->first.uint256 ());
config.account = account;
}
else
{
config.account = wallet->deterministic_insert (transaction);
}
}
assert (wallet->exists (config.account));
update_config (config, config_path, config_file);
node->start ();
std::unique_ptr<rai::rpc> rpc = get_rpc (service, *node, config.rpc);
if (rpc && config.rpc_enable)
{
rpc->start ();
}
rai::thread_runner runner (service, node->config.io_threads);
QObject::connect (&application, &QApplication::aboutToQuit, [&]() {
rpc->stop ();
node->stop ();
});
application.postEvent (&processor, new rai_qt::eventloop_event ([&]() {
gui = std::make_shared<rai_qt::wallet> (application, processor, *node, wallet, config.account);
splash->close ();
gui->start ();
gui->client_window->show ();
}));
result = application.exec ();
runner.join ();
}
else
{
show_error ("Error initializing node");
}
update_config (config, config_path, config_file);
}
else
{
show_error ("Error deserializing config");
}
return result;
}
示例14: main
int main( int argc, char **argv )
{
//ENABLE_LEAK_CHECK();
//_CrtSetBreakAlloc(49937);
socket_startup();
curl_global_init(CURL_GLOBAL_NOTHING);
#ifdef __APPLE__
// The following needs to be done before the application is created, otherwise loading platforms plugin fails.
QDir dir(argv[0]);
dir.cdUp();
dir.cdUp();
dir.cd("plugins");
QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif
/////// can be removed for non-qt-guis ////////////
#ifdef ANDROID
QApplication a(argc, argv);
a.setApplicationName("PokerTH");
#else
SharedTools::QtSingleApplication a( "PokerTH", argc, argv );
if (a.sendMessage("Wake up!")) {
return 0;
}
#endif
//create defaultconfig
ConfigFile *myConfig = new ConfigFile(argv[0], false);
Log *myLog = new Log(myConfig);
// set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets
#if QT_VERSION < 0x050000
a.setStyle(new QPlastiqueStyle);
#endif
QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
//set QApplication default font
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb");
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf");
#ifdef _WIN32
QString font1String("QApplication, QWidget, QDialog { font-size: 12px; }");
#elif __APPLE__
// QString font1String("font-family: \"Lucida Grande\";");
QString font1String("QApplication, QWidget, QDialog { font-size: 11px; }");
#elif ANDROID
QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 26px; }");
QPalette p = a.palette();
p.setColor(QPalette::Button, QColor::fromRgb(80,80,80));
p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(130,130,130));
p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgb(100,100,100));
p.setColor(QPalette::Link, QColor::fromRgb(192,192,255));
p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255));
a.setPalette(p);
#elif MAEMO
QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 22px; }");
QPalette p = a.palette();
p.setColor(QPalette::Button, QColor::fromRgb(80,80,80));
p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(100,100,100));
p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgb(100,100,100));
p.setColor(QPalette::Link, QColor::fromRgb(192,192,255));
p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255));
a.setPalette(p);
#else
QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 12px; }");
#endif
a.setStyleSheet(font1String + " QDialogButtonBox, QMessageBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/gfx/dialog_ok_apply.png); dialog-cancel-icon: url(:/gfx/dialog_close.png); dialog-close-icon: url(:/gfx/dialog_close.png); dialog-yes-icon: url(:/gfx/dialog_ok_apply.png); dialog-no-icon: url(:/gfx/dialog_close.png) }");
#ifdef ANDROID
//check if custom background pictures for the resolution are there. Otherwise create them!
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
QDesktopWidget dw;
int screenWidth = dw.screenGeometry().width();
int screenHeight = dw.screenGeometry().height();
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg10_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
QString customWelcomePokerTHFileString(UserDataDir+"/welcomepokerth10_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
QFile customStartWindowBgFile(customStartWindowBgFileString);
QFile customWelcomePokerTHFile(customWelcomePokerTHFileString);
QSplashScreen preSplashFirstRun;
if(!customStartWindowBgFile.exists()) {
//load preSplashPix to show that PokerTH is already running during first time pics calculation
QPixmap prePixBase(":/gfx/logoChip3D.png");
//.........这里部分代码省略.........
示例15: main
int main(int argc, char *argv[])
{
//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF8"));
QApplication a(argc, argv);
//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
/*QTextCodec *codec = QTextCodec::codecForName("GB2312");
QTextCodec::setCodecForLocale(codec);
QTextCodec::codecForUtfText("GB2312");*/
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap("start.png"));
splash->show();
for (int i = 0; i<300; i++)
{
splash->repaint();
}
#pragma region INVALID CODE
//QWidget *win0 = new QWidget(0);
/*
QtCreate *w1 = new QtCreate(win0);
w1->resize(1600, 1600);
MyTimeSolveProject *w2 = new MyTimeSolveProject(win0);
w2->resize(600, 600);
*/
/*MyTimeSolveProject *MyProject = new MyTimeSolveProject();
QtCreate *w = new QtCreate();
QHBoxLayout *lay = new QHBoxLayout();
lay->addWidget(w);
lay->addWidget(MyProject);
win0->setLayout(lay);
win0->show();*/
//QWidget *win0 = new QWidget(0);
//QtCreate *w = new QtCreate(win0);
#pragma endregion
QtCreate w;
w.setWindowTitle(codec->toUnicode("IMA环境下多任务实时性能最优化系统"));
w.show();
splash->finish(&w);
delete splash;
//MyTimeSolveProject MyProject(ui.GantWidget);
//MyTimeSolveProject MyPro(Ui::QtCreateClass);
////MyTimeSolveProject *myproject = new MyTimeSolveProject(this.ui.GantWidget);
//
////MyProject.show();
///*
//MyProject.show();
//*/
//MyTimeSolveProject MyProject;
//MyProject.show();
#pragma region VIDEOVIEW1
QWidget *widget1 = new QWidget;
widget1->resize(400, 300); //
widget1->setWindowTitle("View1");
QVBoxLayout *layout1 = new QVBoxLayout;
QMediaPlayer* player1 = new QMediaPlayer;
QVideoWidget* vw1 = new QVideoWidget;
layout1->addWidget(vw1);
widget1->setLayout(layout1);
player1->setVideoOutput(vw1);
QFile file1("Video02.AVI");
if (!file1.open(QIODevice::ReadOnly))
qDebug() << "Could not open file";
player1->setMedia(QUrl::fromLocalFile("Video02.AVI"));
player1->play();
widget1->show();
#pragma endregion
#pragma region VIDEOVIEW2
QWidget *widget2 = new QWidget;
widget2->resize(400, 300); //
widget2->setWindowTitle("View2");
QVBoxLayout *layout2 = new QVBoxLayout;
QMediaPlayer* player2 = new QMediaPlayer;
QVideoWidget* vw2 = new QVideoWidget;
layout2->addWidget(vw2);
widget2->setLayout(layout2);
player2->setVideoOutput(vw2);
QFile file2("Video03.AVI");
if (!file2.open(QIODevice::ReadOnly))
qDebug() << "Could not open file";
player2->setMedia(QUrl::fromLocalFile("Video03.AVI"));
//.........这里部分代码省略.........