int main(int argc, char* argv[]) { string file_path; switch (argc) { case 2: if (argv[1] == "-h") { About(); return 0; } else { cout << "you need specify object language" << endl; return 0; } break; case 3: try { TestParam(string(argv[2])); file_path = argv[1]; } catch(const string& e) { cout << "Error: " << e << endl; About(); return 0; } break; default: About(); return 0; break; } CreateGlobalObj(); CFileHandler filehandler(file_path); filehandler.AnalysisFile(); if (!filehandler.IsOccurError()) { CBaseTranslator* p_Translate = GenerateTranslator(string(argv[2])); p_Translate->TranslateProtocol(); delete p_Translate; cout << "complete!" << endl; } DestoryGlobalObj(); system("pause"); return 0; }
// ----------------------------------------------------------------------------- // CThemeChangeAppUi::HandleCommandL() // Takes care of command handling. // ----------------------------------------------------------------------------- // void CThemeChangeAppUi::HandleCommandL(TInt aCommand) { switch (aCommand) { case EEikCmdExit: case EAknSoftkeyExit: Exit(); break; case ECommandExit: if (ShowConfirmationQueryL(R_TEXT_DLG_EXIT_CONFIRM)) Exit(); break; case EAbout: About(); break; case ECommandHelp: ActivateLocalViewL(TUid::Uid(EThemeChangeHelpView)); break; case ECommandSetting: ActivateLocalViewL(TUid::Uid(EThemeChangeSettingView)); break; default: Panic(EThemeChangeUi); break; } }
static void M_Win_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT CodeNotify) { switch(id) { case IDC_COPY: CopyFiles(); //Выполнение копирования break; case IDC_CLEAR: ClearSelect(); //Снятие всех выделений break; case IDC_CONFIG: NewConfig(); //Изменение конфигурации break; case IDCANCEL: SendMessage(hwnd, WM_DESTROY, 0, 0);//Завершение программы и закрытие окон break; case IDC_SIZE_HDD: View_Map_HDD(); //Карта занятости HDD break; case IDC_ABOUT: About(); //Вывод информации break; case IDC_TO_TXT: OutTxt(); //Запись дерева в текстовый файл break; #if defined WRITE_YES //Режим записи разрешен case IDC_WRITE_FI: WriteFileToHDD(0); break; //Запись файлов на диск case IDC_WRITE_FO: WriteFileToHDD(1); break; //Запись файлов на диск case IDC_NEW_FO: WriteFileToHDD(2); break; //Запись файлов на диск case IDC_REN_FI: WriteFileToHDD(3); break; //Переименование case IDC_DEL_FI: WriteFileToHDD(4); break; //Удаление case IDC_CORR67: Correct67Sec(); break; //Коррекция содержимого 67 сектора #endif } }
void FarPlugin::Config() { FarDialog& dlg = Dialogs()["SetupDialog"]; dlg.ResetControls(); dlg.LoadState(options); rep: int res = dlg.Execute(); switch(res) { case 0: dlg.SaveState(options); SaveOptions(); break; case 1: KeyConfig(); goto rep; case 2: About(); goto rep; case 3: static int bn = 0; beep(bn); if (++bn > 2) { bn = 0; } goto rep; } }
CCGUI:: CCGUI( QWidget *pParent /* = 0 */, Qt::WFlags Flags /* = 0 */ ) : QMainWindow(pParent, Flags) { LOGFONTW lf; ui.setupUi(this); setWindowTitle(QString::fromUtf16(L"Ðdz½Ö®¼ä")); SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0); QFont font(QApplication::font()); font.setWeight(QFont::Normal); font.setStyleStrategy(QFont::PreferQuality); font.setFamily(QString::fromUtf16(lf.lfFaceName)); QApplication::setFont(font); AllocConsole(); BOOL b; connect(ui.actionFileExit, SIGNAL(triggered()), this, SLOT(close())); b = connect(ui.MenuAbout, SIGNAL(aboutToShow()), this, SLOT(About())); PrintConsoleW(L"%d\n", b); }
bool CMetaplugPropsDlg::EmbedCheck(CString& NonFreePlugs) { CFFEngine& eng = theApp.GetEngine(); // stop engine before accessing FreeFrame instance directly via GetFFPlugin STOP_ENGINE(eng); int plugs = eng.GetPluginCount(); for (int PlugIdx = 0; PlugIdx < plugs; PlugIdx++) { CFFPluginEx& pr = eng.GetPlugin(PlugIdx); bool CanEmbed = FALSE; // assume failure PlugExtendedInfoStruct peis; if (pr.GetFFPlugin().GetExtendedInfo(peis)) { CString About(peis.About); if (About.Find(_T("Pete Warden")) >= 0) // case-sensitive CanEmbed = TRUE; else { About.MakeLower(); if (About.Find(_T("copyleft")) >= 0) // NOT case-sensitive CanEmbed = TRUE; } } if (!CanEmbed) { CString PluginPath(pr.GetPath()); LPCTSTR DllName = PathFindFileName(PluginPath); if (NonFreePlugs.Find(DllName) < 0) // eliminate duplicates NonFreePlugs += CString("\n") + DllName; } } return(NonFreePlugs.IsEmpty() != 0); }
void FarPlugin::Config() { FarDialog & dlg = Dialogs()[L"SetupDialog"]; dlg.ResetControls(); dlg.LoadState(options); bool Repeat = true; while (Repeat) { Repeat = false; intptr_t res = dlg.Execute(); switch (res) { case 0: dlg.SaveState(options); SaveOptions(); Repeat = false; break; case 1: KeyConfig(); break; case 2: About(); break; case 3: SoundConfig(); break; } } }
DllExport PF_Err EntryPointFunc ( PF_Cmd cmd, PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output ) { PF_Err err = PF_Err_NONE; switch (cmd) { case PF_Cmd_ABOUT: err = About(in_data,out_data,params,output); break; case PF_Cmd_GLOBAL_SETUP: err = GlobalSetup(in_data,out_data,params,output); break; case PF_Cmd_PARAMS_SETUP: err = ParamsSetup(in_data,out_data,params,output); break; case PF_Cmd_RENDER: err = Render(in_data,out_data,params,output); break; case PF_Cmd_DO_DIALOG: err = PopDialog(in_data,out_data,params,output); break; default: break; } return err; }
void MainWindow::slotHelpAbout() { QMessageBox About(this,0); About.setIconPixmap(QPixmap(Lab_XPM)); About.setCaption(tr("About...")); About.setText(tr("GA Bots\nVersion " VERSION "\n \n(c) 2002 by Edmond Lau, Chris Odorjan and Richard Voino") ); About.exec(); }
void PecoApp::AboutRequested() { const char *CopyrightTexte[10]; CopyrightTexte[0] = STR_ABOUT_COPYRIGHT_0; CopyrightTexte[1] = STR_ABOUT_COPYRIGHT_1; CopyrightTexte[2] = ""; CopyrightTexte[3] = STR_ABOUT_COPYRIGHT_2; CopyrightTexte[4] = NULL; About(STR_ABOUT_TITLE, STR_APP_NAME, STR_APP_VERSION, CopyrightTexte, STR_ABOUT_THANKYOU, "http://www.pecora.de/pecorename/"); }
int main() { long numb1,numb2; setlocale(LC_ALL, "Ukr"); About(); EnterNumb(numb1, numb2); FuncSortPos(numb1, numb2); PrintRes(numb1, numb2); return 0; }
DllExport PF_Err EntryPointFunc ( PF_Cmd cmd, PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output, void *extra) { PF_Err err = PF_Err_NONE; try { switch (cmd) { case PF_Cmd_ABOUT: err = About(in_data, out_data, params, output); break; case PF_Cmd_GLOBAL_SETUP: err = GlobalSetup( in_data, out_data, params, output); break; case PF_Cmd_PARAMS_SETUP: err = ParamsSetup( in_data, out_data, params, output); break; case PF_Cmd_RENDER: err = Render( in_data, out_data, params, output); break; case PF_Cmd_EVENT: err = HandleEvent( in_data, out_data, params, output, reinterpret_cast<PF_EventExtra*>(extra)); break; case PF_Cmd_ARBITRARY_CALLBACK: err = HandleArbitrary( in_data, out_data, params, output, reinterpret_cast<PF_ArbParamsExtra*>(extra)); break; case PF_Cmd_SMART_PRE_RENDER: err = PreRender(in_data, out_data, reinterpret_cast<PF_PreRenderExtra*>(extra)); break; case PF_Cmd_SMART_RENDER: err = SmartRender( in_data, out_data, reinterpret_cast<PF_SmartRenderExtra*>(extra)); break; } } catch (PF_Err &thrown_err) { err = thrown_err; } return err; }
DllExport PF_Err EntryPointFunc ( PF_Cmd cmd, PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output, void *extra) { PF_Err err = PF_Err_NONE; try { switch (cmd) { case PF_Cmd_ABOUT: err = About(in_data, out_data, params, output); break; case PF_Cmd_GLOBAL_SETUP: err = GlobalSetup( in_data, out_data, params, output); break; case PF_Cmd_PARAMS_SETUP: err = ParamsSetup( in_data, out_data, params, output); break; case PF_Cmd_RENDER: err = Render( in_data, out_data, params, output); break; } } catch(PF_Err &thrown_err) { err = thrown_err; } return err; }
// ----------------------------------------------------------------------------- // CDesktopHotKeyAppUi::HandleCommandL() // Takes care of command handling. // ----------------------------------------------------------------------------- // void CDesktopHotKeyAppUi::HandleCommandL(TInt aCommand) { switch (aCommand) { case EEikCmdExit: case EAknSoftkeyExit: Exit(); break; case ECommandAbout: About(); break; default: Panic(EDesktopHotKeyUi); break; } }
void FortyFrame::Help(wxCommandEvent& event) { #if wxUSE_HTML if (wxFileExists(wxGetApp().GetHelpFile())) { FortyAboutDialog dialog(this, wxID_ANY, wxT("Forty Thieves Instructions")); if (dialog.ShowModal() == wxID_OK) { } } else #endif { About(event); } }
int NinmanMenu::MainMenu() { int y = 220; while (true) { readkey(); if (key[KEY_ESC]) return 0; if (key[KEY_DOWN]) { y = y + 55; if (y > 440) y = 220; } if (key[KEY_UP]) { y = y - 55; if (y < 220) y = 440; } if (key[KEY_ENTER]) { if (y == 220) { std::string player; while (player == "") player = TextBox(); if (player != "-1") NinmanGame(player.c_str()); } if (y == 275) { Score(); y = 220; } if (y == 330) { OptionMenu(); y = 220; } if (y == 385) { About(); y = 220; } if (y == 440) break; clear_keybuf(); } DrawMenu(y); } return 0; }
void Shell::handleEvent( TEvent &event ) { TApplication::handleEvent(event); if (event.what == evCommand) { switch (event.message.command) { case cmAbout: About(); break; case cmTest: Test(); break; default: break; } } }
int main(int argc, char** argv) { int result = getopt(argc, argv, "oabewrdsc:"); int tuple_amount = 3; if (-1 == result) { Usage(); return 0; } switch (result) { case 'a': About(); break; case 'b': Remove(); break; case 'o': Optimize(); break; case 'c': Create(tuple_amount, Convert(optarg)); break; case 'd': Destroy(); break; case 'w': Write(); break; case 'r': Read(); break; case 's': Show(); break; case 'e': Clear(); break; default: Usage(); break; } return 0; }
GuiActivityInventorySheet::GuiActivityInventorySheet(QWidget *parent, PomotuxDatabase& database) : QMainWindow(parent), ui(new Ui::GuiActivityInventorySheet) { mpDatabase = &database; wAbout = new AboutWindow(this); ui->setupUi(this); try { mpAis = new ActivityInventorySheet(select<ActivityInventorySheet>(*(mpDatabase), ActivityInventorySheet::Id == 1).one()); } catch (NotFound e) { mpAis = new ActivityInventorySheet(*(mpDatabase)); mpAis->update(); } this->wTTS = new TodoTodaySheetGui(this,*(this->mpDatabase)); this->wPreferences = new PreferencesDialog (this,*(this->mpDatabase)); this->wModifyActivity = new ModifyAnActivity(this,*(this->mpDatabase),mRow); this->wInsertActivity = new InsertNewActivity(this,*(this->mpDatabase)); // connection of signal required to refresh preferences connect(this->wPreferences,SIGNAL(DatabaseUpdated()),this->wTTS,SLOT(RefreshPreferences())); // connection of signals for refreshing tables connect(this->wTTS,SIGNAL(DatabaseUpdated()),this,SLOT(RefreshTable())); connect(this,SIGNAL(DatabaseUpdated()),this->wTTS,SLOT(RefreshTable())); connect(this,SIGNAL(DatabaseUpdated()),this,SLOT(RefreshTable())); connect(this->wInsertActivity,SIGNAL(DatabaseUpdated()),this,SLOT(RefreshTable())); connect(this->wTTS->getInsertActivity(),SIGNAL(DatabaseUpdated()),this,SLOT(RefreshTable())); connect(this->wModifyActivity,SIGNAL(DatabaseUpdated()),this,SLOT(RefreshTable())); connect(this->wModifyActivity,SIGNAL(DatabaseUpdated()),this->wTTS,SLOT(RefreshTable())); // connection of menu bar actions connect(this->ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(this->ui->actionPreferences,SIGNAL(triggered()),this,SLOT(Preferences())); connect(this->ui->actionAbout,SIGNAL(triggered()),this,SLOT(About())); emit DatabaseUpdated(); this->RefreshTable(); this->ui->ais->setColumnWidth(0, 0); this->ui->ais->setColumnWidth(1, 440); }
void choose()//函数 选择 { char choose_2; printf("==============================================================================="); printf("\n Welcome to the management of student information!\n"); printf("\n a. Look up the information"); printf("\n b. Modification the information"); printf("\n c. Look up teh fraction number"); printf("\n d. Clean the screen"); printf("\n e. About the code monkey"); printf("\n Please enter a,b,c,d or e to choose the thing you want to do : "); scanf("%c", &choose_2); switch (choose_2) { case'a':; break; case'b':Mg(); break; case'c':; break; case'd':; break; case'e':About(); break; } }
Scene::ExitAction Game::runScene(Scene::ExitAction act){ switch (act){ case Scene::ExitAction::RunMainMenu: Log::write("Runnig main menu"); return Menu(window).run(); case Scene::ExitAction::RunPlayModeSelect: Log::write("Running play mode select scene"); return PlayModeSelect(window).run(); case Scene::ExitAction::RunGameVsAI: Log::write("Running battle vs AI"); return BattleVsAI(window, settings.difficulty).run(); case Scene::ExitAction::RunGameVsPlayer: Log::write("Running battle vs Player"); return BattleVsPlayer(window).run(); case Scene::ExitAction::RunOptions: Log::write("Running options"); return Options(window, settings).run(); case Scene::ExitAction::RunAbout: Log::write("Running about"); return About(window).run(); default: throw GameException("No appropriate scene found", "Game::runScene()"); } }
/*---------------------------------------------------------------------------*/ void MainWindow::CreateMenu( void ) { // 创建菜单 QMenu* pOption = new QMenu( tr( "Option" ), this ); QMenu* pAbout = new QMenu( tr( "About" ), this ); pOption->addAction( QIcon( ":/Icons/fullscreenIcon.png" ), tr( "Toggle full screen" ), this, SLOT( ToggleFullScreen( ) ), QKeySequence::FullScreen ); pAbout->addAction( QIcon( ":/Icons/aboutIcon.png" ), tr( "About..." ), this, SLOT( About( ) ), tr( "F1" ) ); pAbout->addAction( QIcon( ":/Icons/qtIcon.png" ), tr( "About Qt..." ), qApp, SLOT( aboutQt( ) ), tr( "F2" ) ); // 在菜单栏中添加菜单 menuBar( )->addMenu( pOption ); menuBar( )->addMenu( pAbout ); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: About(); // attach to process // return FALSE to fail DLL load break; case DLL_PROCESS_DETACH: // detach from process break; case DLL_THREAD_ATTACH: // attach to thread break; case DLL_THREAD_DETACH: // detach from thread break; } return TRUE; // succesful }
/** * Handle a command for this view (override) * @param aCommand command id to be handled */ void CMainView::HandleCommandL( TInt aCommand ) { // [[[ begin generated region: do not modify [Generated Code] TBool commandHandled = EFalse; switch ( aCommand ) { // code to dispatch to the AknView's menu and CBA commands is generated here case EMainViewControlPaneRightId: commandHandled = Hide( aCommand ); break; case EMainView_MenuItemCommand: commandHandled = Change( aCommand ); break; case EMainView_MenuItem1Command: commandHandled = About( aCommand ); break; case EMainView_MenuItem3Command: commandHandled = Exit( aCommand ); break; default: break; } if ( !commandHandled ) { if ( aCommand == EMainViewControlPaneRightId ) { AppUi()->HandleCommandL( EEikCmdExit ); } } // ]]] end generated region [Generated Code] }
guiAbout::guiAbout(const wxString& title, const wxPoint& pos, const wxSize& size, wxWindow * parent) : wxFrame(parent, -1, title, pos, size, wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION) { wxIcon appIcon; appIcon.CopyFromBitmap(wxBitmap(nnim_i_xpm)); SetIcon(appIcon); // Set the icon wxPanel * panel = new wxPanel(this); panel->SetBackgroundColour(*wxWHITE); //wxAutoTextCtrl * tester = new wxAutoTextCtrl(this); wxStaticBitmap * bit_butt = new wxStaticBitmap(panel, ID_CONTACTS_BITMAP_SMALL_LOGO, wxBitmap(nnim_logo_xpm), wxDefaultPosition,wxDefaultSize,wxNO_BORDER); wxSizer * sizer = About(panel, true, true); sizer->SetSizeHints(this); SetSize(sizer->GetMinSize()); Show(TRUE); }
DllExport PF_Err EntryPointFunc ( PF_Cmd cmd, PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output ) { PF_Err err = PF_Err_NONE; switch (cmd) { case PF_Cmd_ABOUT: err = About(in_data,out_data,params,output); break; case PF_Cmd_GLOBAL_SETUP: err = GlobalSetup(in_data,out_data,params,output); break; case PF_Cmd_PARAMS_SETUP: err = ParamsSetup(in_data,out_data,params,output); break; case PF_Cmd_SEQUENCE_SETUP: err = SequenceSetup(in_data,out_data,params,output); break; case PF_Cmd_SEQUENCE_SETDOWN: err = SequenceSetdown(in_data,out_data,params,output); break; case PF_Cmd_SEQUENCE_RESETUP: err = SequenceResetup(in_data,out_data,params,output); break; case PF_Cmd_RENDER: err = Render(in_data,out_data,params,output); break; } return err; }
DeskTopSprite::DeskTopSprite(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags), deltaTime(0), lastTime(0), press(false), bShowMenu(false) { timer.start(); mt = newMT(timeGetTime()); frame = this; ui.setupUi(this); this->setAttribute(Qt::WA_TranslucentBackground);//设置背景透明 this->setWindowTitle(tr("FGDeskTopPet")); reg = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",QSettings::NativeFormat); bool bAutoRun = false; QString path = QApplication::applicationFilePath(); if (reg->value("DeskTopSprite").toString() == path)//判断是否已经注册 bAutoRun = true; trayIcon = new QSystemTrayIcon(this);//创建一个系统托盘图标 trayIcon->setIcon(windowIcon()); trayIcon->show(); act_about = new QAction(tr("关于"), this); act_autoRun = new QAction(tr("开机启动"), this); act_autoRun->setCheckable(true); act_autoRun->setChecked(bAutoRun); act_exit = new QAction(tr("退出"), this); act_systemTray = new QAction(tr("显示系统托盘"), this); act_systemTray->setCheckable(true); act_systemTray->setChecked(trayIcon->isVisible()); menu=new QMenu(this); menu->addAction(act_about); menu->addAction(act_autoRun); menu->addAction(act_systemTray); menu->addAction(act_exit); connect(menu, SIGNAL(aboutToHide()), this, SLOT(AboutToHide())); connect(menu, SIGNAL(aboutToShow()), this, SLOT(AboutToShow())); connect(act_exit, SIGNAL(triggered()), this, SLOT(close())); connect(act_exit, SIGNAL(triggered()), this, SLOT(Close())); connect(act_about, SIGNAL(triggered()), this, SLOT(About())); connect(act_autoRun, SIGNAL(toggled (bool)), this, SLOT(AutoRunCheck(bool))); connect(act_systemTray, SIGNAL(toggled (bool)), this, SLOT(ShowTrayCheck(bool))); //获取当前路径 std::string pathname = GetCerrentDir(); currentDir = pathname.c_str(); std::string luaPath = (pathname + "/script/"); RegisterFunctionToLua(); gLua->GetGlobals().SetString("g_currentPath", pathname.c_str()); int ret = gLua->DoFile((luaPath+"main.luac").c_str()); if (ret) { ret = gLua->DoFile((luaPath+"main.lua").c_str()); } if(ret){ QMessageBox::warning(this, tr("错误!"), tr("脚本加载失败!")); Q_ASSERT(0); } LuaFunctionVoid fun = gLua->GetGlobal("Init"); fun(pathname.c_str()); lastTime = GetTime(); updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(update())); updateTimer->start(1/30.f*1000.f); }
MainWindow::MainWindow() : mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)), mApplications(new ApplicationList(this)), mTranslation(new TranslationHandler(this)), mLogView(NULL), mProject(NULL), mPlatformActions(new QActionGroup(this)), mExiting(false) { mUI.setupUi(this); mUI.mResults->Initialize(mSettings, mApplications); mThread = new ThreadHandler(this); mLogView = new LogView; // Filter timer to delay filtering results slightly while typing mFilterTimer = new QTimer(this); mFilterTimer->setInterval(500); mFilterTimer->setSingleShot(true); connect(mFilterTimer, SIGNAL(timeout()), this, SLOT(FilterResults())); // "Filter" toolbar mLineEditFilter = new QLineEdit(mUI.mToolBarFilter); mLineEditFilter->setPlaceholderText(tr("Quick Filter:")); mUI.mToolBarFilter->addWidget(mLineEditFilter); connect(mLineEditFilter, SIGNAL(textChanged(const QString&)), mFilterTimer, SLOT(start())); connect(mLineEditFilter, SIGNAL(returnPressed()), this, SLOT(FilterResults())); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles())); connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory())); connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(ProgramSettings())); connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(ClearResults())); connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(OpenXML())); connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool))); connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool))); connect(mUI.mActionShowWarnings, SIGNAL(toggled(bool)), this, SLOT(ShowWarnings(bool))); connect(mUI.mActionShowPortability, SIGNAL(toggled(bool)), this, SLOT(ShowPortability(bool))); connect(mUI.mActionShowPerformance, SIGNAL(toggled(bool)), this, SLOT(ShowPerformance(bool))); connect(mUI.mActionShowInformation, SIGNAL(toggled(bool)), this, SLOT(ShowInformation(bool))); connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll())); connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll())); connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults())); connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults())); connect(mUI.mActionShowHidden, SIGNAL(triggered()), mUI.mResults, SLOT(ShowHiddenResults())); connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView())); connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics())); connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck())); connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking())); connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save())); // About menu connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About())); connect(mUI.mActionLicense, SIGNAL(triggered()), this, SLOT(ShowLicense())); // View > Toolbar menu connect(mUI.mActionToolBarMain, SIGNAL(toggled(bool)), this, SLOT(ToggleMainToolBar())); connect(mUI.mActionToolBarView, SIGNAL(toggled(bool)), this, SLOT(ToggleViewToolBar())); connect(mUI.mActionToolBarFilter, SIGNAL(toggled(bool)), this, SLOT(ToggleFilterToolBar())); connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors())); connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone())); connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded())); connect(mUI.mResults, SIGNAL(ResultsHidden(bool)), mUI.mActionShowHidden, SLOT(setEnabled(bool))); connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu())); // File menu connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile())); connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile())); connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile())); connect(mUI.mActionEditProjectFile, SIGNAL(triggered()), this, SLOT(EditProjectFile())); connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents())); LoadSettings(); mThread->Initialize(mUI.mResults); FormatAndSetTitle(); EnableCheckButtons(true); mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); mUI.mActionRecheck->setEnabled(false); EnableProjectOpenActions(true); EnableProjectActions(false); // Must setup MRU menu before CLI param handling as it can load a // project file and update MRU menu. for (int i = 0; i < MaxRecentProjects; ++i) { mRecentProjectActs[i] = new QAction(this); mRecentProjectActs[i]->setVisible(false); connect(mRecentProjectActs[i], SIGNAL(triggered()), this, SLOT(OpenRecentProject())); } mRecentProjectActs[MaxRecentProjects] = NULL; // The separator mUI.mActionProjectMRU->setVisible(false); UpdateMRUMenuItems(); QStringList args = QCoreApplication::arguments(); //Remove the application itself args.removeFirst(); if (!args.isEmpty()) { HandleCLIParams(args); } for (int i = 0; i < mPlatforms.getCount(); i++) { Platform plat = mPlatforms.mPlatforms[i]; QAction *act = new QAction(this); plat.mActMainWindow = act; mPlatforms.mPlatforms[i] = plat; act->setText(plat.mTitle); act->setData(plat.mType); act->setCheckable(true); act->setActionGroup(mPlatformActions); mUI.mMenuCheck->insertAction(mUI.mActionPlatforms, act); connect(act, SIGNAL(triggered()), this, SLOT(SelectPlatform())); } // For Windows platforms default to Win32 checked platform. // For other platforms default to unspecified/default which means the // platform Cppcheck GUI was compiled on. #if defined(_WIN32) Platform &plat = mPlatforms.get(Settings::Win32A); #else Platform &plat = mPlatforms.get(Settings::Unspecified); #endif plat.mActMainWindow->setChecked(true); mSettings->setValue(SETTINGS_CHECKED_PLATFORM, plat.mType); }
MainWindow::MainWindow() : mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)), mApplications(new ApplicationList(this)), mTranslation(new TranslationHandler(this)), mLanguages(new QActionGroup(this)), mLogView(NULL), mHelpWindow(NULL), mProject(NULL), mExiting(false) { mUI.setupUi(this); mUI.mResults->Initialize(mSettings, mApplications); mThread = new ThreadHandler(this); mLogView = new LogView(mSettings); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles())); connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory())); connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(ProgramSettings())); connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(ClearResults())); connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(OpenXML())); connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool))); connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool))); connect(mUI.mActionShowWarnings, SIGNAL(toggled(bool)), this, SLOT(ShowWarnings(bool))); connect(mUI.mActionShowPortability, SIGNAL(toggled(bool)), this, SLOT(ShowPortability(bool))); connect(mUI.mActionShowPerformance, SIGNAL(toggled(bool)), this, SLOT(ShowPerformance(bool))); connect(mUI.mActionShowInformation, SIGNAL(toggled(bool)), this, SLOT(ShowInformation(bool))); connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll())); connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll())); connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults())); connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults())); connect(mUI.mActionShowHidden, SIGNAL(triggered()), mUI.mResults, SLOT(ShowHiddenResults())); connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView())); connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics())); connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck())); connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking())); connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save())); connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About())); connect(mUI.mActionLicense, SIGNAL(triggered()), this, SLOT(ShowLicense())); connect(mUI.mActionToolBarMain, SIGNAL(toggled(bool)), this, SLOT(ToggleMainToolBar())); connect(mUI.mActionToolBarView, SIGNAL(toggled(bool)), this, SLOT(ToggleViewToolBar())); connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors())); connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone())); connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded())); connect(mUI.mResults, SIGNAL(ResultsHidden(bool)), mUI.mActionShowHidden, SLOT(setEnabled(bool))); connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu())); connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile())); connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile())); connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile())); connect(mUI.mActionEditProjectFile, SIGNAL(triggered()), this, SLOT(EditProjectFile())); connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents())); CreateLanguageMenuItems(); LoadSettings(); mThread->Initialize(mUI.mResults); FormatAndSetTitle(); EnableCheckButtons(true); mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); mUI.mActionRecheck->setEnabled(false); EnableProjectOpenActions(true); EnableProjectActions(false); QStringList args = QCoreApplication::arguments(); //Remove the application itself args.removeFirst(); if (!args.isEmpty()) { DoCheckFiles(args); } }
// Windows function of main PaperBack window. LRESULT CALLBACK Mainwp(HWND hw,UINT msg,WPARAM wp,LPARAM lp) { int i,n; char path[MAXPATH],ext[MAXEXT]; HDC dc; PAINTSTRUCT ps; switch (msg) { case WM_CREATE: DragAcceptFiles(hwmain,TRUE); // This window accepts drag-and-drop break; case WM_DESTROY: DragAcceptFiles(hwmain,FALSE); // Close drag-and-drop hwmain=NULL; // Window is no longer available PostQuitMessage(0); break; case WM_CLOSE: CloseTWAINmanager(); DestroyWindow(hw); break; case WM_COMMAND: if (HIWORD(wp)==0) { // Message is from menu switch (LOWORD(wp)) { case M_FILE_OPEN: // Open bitmap file Decodebitmap(NULL); break; case M_FILE_SAVEBMP: // Save file to bitmap if (Selectinfile()==0 && Selectoutbmp()==0) Printfile(infile,outbmp); break; case M_FILE_SELECT: // Select source SelectTWAINsource(); break; case M_FILE_ACQUIRE: // Acquire image(s) OpenTWAINinterface(); Updatebuttons(); break; case M_FILE_PAGE: // Page setup Setuppage(); break; case M_FILE_PRINT: // Print data if (Selectinfile()==0) Printfile(infile,NULL); break; case M_FILE_EXIT: // Close PaperBack DestroyWindow(hw); break; case M_HELP_ABOUT: // Display About window About(); break; default: break; }; }; break; case WM_DROPFILES: n=DragQueryFile((HDROP)wp,0xFFFFFFFF,path,MAXPATH); for (i=0; i<n; i++) { if (DragQueryFile((HDROP)wp,i,path,MAXPATH)>0) { fnsplit(path,NULL,NULL,NULL,ext); if (stricmp(ext,".bmp")==0) // Default action by bitmaps: decode. Addfiletoqueue(path,1); else // Default action by all other files: print. Addfiletoqueue(path,0); ; }; }; DragFinish((HDROP)wp); break; case WM_PAINT: dc=BeginPaint(hw,&ps); // Hey, do we have anything to do here? Background is already OK. EndPaint(hw,&ps); break; default: return DefWindowProc(hw,msg,wp,lp); }; return 0L; };