/*! \brief \fn cdegs_main::openConfigDialog */ void cdegs_main::openConfigDialog(){ if(project){ configuration_chooser_dialog* diag = new configuration_chooser_dialog(this, project); QObject::connect(diag, SIGNAL(returnConfig(std::shared_ptr<Configuration>)), this, SLOT(openConfig(std::shared_ptr<Configuration>))); diag->exec(); QObject::disconnect(diag, SIGNAL(returnConfig(std::shared_ptr<Configuration>)), this, SLOT(openConfig(std::shared_ptr<Configuration>))); delete diag; } }
void KueueApp::connectDataThread() { qDebug() << "[KUEUEAPP] My thread ID is" << thread()->currentThreadId(); connect( mDataThread, SIGNAL( queueDataChanged( QString ) ), mTabWidget, SLOT( updateQueueBrowser( const QString& ) ) ); connect( mDataThread, SIGNAL( subownerDataChanged( QString ) ), mTabWidget, SLOT( updateSubownerBrowser( const QString& ) ) ); connect( mDataThread, SIGNAL( qmonDataChanged( QString ) ), mTabWidget, SLOT( updateQmonBrowser( const QString& ) ) ); connect( mDataThread, SIGNAL( statsDataChanged( QString ) ), mTabWidget, SLOT( updateStatsBrowser( QString ) ) ); connect( mDataThread, SIGNAL(showSubownerBrowser( bool ) ), mTabWidget, SLOT( showSubownerTab( bool ) ) ); connect( mDataThread, SIGNAL( netError() ), this, SLOT( openConfig() ) ); connect( mDataThread, SIGNAL( dirsToDelete( QStringList ) ), this, SLOT( deleteDirs( QStringList ) ) ); connect( mDataThread, SIGNAL( notify( QString, QString, QString, QString ) ), this, SLOT( notify( QString, QString, QString, QString ) ) ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->widget, SLOT(setPosX(int))); connect(ui->horizontalSlider_2, SIGNAL(valueChanged(int)), ui->widget, SLOT(setPosY(int))); connect(ui->horizontalSlider_3, SIGNAL(valueChanged(int)), ui->widget, SLOT(setR(int))); connect(ui->actionLoad_config, SIGNAL(triggered()), this, SLOT(openConfig())); connect(ui->actionSave_config, SIGNAL(triggered()), this, SLOT(saveConfig())); connect(ui->actionSave_image, SIGNAL(triggered()), this, SLOT(saveImage())); ui->horizontalSlider->setValue(0); ui->horizontalSlider->setMinimum(-10000); ui->horizontalSlider->setMaximum(10000); ui->spinBox->setValue(0); ui->spinBox->setMinimum(-10000); ui->spinBox->setMaximum(10000); ui->horizontalSlider_2->setValue(0); ui->horizontalSlider_2->setMinimum(-10000); ui->horizontalSlider_2->setMaximum(10000); ui->spinBox_2->setValue(0); ui->spinBox_2->setMinimum(-10000); ui->spinBox_2->setMaximum(10000); ui->horizontalSlider_3->setValue(20); ui->horizontalSlider_3->setMinimum(0); ui->horizontalSlider_3->setMaximum(10000); ui->spinBox_3->setValue(20); ui->spinBox_3->setMinimum(0); ui->spinBox_3->setMaximum(10000); }
// // save the window position // void saveSettings(const char *configName, SDL_Window *window, int fontScale) { FILE *fp = openConfig(configName, "w"); if (fp) { int x, y, w, h; SDL_GetWindowPosition(window, &x, &y); SDL_GetWindowSize(window, &w, &h); fprintf(fp, "%d,%d,%d,%d,%d,%d\n", x, y, w, h, fontScale, opt_mute_audio); fclose(fp); } }
//================================================================================ // タップ開始判定 //================================================================================ bool PauseScene::onTouchBegin(Touch* pTouch,Event* pEvent) { // タッチ座標の取得 m_touchPos = pTouch->getLocation(); Rect openConfigSpriteRect = m_pConfigSprite->getBoundingBox(); if(openConfigSpriteRect.containsPoint(m_touchPos)) { openConfig(); } return true; }
void KueueApp::createMainWindow() { mWindow = &mWindow->win(); mWindow->setWindowIcon( QIcon(":/icons/kueue.png").pixmap( QSize( 22, 22 ) ) ); mTabWidget = &mTabWidget->tw(); mStatusBar = &mStatusBar->getInstance(); mTabWidget->setDocumentMode( true ); mWindow->setCentralWidget( mTabWidget ); mWindow->setStatusBar( mStatusBar ); connect( mTabWidget, SIGNAL( openConfig() ), this, SLOT( openConfig() ) ); if ( Settings::showAppWindow() ) { mWindow->showWindow(); } }
ActionReply SddmAuthHelper::save(const QVariantMap &args) { ActionReply reply = ActionReply::HelperErrorReply; QSharedPointer<KConfig> sddmConfig = openConfig(args["sddm.conf"].toString()); QSharedPointer<KConfig> themeConfig; QString themeConfigFile = args["theme.conf.user"].toString(); if (!themeConfigFile.isEmpty()) { themeConfig = openConfig(themeConfigFile); } QMap<QString, QVariant>::const_iterator iterator; for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) { if (iterator.key() == "sddm.conf" || iterator.key() == "theme.conf.user") continue; QStringList configFields = iterator.key().split('/'); QSharedPointer<KConfig> config; QString fileName = configFields[0]; QString groupName = configFields[1]; QString keyName = configFields[2]; if (fileName == "sddm.conf") { sddmConfig->group(groupName).writeEntry(keyName, iterator.value()); } else if (fileName == "theme.conf.user" && !themeConfig.isNull()) { themeConfig->group(groupName).writeEntry(keyName, iterator.value()); } } sddmConfig->sync(); if (!themeConfig.isNull()) themeConfig->sync(); return ActionReply::SuccessReply; }
void MainWidget::createTrayIcon() { trayIcon = createTrayObject(this); trayIcon->init(); #ifndef Q_OS_WIN32 trayIcon->setIcon("qcma_off"); #else trayIcon->setIcon("tray/qcma_off_16"); #endif trayIcon->show(); connect(trayIcon, SIGNAL(openConfig()), this, SLOT(openConfig())); connect(trayIcon, SIGNAL(openManager()), this, SLOT(openManager())); connect(trayIcon, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase())); connect(trayIcon, SIGNAL(showAboutDialog()), this, SLOT(showAboutDialog())); connect(trayIcon, SIGNAL(showAboutQt()), this, SLOT(showAboutQt())); connect(trayIcon, SIGNAL(stopServer()), this, SLOT(stopServer())); connect(managerForm, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnect(QString))); connect(managerForm, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect())); connect(managerForm, SIGNAL(messageSent(QString)), this, SLOT(receiveMessage(QString))); }
// // restore window position // void restoreSettings(const char *configName, SDL_Rect &rect, int &fontScale) { FILE *fp = openConfig(configName, "r"); if (fp) { rect.x = nextInteger(fp, SDL_WINDOWPOS_UNDEFINED); rect.y = nextInteger(fp, SDL_WINDOWPOS_UNDEFINED); rect.w = nextInteger(fp, DEFAULT_WIDTH); rect.h = nextInteger(fp, DEFAULT_HEIGHT); fontScale = nextInteger(fp, DEFAULT_SCALE); opt_mute_audio = nextInteger(fp, 0); fclose(fp); } else { rect.x = SDL_WINDOWPOS_UNDEFINED; rect.y = SDL_WINDOWPOS_UNDEFINED; rect.w = DEFAULT_WIDTH; rect.h = DEFAULT_HEIGHT; fontScale = DEFAULT_SCALE; } }
void reloadPortalConfig() { uninstallFileNotification(); int ret = openConfig(); if( ret == TRUE ) { ReloadTrayIcons(); ShowBalloon(WC_PORTAL_ABOUT_TEXT_TITLE, WC_PORTAL_RLDCONF_TEXT_OK, 0, NIIF_INFO); } else if (ret == FALSE) { ShowBalloon(WC_PORTAL_ABOUT_TEXT_TITLE, WC_PORTAL_RLDCONF_TEXT_ERR, 0, NIIF_ERROR); } installFileNotification(); FlushMemory(); }
bool INIConfig::getValue(Common::String &result, const Common::String &file, const Common::String §ion, const Common::String &key, const Common::String &def) { Config config; if (!getConfig(file, config)) { if (!openConfig(file, config)) { result = def; return false; } } if (!config.config->getKey(key, section, result)) { result = def; return false; } return true; }
void WidgetMain::createConnections() { connect(ui->actionConfigSave, SIGNAL(triggered()), this, SLOT(saveConfig()), Qt::DirectConnection); connect(ui->actionConfigSaveAs, SIGNAL(triggered()), this, SLOT(saveConfigAs()), Qt::DirectConnection); connect(ui->actionConfigOpen, SIGNAL(triggered()), this, SLOT(openConfig()), Qt::DirectConnection); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()), Qt::DirectConnection); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()), Qt::DirectConnection); connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()), Qt::DirectConnection); connect(d_hponic.data(), SIGNAL(transmissionStatusChanged(Transmission::Status)), this, SLOT(onTransmissionStatusChanged(Transmission::Status)), Qt::DirectConnection); connect(d_hponic.data(), SIGNAL(transmissionCommandSend(Command::Result)), this, SLOT(onTransmissionCommandSend(Command::Result)), Qt::DirectConnection); connect(d_hponic.data(), SIGNAL(exportStarted()), this, SLOT(onExportStarted()), Qt::DirectConnection); connect(d_hponic.data(), SIGNAL(exportStopped()), this, SLOT(onExportStopped()), Qt::DirectConnection); connect(d_hponic.data(), SIGNAL(exportProgress(int,int)), this, SLOT(onExportProgress(int,int)), Qt::DirectConnection); }
void MainWindow::createTrayIcon() { trayMenu = new QMenu(this); trayMenu->addAction("&Players", myserverwidget, SLOT(openPlayers())); trayMenu->addAction("&Anti DoS", myserverwidget, SLOT(openAntiDos())); trayMenu->addAction("&Config", myserverwidget, SLOT(openConfig())); trayMenu->addAction("&Script Window", myserverwidget, SLOT(openScriptWindow())); trayMenu->addAction("&Battle Config", myserverwidget, SLOT(openBattleConfigWindow())); trayMenu->addAction("&SQL Config", myserverwidget, SLOT(openSqlConfigWindow())); trayMenu->addSeparator(); trayMenu->addAction("&Plugin Manager", myserverwidget, SLOT(openPluginManager())); trayMenu->addSeparator(); trayMenu->addAction("&Open", this, SLOT(openWindow())); trayMenu->addAction("&Close", qApp, SLOT(quit())); trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayMenu); trayIcon->setToolTip("Pok\303\251mon Online Server"); trayIcon->setIcon(QIcon("db/icon.png")); }
void KDENotifierTray::init() { options = new QAction(tr("Settings"), this); reload = new QAction(tr("Refresh database"), this); backup = new QAction(tr("Backup Manager"), this); about = new QAction(tr("About QCMA"), this); about_qt = new QAction(tr("About Qt"), this); quit = new QAction(tr("Quit"), this); connect(options, SIGNAL(triggered()), this, SIGNAL(openConfig())); connect(backup, SIGNAL(triggered()), this, SIGNAL(openManager())); connect(reload, SIGNAL(triggered()), this, SIGNAL(refreshDatabase())); connect(about, SIGNAL(triggered()), this, SIGNAL(showAboutDialog())); connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt())); connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer())); #if QT_VERSION < 0x050000 KMenu *tray_icon_menu = new KMenu(this); #else QMenu *tray_icon_menu = new QMenu(this); #endif tray_icon_menu->addAction(options); tray_icon_menu->addAction(reload); tray_icon_menu->addAction(backup); tray_icon_menu->addSeparator(); tray_icon_menu->addAction(about); tray_icon_menu->addAction(about_qt); tray_icon_menu->addSeparator(); tray_icon_menu->addAction(quit); m_notifier_item = new KDENotifier("QcmaNotifier", this); m_notifier_item->setContextMenu(tray_icon_menu); m_notifier_item->setTitle("Qcma"); m_notifier_item->setCategory(KStatusNotifierItem::ApplicationStatus); m_notifier_item->setIconByPixmap(QIcon(":/main/resources/images/qcma_off.png")); m_notifier_item->setStatus(KStatusNotifierItem::Active); m_notifier_item->setToolTipTitle(tr("Qcma status")); m_notifier_item->setToolTipIconByPixmap(QIcon(":/main/resources/images/qcma.png")); m_notifier_item->setToolTipSubTitle(tr("Disconnected")); m_notifier_item->setStandardActionsEnabled(false); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //code to add non buttons to toolbar gameComboBox = new QComboBox(this); gameComboBox->setMinimumContentsLength(20); QLabel* spaceLabel = new QLabel(" "); QLabel* gameLabel = new QLabel("Game "); QAction* actionAddGame = new QAction(this); actionAddGame->setObjectName(QString("actionAddGame")); QIcon addIcon; addIcon.addFile(QString::fromUtf8(":/StreamControl/icons/fugue/bonus/icons-24/plus.png"), QSize(), QIcon::Normal, QIcon::Off); actionAddGame->setIcon(addIcon); QAction* actionDelGame = new QAction(this); actionDelGame->setObjectName(QString("actionDelGame")); QIcon delIcon; delIcon.addFile(QString::fromUtf8(":/StreamControl/icons/fugue/bonus/icons-24/minus.png"), QSize(), QIcon::Normal, QIcon::Off); actionDelGame->setIcon(delIcon); ui->toolBar->addWidget(spaceLabel); ui->toolBar->addWidget(gameLabel); ui->toolBar->addWidget(gameComboBox); ui->toolBar->addAction(actionAddGame); ui->toolBar->addAction(actionDelGame); connect(ui->actionConfig,SIGNAL( triggered() ),this,SLOT( openConfig() )); connect(ui->actionSave,SIGNAL( triggered() ),this,SLOT( saveData() )); connect(ui->resetButton,SIGNAL( clicked() ),this,SLOT( resetScores() )); connect(ui->swapButton,SIGNAL( clicked() ),this,SLOT( swapNames() )); connect(actionAddGame,SIGNAL( triggered() ),this,SLOT( addGame() )); connect(actionDelGame,SIGNAL( triggered() ),this,SLOT( delGame() )); cWindow = new ConfigWindow(this); }
ActionReply SddmAuthHelper::save(const QVariantMap &args) { ActionReply reply = ActionReply::HelperErrorReply(); QSharedPointer<KConfig> sddmConfig = openConfig(args["sddm.conf"].toString()); QSharedPointer<KConfig> themeConfig; QString themeConfigFile = args["theme.conf.user"].toString(); if (!themeConfigFile.isEmpty()) { themeConfig = openConfig(themeConfigFile); } QMap<QString, QVariant>::const_iterator iterator; for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) { if (iterator.key() == "sddm.conf" || iterator.key() == "theme.conf.user") continue; QStringList configFields = iterator.key().split('/'); if (configFields.size() != 3) { continue; } QSharedPointer<KConfig> config; QString fileName = configFields[0]; QString groupName = configFields[1]; QString keyName = configFields[2]; if (fileName == "sddm.conf") { sddmConfig->group(groupName).writeEntry(keyName, iterator.value()); } else if (fileName == "theme.conf.user" && !themeConfig.isNull()) { QFileInfo themeConfigFileInfo(themeConfigFile); QDir configRootDirectory = themeConfigFileInfo.absoluteDir(); if (keyName == "background") { QFileInfo newBackgroundFileInfo(iterator.value().toString()); QString previousBackground = themeConfig->group(groupName).readEntry(keyName); bool backgroundChanged = newBackgroundFileInfo.fileName() != previousBackground; if (backgroundChanged) { if (!previousBackground.isEmpty()) { QString previousBackgroundPath = configRootDirectory.filePath(previousBackground); if (QFile::remove(previousBackgroundPath)) { qDebug() << "Removed previous background " << previousBackgroundPath; } } if (newBackgroundFileInfo.exists()) { QString newBackgroundPath = configRootDirectory.filePath(newBackgroundFileInfo.fileName()); qDebug() << "Copying background from " << newBackgroundFileInfo.absoluteFilePath() << " to " << newBackgroundPath; if (QFile::copy(newBackgroundFileInfo.absoluteFilePath(), newBackgroundPath)) { QFile::setPermissions(newBackgroundPath, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther); themeConfig->group(groupName).writeEntry(keyName, newBackgroundFileInfo.fileName()); } } else { themeConfig->group(groupName).deleteEntry(keyName); } } } else { themeConfig->group(groupName).writeEntry(keyName, iterator.value()); } } } sddmConfig->sync(); if (!themeConfig.isNull()) themeConfig->sync(); return ActionReply::SuccessReply(); }
SettingsDialog::SettingsDialog( QWidget *parent ) : QDialog( parent ) , ui( new Ui_StackedSettingsDialog ) , m_proxySettings( this ) , m_rejected( false ) , m_sipModel( 0 ) , m_resolversModel( 0 ) { ui->setupUi( this ); TomahawkSettings* s = TomahawkSettings::instance(); ui->checkBoxHttp->setChecked( s->httpEnabled() ); ui->checkBoxStaticPreferred->setChecked( s->preferStaticHostPort() ); ui->checkBoxUpnp->setChecked( s->externalAddressMode() == TomahawkSettings::Upnp ); ui->checkBoxUpnp->setEnabled( !s->preferStaticHostPort() ); createIcons(); #ifdef Q_WS_X11 ui->listWidget->setFrameShape( QFrame::StyledPanel ); ui->listWidget->setFrameShadow( QFrame::Sunken ); setContentsMargins( 4, 4, 4, 4 ); #else ui->verticalLayout->removeItem( ui->verticalSpacer_3 ); #endif #ifdef Q_WS_MAC // Avoid resize handles on sheets on osx m_proxySettings.setSizeGripEnabled( true ); QSizeGrip* p = m_proxySettings.findChild< QSizeGrip* >(); p->setFixedSize( 0, 0 ); #endif // SIP PLUGINS SipConfigDelegate* sipdel = new SipConfigDelegate( this ); ui->accountsView->setItemDelegate( sipdel ); ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu ); connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) ); connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) ); connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) ); m_sipModel = new SipModel( this ); ui->accountsView->setModel( m_sipModel ); setupSipButtons(); ui->staticHostName->setText( s->externalHostname() ); ui->staticPort->setValue( s->externalPort() ); ui->proxyButton->setVisible( true ); // MUSIC SCANNER //FIXME: MULTIPLECOLLECTIONDIRS if ( s->scannerPaths().count() ) ui->lineEditMusicPath_2->setText( s->scannerPaths().first() ); else { ui->lineEditMusicPath_2->setText( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ); } // WATCH CHANGES // FIXME: QFileSystemWatcher is broken (as we know) and deprecated. Find another way. ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() ); ui->checkBoxWatchForChanges->setVisible( false ); // LAST FM ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() ); ui->lineEditLastfmUsername->setText( s->lastFmUsername() ); ui->lineEditLastfmPassword->setText(s->lastFmPassword() ); connect( ui->pushButtonTestLastfmLogin, SIGNAL( clicked( bool) ), this, SLOT( testLastFmLogin() ) ); // SCRIPT RESOLVER ui->removeScript->setEnabled( false ); ResolverConfigDelegate* del = new ResolverConfigDelegate( this ); connect( del, SIGNAL( openConfig( QString ) ), this, SLOT( openResolverConfig( QString ) ) ); ui->scriptList->setItemDelegate( del ); m_resolversModel = new ResolversModel( s->allScriptResolvers(), s->enabledScriptResolvers(), this ); ui->scriptList->setModel( m_resolversModel ); connect( ui->scriptList->selectionModel(), SIGNAL( selectionChanged( QItemSelection,QItemSelection ) ), this, SLOT( scriptSelectionChanged() ) ); connect( ui->addScript, SIGNAL( clicked( bool ) ), this, SLOT( addScriptResolver() ) ); connect( ui->removeScript, SIGNAL( clicked( bool ) ), this, SLOT( removeScriptResolver() ) ); connect( ui->buttonBrowse_2, SIGNAL( clicked() ), SLOT( showPathSelector() ) ); connect( ui->proxyButton, SIGNAL( clicked() ), SLOT( showProxySettings() ) ); connect( ui->checkBoxStaticPreferred, SIGNAL( toggled(bool) ), SLOT( toggleUpnp(bool) ) ); connect( this, SIGNAL( rejected() ), SLOT( onRejected() ) ); ui->listWidget->setCurrentRow( 0 ); }
ConfigParser::ConfigParser(const std::string& path) : _config(std::move(parseConfig(openConfig(path)))) { /* @todo config data path parsing and data reading */ }
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static UINT s_uTaskBarCreated = 0; switch(uMsg) { case WM_CREATE: s_uTaskBarCreated = RegisterWindowMessage(L"TaskbarCreated"); g_hwndMain = hwnd; // Set icons SendMessage(hwnd, WM_SETICON, ICON_BIG, (LONG)(LONG_PTR)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MAIN_ICON), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR)); SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LONG)(LONG_PTR)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TRAY_ICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR)); // call uninstall hook keyboard to clean the override key array uninstallHookKeyboard(); // Set the Tray Icon ReloadExTrayIcon(); if (openConfig() == 1) { MessageBox(g_hwndMain, L"No config file", L"Error", NULL); GUIProQuit(); return 0; } if (!registerConfig(TRUE)) { GUIProQuit(); return 0; } /* myRegisterHotKey(VK_ADD, MOD_CONTROL | MOD_WIN, IDH_HOTKEY_VOL_UP, true); myRegisterHotKey(VK_SUBTRACT, MOD_CONTROL | MOD_WIN, IDH_HOTKEY_VOL_DOWN, true); myRegisterHotKey(VK_NUMPAD0, MOD_CONTROL | MOD_WIN, IDH_HOTKEY_VOL_MUTE, true); */ // Clean the memory in order to have a light application FlushMemory(); break; case WM_DESTROY: GUIProQuit(); break; case WM_HOTKEY: { int ret = -2; switch (wParam) { case IDH_HOTKEY_VOL_UP: ret = changeVolumeUp(); break; case IDH_HOTKEY_VOL_DOWN: ret = changeVolumeDown(); break; case IDH_HOTKEY_VOL_MUTE: ret = changeVolumeMute(); if (ret > 0) ret = getVolume(); break; } if (ret >= 0) { ShowVolumeBalloon(ret); } unloadVolumeInterface(); FlushMemory(); } break; case WM_MYTRAYMSG: // Tray Icon event if (wParam == IDI_MAIN_ICON) { if ((UINT)lParam == WM_RBUTTONUP) { ShowTrayMenu(); FlushMemory(); } else if ((UINT)lParam == WM_LBUTTONUP) { ShowVolumeBalloon(-1); FlushMemory(); } } break; default: if( uMsg == s_uTaskBarCreated ) { ReloadExTrayIcon(); FlushMemory(); } else { return(DefWindowProc(hwnd, uMsg, wParam, lParam)); } break; } return 0; }
i4 main (int argc, char **argv) { STATUS status=OK; PTR drvH=NULL; char **list=NULL; ATTR_ID **attrList=NULL; char **defAttr=NULL; i4 count=0, attrCount = 0, retcount; i4 i; bool badCmdLine = FALSE, rmPkg = FALSE, has_default = FALSE, has_alt = FALSE, isReadOnly = FALSE, mgrSpecified = FALSE, batch = FALSE, def_or_alt=FALSE; i4 pathType = OCFG_SYS_PATH; char altPath[OCFG_MAX_STRLEN] = "\0"; char drvMgr[OCFG_MAX_STRLEN] = "\0"; char line[MAXLINE],prompt[MAXLINE]; char driverPath[OCFG_MAX_STRLEN]; char *dirPath; char driverName[OCFG_MAX_STRLEN]; char *ii_installation; char *p = NULL; char custName[OCFG_MAX_STRLEN]; char etxt[512]; ATTR_ID driverList[6] = { { DRV_ATTR_DRIVER, "\0" }, { DRV_ATTR_DRIVER_ODBC_VER, DRV_STR_VERSION }, { DRV_ATTR_DRIVER_READONLY, DRV_STR_N }, { DRV_ATTR_DRIVER_TYPE, DRV_STR_INGRES }, { DRV_ATTR_VENDOR, DRV_STR_INGRES_CORP }, { DRV_ATTR_DONT_DLCLOSE, DRV_STR_ONE } }; int drvCount = sizeof(driverList) / sizeof(driverList[0]); ATTR_ID **drvList = (ATTR_ID **)MEreqmem( (u_i2) 0, (u_i4)drvCount, TRUE, (STATUS *) NULL); for (i = 0; i < drvCount; i++) { drvList[i] = (ATTR_ID *)MEreqmem( (u_i2) 0, (u_i4)sizeof(ATTR_ID), TRUE, (STATUS *) NULL); drvList[i]->id = driverList[i].id; drvList[i]->value = (char *)MEreqmem( (u_i2) 0, (u_i4)OCFG_MAX_STRLEN, TRUE, (STATUS *) NULL); STcopy(driverList[i].value, drvList[i]->value); } if ( argc > 7 ) badCmdLine = TRUE; /* ** Parse the command line. Reject invalid arguments. */ if ( !badCmdLine && argc > 1 ) { if (checkArgs("-h", argc, argv, NULL, NULL ) ) { display_help(); PCexit(0); } if (checkArgs("-help", argc, argv, NULL, NULL ) ) { display_help(); PCexit(0); } if ( checkArgs("-batch", argc, argv, NULL, NULL ) ) batch = TRUE; if ( checkArgs("-rmpkg", argc, argv, NULL, NULL ) ) rmPkg = TRUE; if (checkArgs("-r", argc, argv, NULL, NULL ) ) isReadOnly = TRUE; if ( checkArgs("-p", argc, argv, altPath, NULL ) ) pathType = OCFG_ALT_PATH; if ( checkArgs("-m", argc, argv, NULL, drvMgr ) ) mgrSpecified = TRUE; } /* ** Set driver manager according to user input. Default is unixODBC. */ if (mgrSpecified && !STbcompare( drvMgr, 0, MGR_STR_CAI_PT, 0, TRUE ) ) driverManager = MGR_VALUE_CAI_PT; else driverManager = MGR_VALUE_UNIX_ODBC; /* ** If none of the arguments are recognized, flag an error. */ if ( !batch && !rmPkg && !isReadOnly && pathType != OCFG_ALT_PATH && !mgrSpecified && argc > 1) badCmdLine = TRUE; if ( badCmdLine ) { display_help(); PCexit(FAIL); } if ( isReadOnly ) STcopy(DRV_STR_Y, drvList[2]->value); else STcopy(DRV_STR_N, drvList[2]->value); if ( !writeMgrFile( altPath ) ) { SIprintf("Aborting due to error writing %s/files/%s\n", SYSTEM_LOCATION_SUBDIRECTORY, MGR_STR_FILE_NAME); PCexit(FAIL); } defAttr = getDefaultInfo(); if (defAttr == NULL) { SIprintf("Aborting due to error reading %s/install/%s\n", SYSTEM_LOCATION_VARIABLE, INFO_STR_FILE_NAME); PCexit(FAIL); } /* ** Get the path of the driver library and create the path/libname string. */ NMgtAt(SYSTEM_LOCATION_VARIABLE,&dirPath); /* usually II_SYSTEM */ if (dirPath != NULL && *dirPath) STlcopy(dirPath,driverPath,sizeof(driverPath)-20-1); else { SIprintf("Error--%s is not defined\n",SYSTEM_LOCATION_VARIABLE); PCexit(FAIL); } # ifdef VMS STcat(driverPath,"["); STcat(driverPath,SYSTEM_LOCATION_SUBDIRECTORY); /* usually "ingres" */ STcat(driverPath,".library]"); if ( isReadOnly ) STcat(driverPath,defAttr[INFO_ATTR_RONLY_DRV_FNAME]); else STcat(driverPath,defAttr[INFO_ATTR_DRIVER_FILE_NAME]); # else STcat(driverPath,"/"); STcat(driverPath,SYSTEM_LOCATION_SUBDIRECTORY); /* usually "ingres" */ STcat(driverPath,"/lib/"); if ( isReadOnly ) STcat(driverPath,defAttr[INFO_ATTR_RONLY_DRV_FNAME]); else STcat(driverPath,defAttr[INFO_ATTR_DRIVER_FILE_NAME]); # endif /* ifdef VMS */ STcopy(driverPath,drvList[0]->value); /* ** Initialize the cache from the odbcinst.ini file. */ openConfig(NULL, pathType, altPath, &drvH, &status); if (status != OK) { STprintf(etxt,"Could not open from path %s.\n", pathType == OCFG_ALT_PATH ? altPath : "/usr/local/etc"); display_err(etxt,status); PCexit(FAIL); } if (rmPkg) { delConfigEntry( drvH, defAttr[INFO_ATTR_DRIVER_NAME], &status ); delConfigEntry( drvH, defAttr[INFO_ATTR_ALT_DRIVER_NAME], &status ); closeConfig(drvH, &status); PCexit(OK); } /* ** Get the driver count. */ retcount = listConfig( drvH, count, list, &status ); if (status != OK) { STprintf(etxt,"Could not list drivers.\n"); display_err(etxt,status); PCexit(FAIL); } count = retcount; if (count) { /* ** Get the list of recognized drivers. */ list = (char **)MEreqmem( (u_i2) 0, (u_i4)(count * sizeof(char *)), TRUE, (STATUS *) NULL); for (i = 0; i < count; i++) list[i] = (char *)MEreqmem( (u_i2) 0, (u_i4)OCFG_MAX_STRLEN, TRUE, (STATUS *) NULL); listConfig( drvH, count, list, &status ); if (status != OK) { STprintf(etxt,"Could not list drivers.\n"); display_err(etxt,status); PCexit(FAIL); } } for (i = 0; i < count; i++) { def_or_alt = FALSE; if (!has_default) { has_default = STbcompare( list[i], 0, defAttr[INFO_ATTR_DRIVER_NAME], 0, TRUE ) == 0 ? TRUE : FALSE; if (has_default) def_or_alt = TRUE; } if (!has_alt) { has_alt = STbcompare( list[i], 0, defAttr[INFO_ATTR_ALT_DRIVER_NAME], 0, TRUE ) == 0 ? TRUE : FALSE; if (has_alt) def_or_alt = TRUE; } if (def_or_alt) { if ( !batch ) { STprintf(prompt, "\tInstallation has pre-defined version of %s.\n\tOverwrite? (Yes/No)", list[i]); if ( line_get( prompt, "", FALSE, line ) == EOF ) { SIprintf("ODBC driver installation safely aborted\n"); PCexit(OK); } STzapblank(line,line); if ( line[0] != 'y' && line [0] != 'Y' ) { SIprintf( "%s left untouched\n", list[i] ); continue; } } /* if (!batch) */ STcopy(list[i],driverName); setConfigEntry( drvH, driverName, drvCount, drvList, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } /* if (has_default || has_alt) */ else if ( !batch ) { STprintf(prompt, "\tInstallation has custom version of %s.\n\tDelete? (Yes/No)", list[i]); if ( line_get( prompt, "", FALSE, line ) == EOF ) { SIprintf("ODBC driver installation safely aborted\n"); PCexit(OK); } STzapblank(line,line); if ( line[0] != 'y' && line [0] != 'Y' ) { SIprintf( "%s left untouched\n", list[i] ); continue; } STcopy(list[i],driverName); delConfigEntry( drvH, driverName, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } /* if (!batch) && !has_default */ } /* for (count... */ if (!has_default) { setConfigEntry( drvH, defAttr[INFO_ATTR_DRIVER_NAME], drvCount, drvList, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } if (!has_alt) { setConfigEntry( drvH, defAttr[INFO_ATTR_ALT_DRIVER_NAME], drvCount, drvList, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } closeConfig(drvH, &status); if (status != OK) { STprintf(etxt,"Could not close driver info.\n"); display_err(etxt,status); PCexit(FAIL); } if (count) { for (i = 0; i < count; i++) MEfree((PTR)list[i]); MEfree((PTR)list); } for (i = 0; i < drvCount; i++) { MEfree((PTR)drvList[i]->value); MEfree((PTR)drvList[i]); } MEfree((PTR)drvList); PCexit(OK); }
MainWindow::MainWindow() : m_settings(QString::fromAscii("Doxygen.org"), QString::fromAscii("Doxywizard")) { QMenu *file = menuBar()->addMenu(tr("File")); file->addAction(tr("Open..."), this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O); m_recentMenu = file->addMenu(tr("Open recent")); file->addAction(tr("Save"), this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S); file->addAction(tr("Save as..."), this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S); file->addAction(tr("Quit"), this, SLOT(quit()), Qt::CTRL+Qt::Key_Q); QMenu *settings = menuBar()->addMenu(tr("Settings")); settings->addAction(tr("Reset to factory defaults"), this,SLOT(resetToDefaults())); settings->addAction(tr("Use current settings at startup"), this,SLOT(makeDefaults())); settings->addAction(tr("Clear recent list"), this,SLOT(clearRecent())); QMenu *help = menuBar()->addMenu(tr("Help")); help->addAction(tr("Online manual"), this, SLOT(manual()), Qt::Key_F1); help->addAction(tr("About"), this, SLOT(about()) ); m_expert = new Expert; m_wizard = new Wizard(m_expert->modelData()); // ----------- top part ------------------ QWidget *topPart = new QWidget; QVBoxLayout *rowLayout = new QVBoxLayout(topPart); // select working directory QHBoxLayout *dirLayout = new QHBoxLayout; m_workingDir = new QLineEdit; m_selWorkingDir = new QPushButton(tr("Select...")); dirLayout->addWidget(m_workingDir); dirLayout->addWidget(m_selWorkingDir); //------------- bottom part -------------- QWidget *runTab = new QWidget; QVBoxLayout *runTabLayout = new QVBoxLayout(runTab); // run doxygen QHBoxLayout *runLayout = new QHBoxLayout; m_run = new QPushButton(tr("Run doxygen")); m_run->setEnabled(false); m_runStatus = new QLabel(tr("Status: not running")); m_saveLog = new QPushButton(tr("Save log...")); m_saveLog->setEnabled(false); QPushButton *showSettings = new QPushButton(tr("Show configuration")); runLayout->addWidget(m_run); runLayout->addWidget(m_runStatus); runLayout->addStretch(1); runLayout->addWidget(showSettings); runLayout->addWidget(m_saveLog); // output produced by doxygen runTabLayout->addLayout(runLayout); runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen"))); QGridLayout *grid = new QGridLayout; m_outputLog = new QTextEdit; m_outputLog->setReadOnly(true); m_outputLog->setFontFamily(QString::fromAscii("courier")); m_outputLog->setMinimumWidth(600); grid->addWidget(m_outputLog,0,0); grid->setColumnStretch(0,1); grid->setRowStretch(0,1); QHBoxLayout *launchLayout = new QHBoxLayout; m_launchHtml = new QPushButton(tr("Show HTML output")); launchLayout->addWidget(m_launchHtml); launchLayout->addStretch(1); grid->addLayout(launchLayout,1,0); runTabLayout->addLayout(grid); QTabWidget *tabs = new QTabWidget; tabs->addTab(m_wizard,tr("Wizard")); tabs->addTab(m_expert,tr("Expert")); tabs->addTab(runTab,tr("Run")); rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run"))); rowLayout->addLayout(dirLayout); rowLayout->addWidget(new QLabel(tr("Step 2: Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation"))); rowLayout->addWidget(tabs); setCentralWidget(topPart); statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout); m_runProcess = new QProcess; m_running = false; m_timer = new QTimer; // connect signals and slots connect(tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int))); connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir())); connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*))); connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir())); connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout())); connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete())); connect(m_timer,SIGNAL(timeout()),SLOT(readStdout())); connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen())); connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput())); connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog())); connect(showSettings,SIGNAL(clicked()),SLOT(showSettings())); connect(m_expert,SIGNAL(changed()),SLOT(configChanged())); loadSettings(); updateLaunchButtonState(); m_modified = false; updateTitle(); m_wizard->refresh(); }
//------------------------------------------------------------------------------ /// /// read argmunents from the commandline /// /// @param arg_count It is the number of arguments /// @param arg_value It is used to get the characters of the arguments /// @param arg_angle A global will be need an, in case, overwritten /// @param arg_speed A global will be need an, in case, overwritten /// @param arg_bit_name It will be need to compare, if the file ending exists. /// /// @return error It depends on the values, which will be returned by two other /// functions: checkIsFloat() and checkBitmapName() // int readArguments(int arg_count, char **arg_value, float *arg_angle, float *arg_speed, char **arg_bitmap_name, float *nr_gravity, unsigned int *res_width, unsigned int *res_height, unsigned int *nr_pps, float *wind_angle, float *wind_force) { int arg_iterator; int error = 0; for(arg_iterator = 1; arg_iterator < arg_count; arg_iterator++) { if(arg_iterator == 1) { if (sscanf(arg_value[arg_iterator], "%f", arg_angle) == 0) { return ERROR_ARGUMENTS; } /**arg_angle = (float)atof(arg_value[arg_iterator]); if((error = checkIsFloat(arg_value[arg_iterator])) != 0) { return error; }*/ } else if(arg_iterator == 2) { if(sscanf(arg_value[arg_iterator], "%f", arg_speed) == 0) { //*arg_speed = (float)atof(arg_value[arg_iterator]); return ERROR_ARGUMENTS; } if (*arg_speed <= 0) { return ERROR_SPEED; } /* if((error = checkIsFloat(arg_value[arg_iterator])) != 0) { return error; }*/ } else if(arg_iterator == 3) { *arg_bitmap_name = arg_value[arg_iterator]; if((error = checkBitmapName(arg_bitmap_name)) != 0) { return error; } } else if(arg_iterator == 4) { if((error = openConfig(arg_value[arg_iterator], nr_gravity, res_width, res_height, nr_pps, wind_angle, wind_force)) != 0) { return error; } } } if(arg_count == ARG_COUNT_MINIMUM) { printf(ERROR_MSG_NO_CONFIG); } return SUCCESS; }
QMenu* TabWidget::kueueMainMenu() { QMenu* menu = new QMenu( this ); QMenu* kueue = new QMenu( menu ); kueue->setIcon( QIcon( ":/icons/kueue.png" ) ); kueue->setTitle( "Kueue" ); mActionConfig = new QAction( kueue ); mActionConfig->setText( "Configure kueue" ); mActionConfig->setIcon( QIcon( ":/icons/menus/configure.png" ) ); mActionNSA = new QAction( kueue ); mActionNSA->setText( "Generate NSA Report" ); mActionNSA->setIcon( QIcon( ":/icons/menus/nsa.png" ) ); if ( Settings::unityEnabled() ) { mActionAddUnityTab = new QAction( kueue ); mActionAddUnityTab->setText( "Add Unity tab" ); mActionAddUnityTab->setIcon( QIcon( ":/icons/menus/web.png" ) ); } mActionQuit = new QAction( kueue ); mActionQuit->setText( "Quit" ); mActionQuit->setIcon( QIcon( ":/icons/menus/quit.png" ) ); mActionQuit->setShortcut ( QKeySequence( Qt::CTRL + Qt::Key_Q ) ); kueue->addAction( mActionConfig ); if ( Settings::unityEnabled() ) { kueue->addAction( mActionAddUnityTab ); } kueue->addAction( mActionNSA ); kueue->addAction( mActionQuit ); QMenu* view = new QMenu( menu ); view->setIcon( QIcon( ":/icons/conf/targets.png" ) ); view->setTitle( "Personal queue" ); QMenu* filter = new QMenu( menu ); filter->setIcon( QIcon( ":/icons/menus/filter.png" ) ); filter->setTitle( "Filter" ); mActionAwaitingCustomer = new QAction( filter ); mActionAwaitingCustomer->setText( "Awaiting Customer" ); mActionAwaitingCustomer->setCheckable( true ); mActionAwaitingSupport = new QAction( filter ); mActionAwaitingSupport->setText( "Awaiting Support" ); mActionAwaitingSupport->setCheckable( true ); mActionOthers = new QAction( filter ); mActionOthers->setText( "Other" ); mActionOthers->setCheckable( true ); mActionShowCR = new QAction( filter ); mActionShowCR->setText( "Show CRs" ); mActionShowCR->setCheckable( true ); mActionShowSR = new QAction( filter ); mActionShowSR->setText( "Show SRs" ); mActionShowSR->setCheckable( true ); filter->addAction( mActionAwaitingCustomer ); filter->addAction( mActionAwaitingSupport ); filter->addAction( mActionOthers ); filter->addSeparator(); filter->addAction( mActionShowCR ); filter->addAction( mActionShowSR ); view->addMenu( filter ); QMenu* sortby = new QMenu( menu ); sortby->setIcon( QIcon( ":/icons/menus/sort.png" ) ); sortby->setTitle( "Sort by" ); mActionSortUpdate = new QAction( sortby ); mActionSortUpdate->setText( "Last activity" ); mActionSortUpdate->setCheckable( true ); mActionSortAge = new QAction( sortby ); mActionSortAge->setText( "Age" ); mActionSortAge->setCheckable( true ); sortby->addAction( mActionSortUpdate ); sortby->addAction( mActionSortAge ); view->addMenu( sortby ); QMenu* other = new QMenu( menu ); other->setIcon( QIcon( ":/icons/menus/misc.png" ) ); other->setTitle( "Other" ); mActionCloseSrTables = new QAction( other ); mActionCloseSrTables->setText( "Close all SR tables" ); mActionExpandSrTables = new QAction( other ); mActionExpandSrTables->setText( "Expand all SR tables" ); other->addAction( mActionCloseSrTables ); other->addAction( mActionExpandSrTables ); view->addMenu( other ); QMenu* sub = new QMenu( menu ); sub->setIcon( QIcon( ":/icons/conf/targets.png" ) ); sub->setTitle( "Subowned SRs" ); QMenu* subfilter = new QMenu( menu ); subfilter->setIcon( QIcon( ":/icons/menus/filter.png" ) ); subfilter->setTitle( "Filter" ); mActionSubAwaitingCustomer = new QAction( subfilter ); mActionSubAwaitingCustomer->setText( "Awaiting Customer" ); mActionSubAwaitingCustomer->setCheckable( true ); mActionSubAwaitingSupport = new QAction( subfilter ); mActionSubAwaitingSupport->setText( "Awaiting Support" ); mActionSubAwaitingSupport->setCheckable( true ); mActionSubOthers = new QAction( subfilter ); mActionSubOthers->setText( "Other" ); mActionSubOthers->setCheckable( true ); mActionSubShowCR = new QAction( subfilter ); mActionSubShowCR->setText( "Show CRs" ); mActionSubShowCR->setCheckable( true ); mActionSubShowSR = new QAction( subfilter ); mActionSubShowSR->setText( "Show SRs" ); mActionSubShowSR->setCheckable( true ); subfilter->addAction( mActionSubAwaitingCustomer ); subfilter->addAction( mActionSubAwaitingSupport ); subfilter->addAction( mActionSubOthers ); subfilter->addSeparator(); subfilter->addAction( mActionSubShowCR ); subfilter->addAction( mActionSubShowSR ); sub->addMenu( subfilter ); QMenu* subsortby = new QMenu( menu ); subsortby->setIcon( QIcon( ":/icons/menus/sort.png" ) ); subsortby->setTitle( "Sort by" ); mActionSubSortUpdate = new QAction( subsortby ); mActionSubSortUpdate->setText( "Last activity" ); mActionSubSortUpdate->setCheckable( true ); mActionSubSortAge = new QAction( subsortby ); mActionSubSortAge->setText( "Age" ); mActionSubSortAge->setCheckable( true ); sortby->addAction( mActionSubSortUpdate ); sortby->addAction( mActionSubSortAge ); sub->addMenu( subsortby ); QMenu* subother = new QMenu( menu ); subother->setIcon( QIcon( ":/icons/menus/misc.png" ) ); subother->setTitle( "Other" ); mActionSubCloseSrTables = new QAction( other ); mActionSubCloseSrTables->setText( "Close all SR tables" ); mActionSubExpandSrTables = new QAction( other ); mActionSubExpandSrTables->setText( "Expand all SR tables" ); subother->addAction( mActionSubCloseSrTables ); subother->addAction( mActionSubExpandSrTables ); sub->addMenu( subother ); QMenu* qmon = new QMenu( menu ); qmon->setIcon( QIcon( ":/icons/conf/monitor.png" ) ); qmon->setTitle( "Queue monitor" ); QMenu* qmonfilter = new QMenu( qmon ); filter->setIcon( QIcon( ":/icons/menus/filter.png" ) ); filter->setTitle( "Filter" ); /*mActionQmonAwaitingCustomer = new QAction( qmonfilter ); mActionQmonAwaitingCustomer->setText( "Awaiting Customer" ); mActionQmonAwaitingCustomer->setCheckable( true ); mActionQmonAwaitingSupport = new QAction( qmonfilter ); mActionQmonAwaitingSupport->setText( "Awaiting Support" ); mActionQmonAwaitingSupport->setCheckable( true ); mActionQmonOthers = new QAction( qmonfilter ); mActionQmonOthers->setText( "Other" ); mActionQmonOthers->setCheckable( true ); qmonfilter->addAction( mActionAwaitingCustomer ); qmonfilter->addAction( mActionAwaitingSupport ); qmonfilter->addAction( mActionOthers );*/ qmon->addMenu( qmonfilter ); QMenu* help = new QMenu( menu ); help->setIcon( QIcon( ":/icons/menus/help.png" ) ); help->setTitle( "Help" ); mActionHelp = new QAction( help ); mActionHelp->setText( "Help" ); mActionHelp->setIcon( QIcon( ":/icons/menus/help.png" ) ); mActionBug = new QAction( help ); mActionBug->setText( "Report Bug" ); mActionBug->setIcon( QIcon( ":/icons/menus/reportbug.png" ) ); mActionFeature = new QAction( help ); mActionFeature->setText( "Suggest feature" ); mActionFeature->setIcon( QIcon( ":/icons/menus/feature.png" ) ); mActionAbout = new QAction( help ); mActionAbout->setText( "About kueue" ); mActionAbout->setIcon( QIcon( ":/icons/menus/about.png" ) ); help->addAction( mActionHelp ); help->addAction( mActionBug ); help->addAction( mActionFeature ); help->addAction( mActionAbout ); menu->addMenu( kueue ); menu->addMenu( view ); menu->addMenu( sub ); menu->addMenu( qmon ); menu->addMenu( help ); setMenus(); connect( mActionQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) ); connect( mActionConfig, SIGNAL( activated() ), this, SIGNAL( openConfig() ) ); connect( mActionShowSR, SIGNAL( toggled( bool ) ), this, SLOT( setShowSR( bool ) ) ); connect( mActionShowCR, SIGNAL( toggled( bool ) ), this, SLOT( setShowCR( bool ) ) ); connect( mActionSortUpdate, SIGNAL( toggled( bool ) ), this, SLOT( setSortUpdate( bool ) ) ); connect( mActionSortAge, SIGNAL( toggled( bool ) ), this, SLOT( setSortAge( bool ) ) ); connect( mActionAwaitingCustomer, SIGNAL( toggled( bool ) ), this, SLOT( setShowAwaitingCustomer( bool ) ) ); connect( mActionAwaitingSupport, SIGNAL( toggled( bool ) ), this, SLOT( setShowAwaitingSupport( bool ) ) ); connect( mActionOthers, SIGNAL( toggled( bool ) ), this, SLOT( setShowStatusOthers( bool ) ) ); connect( mActionExpandSrTables, SIGNAL( activated() ), this, SLOT( expandAllTables() ) ); connect( mActionCloseSrTables, SIGNAL( activated() ), this, SLOT( closeAllTables() ) ); connect( mActionSubShowSR, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowSR( bool ) ) ); connect( mActionSubShowCR, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowCR( bool ) ) ); connect( mActionSubSortUpdate, SIGNAL( toggled( bool ) ), this, SLOT( subSetSortUpdate( bool ) ) ); connect( mActionSubSortAge, SIGNAL( toggled( bool ) ), this, SLOT( subSetSortAge( bool ) ) ); connect( mActionSubAwaitingCustomer, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowAwaitingCustomer( bool ) ) ); connect( mActionSubAwaitingSupport, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowAwaitingSupport( bool ) ) ); connect( mActionSubOthers, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowStatusOthers( bool ) ) ); connect( mActionSubExpandSrTables, SIGNAL( activated() ), this, SLOT( subExpandAllTables() ) ); connect( mActionSubCloseSrTables, SIGNAL( activated() ), this, SLOT( subCloseAllTables() ) ); connect( mActionAbout, SIGNAL( activated() ), this, SLOT( aboutDialog() ) ); connect( mActionBug, SIGNAL( activated() ), this, SLOT( reportBug() ) ); connect( mActionFeature, SIGNAL( activated() ), this, SLOT( suggestFeature() ) ); connect( mActionHelp, SIGNAL( activated() ), this, SLOT( openHelp() ) ); if ( Settings::unityEnabled() ) { connect( mActionAddUnityTab, SIGNAL( activated() ), this, SLOT( addUnityBrowser() ) ); } connect( mActionNSA, SIGNAL( activated() ), this, SLOT( makeNsaReport() ) ); return menu; }
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static UINT s_uTaskBarCreated = 0; switch(uMsg) { case WM_CREATE: { g_hwndMain = hwnd; // Register task bar (re)creation in order to reload systray icons after explorer crashes s_uTaskBarCreated = RegisterWindowMessage(REGISTER_MESSAGE); // Set Icons SendMessage(hwnd, WM_SETICON, ICON_BIG, (LONG)(LONG_PTR)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MAIN_ICON), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR)); SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LONG)(LONG_PTR)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MAIN_ICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR)); ShowWindow(hwnd, SW_HIDE); // Clear the list g_IconTray.clear(); installHookKeyboard(); // Open the configuration if (openConfig() == FALSE) { uninstallHookKeyboard(); clearMenuSkin(); MessageBox(g_hwndMain, L"Configuration file not found or invalid", ERR_MSGBOX_TITLE, NULL); PostQuitMessage(0); return 0; } // Retreive the version of Windows (in order to know if it is a win200 or superior) windowsVersion = GetWindowsVersion(); // Initialisation of variables for menus InitMenuVars(); // Add the system tray icons (depends of the configuration) ShowTrayIcons(); // Show loading error messages if (g_loadingmessage != NULL) { ShowBalloon(ERR_MSGBOX_TITLE, g_loadingmessage, 0, NIIF_ERROR); free(g_loadingmessage); g_loadingmessage = NULL; } // Launch application in "autorun" mode fireEvent(PROG_EVENT_START); FlushMemory(); } break; case WM_HOTKEY: if( (wParam >= IDH_HOTKEY_MENU) && (wParam <= (IDH_HOTKEY_MENU + g_portal->hotkeys.size()) ) ) { // Detect application item or menu item in order to open a menu or launch the application PortalProg* l_sp = g_portal->hotkeys[ wParam - IDH_HOTKEY_MENU ]; while( l_sp ) { if( l_sp->progs.size() > 0 ) { ShowTrayMenu(l_sp, PORTAL_MENU_HOTKEY); } else { l_sp->run(false); // Some commands could call quitPortal. In this case g_portal is set to NULL. if(g_portal == NULL) return 0; } l_sp = l_sp->nextSameHotkey; } } FlushMemory(); break; case WM_DESTROY: { quitPortal(); } break; case WM_MYTRAYMSG: if ((wParam >= IDI_MAIN_ICON) && g_portal && (wParam <= (IDI_MAIN_ICON + g_portal->menus.size()))) { // Find the clicked systray int pos = (int)wParam - IDI_MAIN_ICON; if( ((UINT)lParam == WM_RBUTTONUP) || ((UINT)lParam == WM_LBUTTONUP) || ((UINT)lParam == WM_MOUSEMOVE) ) { // Left click : minimalist menu // Right click : Complete menu (with About/Reload/Quit) // Auto Open : Complete menu (like right click) with a automatic dismiss int param = PORTAL_MENU_SYSTRAY; if((UINT)lParam == WM_RBUTTONUP) { param = PORTAL_MENU_SYSTRAY_CMD; } if( ((UINT)lParam == WM_MOUSEMOVE) ) { if( (g_portal->menus[pos] != NULL) && (g_portal->menus[pos]->options & PROG_OPTION_AUTOOPEN) ) { param = PORTAL_MENU_SYSTRAY_AUTO; } else { return 0; } } // Detect if the icon is for a menu or a application if( (g_portal->menus[pos] != NULL) && ( g_portal->menus[pos]->progs.size() > 0 ) ) { ShowTrayMenu(g_portal->menus[pos], param); g_currentMenu = pos; } else if( (g_portal->menus[pos] != NULL) && (g_portal->menus[pos]->progExe != NULL )) { if((UINT)lParam == WM_LBUTTONUP) { g_portal->menus[pos]->run(true); g_currentMenu = pos; } else { ShowTrayMenu(g_portal->menus[pos], param); g_currentMenu = pos; } } else { ShowTrayMenu(NULL, param); g_currentMenu = 0; } FlushMemory(); } else if( (UINT)lParam == NIN_BALLOONUSERCLICK ) { if(g_aboutbaloon) checkGuiproVersion(); FlushMemory(); return 0; } } break; case WM_INITMENUPOPUP : OnInitMenuPopup(hwnd, wParam, lParam); break; case WM_UNINITMENUPOPUP: OnUninitMenuPopup(hwnd, wParam, lParam); break; case WM_MEASUREITEM : OnMeasureItem(hwnd, wParam, lParam); break; case WM_DRAWITEM : OnDrawItem(hwnd, wParam, lParam); break; case WM_MENUCHAR: return OnMenuCharItem(hwnd, wParam, lParam); case WM_COMMAND: // Retreive a menu command if( wParam == IDM_EXIT ) { quitPortal(); } else if( wParam == IDM_RELOAD ) { reloadPortalConfig(); } else if( wParam == IDM_ABOUT ) { ShowAbout(g_currentMenu); FlushMemory(); } else if( ((UINT)wParam >= (PORTAL_HK_ID)) && ( (UINT)wParam <= (UINT)(PORTAL_HK_ID + menuGetNbElem()) ) ) { PortalProg* l_sp = menuGetElem( (int)(wParam - 1 - PORTAL_HK_ID) ); l_sp->run(true); FlushMemory(); } else if( ((UINT)wParam >= (PORTAL_FILE_ID)) && ( (UINT)wParam < (UINT)(PORTAL_FILE_ID + menuGetNbFiles()) ) ) { PortalProg* l_sp = menuGetFile( (int)(wParam - PORTAL_FILE_ID) ); l_sp->run(true); FlushMemory(); for(PortalProgVector::iterator i = g_portal_files.begin(); i != g_portal_files.end(); i++) { delete (*i); } g_portal_files.clear(); } break; default: if( uMsg == s_uTaskBarCreated ) { // Traskbar (re)creation, we have to reset systray icons ReloadTrayIcons(); FlushMemory(); } else { return(DefWindowProc(hwnd, uMsg, wParam, lParam)); } break; } return 0; }