QSystemTrayIcon* MainWindow::SystemTrayIcon() { if (!systemTray) { setupSystemTray(); } return systemTray; }
ktvschedule::ktvschedule() : KMainWindow(), m_prefDialog(0) { // Initialise Toolbars, Menus, StatusBar and some other init(); // Read Configuration file Config().read(); // Loads XMLFile, process it and displays contents for current date LoadFileAndData(); // Go to the current Grid Time t_TVGrid->SetToCurrentTime(); // Connections the Now Playing action with the moving of the table connect (t_TVGrid, SIGNAL(contentsMoving (int, int)), this , SLOT(enableGoHomeButton() ) ); actionCollection()->action("Now Playing")->setEnabled( FALSE ); if (!Config().m_FirstRun) { KMessageBox::warningContinueCancel (0, "It seems that it is the first time you run kTvSchedule. Please make sure that you have runned your tv_grab_xx at least once"); Config().m_FirstRun = TRUE; Config().write(); } setupSystemTray(); }
MainWindow::MainWindow(QWidget *parent, HEHUI::WindowPosition positon) : MainWindowBase(parent) { ui.setupUi(this); setWindowTitle(QString(APP_NAME) + " Build " + QString(APP_VERSION)); //setWindowFlags(Qt::SplashScreen | Qt::WindowStaysOnTopHint); //setWindowFlags(Qt::WindowStaysOnTopHint); //使窗口居中 //Center the window //moveWindow(positon); //resize(QSize(0,0)); //showMinimized(); //showMaximized(); //应用样式 //Apply the app style // originalPalette = QApplication::palette(); // changeStyle(Settings::instance()->getStyle()); //初始化UI //Init the UI initUI(); //创建托盘图标 //Create the system tray setupSystemTray(); if(Settings::instance()->getRestoreWindowStateOnStartup()){ Settings::instance()->restoreState(this); }else{ //使窗口居中 //Center the window moveWindow(positon); showMaximized(); } // qmLocale = Settings::instance()->getLanguage(); // qmPath = QApplication::applicationDirPath() + QDir::separator () + QString(LANGUAGE_FILE_DIR); //更新菜单 //Update the menus //setupMenus(); }
Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(argc, argv), _tray(0), #if QT_VERSION >= 0x040700 _networkMgr(new QNetworkConfigurationManager(this)), #endif _sslErrorDialog(0), _contextMenu(0), _theme(Theme::instance()), _updateDetector(0), _logBrowser(0), _showLogWindow(false), _logFlush(false), _helpOnly(false), _fileItemDialog(0), _statusDialog(0) { setApplicationName( _theme->appNameGUI() ); setWindowIcon( _theme->applicationIcon() ); parseOptions(arguments()); setupTranslations(); setupLogBrowser(); //no need to waste time; if ( _helpOnly ) return; connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString))); connect( Logger::instance(), SIGNAL(guiLog(QString,QString)), this, SLOT(slotShowTrayMessage(QString,QString))); // create folder manager for sync folder management _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); _folderMan->setSyncEnabled(false); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); connect(_folderOpenActionMapper, SIGNAL(mapped(const QString &)), this, SLOT(slotFolderOpenAction(const QString &))); setQuitOnLastWindowClosed(false); _folderWizard = new FolderWizard; _owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this ); connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), this, SLOT(slotownCloudWizardDone(int))); _statusDialog = new StatusDialog( _theme ); connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) ); connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)), SLOT(slotRemoveFolder(const QString&))); connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)), SLOT(slotEnableFolder(QString,bool))); connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)), SLOT(slotInfoFolder( const QString&))); connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)), SLOT(slotFolderOpenAction(QString))); #if 0 #if QT_VERSION >= 0x040700 qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline"); foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) { //qDebug() << "Network:" << netCfg.identifier(); } #endif #endif setupActions(); setupSystemTray(); setupProxy(); int cnt = _folderMan->setupFolders(); _statusDialog->setFolderList( _folderMan->map() ); QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); QTimer::singleShot( 0, this, SLOT( slotStartFolderSetup() )); MirallConfigFile cfg; if( !cfg.ownCloudSkipUpdateCheck() ) { QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() )); } connect( ownCloudInfo::instance(), SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)), this,SLOT(slotSSLFailed(QNetworkReply*, QList<QSslError>))); qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded(); }
Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(argc, argv), _tray(0), #if QT_VERSION >= 0x040700 _networkMgr(new QNetworkConfigurationManager(this)), #endif _sslErrorDialog(0), _contextMenu(0), _theme(Theme::instance()), _updateDetector(0), _logBrowser(0), _showLogWindow(false), _logFlush(false), _helpOnly(false), _fileItemDialog(0) { setApplicationName( _theme->appNameGUI() ); setWindowIcon( _theme->applicationIcon() ); parseOptions(arguments()); setupTranslations(); setupLogBrowser(); //no need to waste time; if ( _helpOnly ) return; #ifdef Q_OS_LINUX // HACK: bump the refcount for libgnutls by calling dlopen() // so gnutls, which is an dependency of libneon on some linux // distros, and does not cleanup it's FDs properly, does // not get unloaded. This works around a FD exhaustion crash // (#154). We are not using gnutls at all and it's fine // if loading fails, so no error handling is performed here. dlopen("libgnutls.so", RTLD_LAZY|RTLD_NODELETE); #endif connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString))); connect( Logger::instance(), SIGNAL(guiLog(QString,QString)), this, SLOT(slotShowTrayMessage(QString,QString))); // create folder manager for sync folder management _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); _folderMan->setSyncEnabled(false); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); connect(_folderOpenActionMapper, SIGNAL(mapped(const QString &)), this, SLOT(slotFolderOpenAction(const QString &))); setQuitOnLastWindowClosed(false); _folderWizard = new FolderWizard; _owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this ); connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), this, SLOT(slotownCloudWizardDone(int))); _statusDialog = new StatusDialog( _theme ); connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) ); connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)), SLOT(slotRemoveFolder(const QString&))); connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)), SLOT(slotEnableFolder(QString,bool))); connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)), SLOT(slotInfoFolder( const QString&))); connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)), SLOT(slotFolderOpenAction(QString))); #if 0 #if QT_VERSION >= 0x040700 qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline"); foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) { //qDebug() << "Network:" << netCfg.identifier(); } #endif #endif setupActions(); setupSystemTray(); setupProxy(); int cnt = _folderMan->setupFolders(); _statusDialog->setFolderList( _folderMan->map() ); QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); QTimer::singleShot( 0, this, SLOT( slotStartFolderSetup() )); MirallConfigFile cfg; if( !cfg.ownCloudSkipUpdateCheck() ) { QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() )); } connect( ownCloudInfo::instance(), SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)), this,SLOT(slotSSLFailed(QNetworkReply*, QList<QSslError>))); qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded(); }
Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(argc, argv), _tray(0), _sslErrorDialog(0), #if QT_VERSION >= 0x040700 _networkMgr(new QNetworkConfigurationManager(this)), #endif _contextMenu(0), _theme(Theme::instance()), _updateDetector(0), _showLogWindow(false), _logFlush(false), _helpOnly(false), _logBrowser(0) { setApplicationName( _theme->appName() ); setWindowIcon( _theme->applicationIcon() ); parseOptions(arguments()); setupLogBrowser(); //no need to waste time; if ( _helpOnly ) return; processEvents(); QTranslator *qtTranslator = new QTranslator(this); qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); installTranslator(qtTranslator); QTranslator *mirallTranslator = new QTranslator(this); #ifdef Q_OS_LINUX // FIXME - proper path! mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), QLatin1String("/usr/share/mirall/i18n/")); #endif #ifdef Q_OS_MAC mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir. #endif #ifdef Q_OS_WIN32 mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()); #endif installTranslator(mirallTranslator); connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString))); // create folder manager for sync folder management _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); connect(_folderOpenActionMapper, SIGNAL(mapped(const QString &)), this, SLOT(slotFolderOpenAction(const QString &))); setQuitOnLastWindowClosed(false); _folderWizard = new FolderWizard; _owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this ); connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), SLOT(slotStartFolderSetup(int))); _statusDialog = new StatusDialog( _theme ); connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) ); connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)), SLOT(slotRemoveFolder(const QString&))); connect( _statusDialog, SIGNAL(openLogBrowser()), this, SLOT(slotOpenLogBrowser())); connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)), SLOT(slotEnableFolder(QString,bool))); connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)), SLOT(slotInfoFolder( const QString&))); connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)), SLOT(slotFolderOpenAction(QString))); #if QT_VERSION >= 0x040700 qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline"); foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) { //qDebug() << "Network:" << netCfg.identifier(); } #endif setupActions(); setupSystemTray(); setupProxy(); processEvents(); QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); QTimer::singleShot( 0, this, SLOT( slotStartFolderSetup() )); MirallConfigFile cfg; if( !cfg.ownCloudSkipUpdateCheck() ) { QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() )); } connect( ownCloudInfo::instance(), SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)), this,SLOT(slotSSLFailed(QNetworkReply*, QList<QSslError>))); qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded(); }