void MainApp::ReadyToRun() { // make sure we have at least one window open if (fPlayerCount == 0) { MainWin* window = NewWindow(); if (window == NULL) { PostMessage(B_QUIT_REQUESTED); return; } BMessage lastPlaylistArchive; if (_RestoreCurrentPlaylist(&lastPlaylistArchive) == B_OK) { lastPlaylistArchive.what = M_OPEN_PREVIOUS_PLAYLIST; window->PostMessage(&lastPlaylistArchive); } else window->Show(); } // setup the settings window now, we need to have it fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520)); fSettingsWindow->Hide(); fSettingsWindow->Show(); _InstallPlaylistMimeType(); }
bool MainApp::QuitRequested() { // Make sure we store the current playlist, if applicable. for (int32 i = 0; BWindow* window = WindowAt(i); i++) { MainWin* playerWindow = dynamic_cast<MainWin*>(window); if (playerWindow == NULL) continue; BAutolock _(playerWindow); BMessage quitMessage; playerWindow->GetQuitMessage(&quitMessage); // Store the playlist if there is one. If the user has multiple // instances playing audio at the this time, the first instance wins. BMessage playlistArchive; if (quitMessage.FindMessage("playlist", &playlistArchive) == B_OK) { _StoreCurrentPlaylist(&playlistArchive); break; } } // Note: This needs to be done here, SettingsWindow::QuitRequested() // returns "false" always. (Standard BApplication quit procedure will // hang otherwise.) if (fSettingsWindow && fSettingsWindow->Lock()) fSettingsWindow->Quit(); fSettingsWindow = NULL; // store the current file panel ref in the global settings Settings::Default()->SetFilePanelFolder(fLastFilePanelFolder); return BApplication::QuitRequested(); }
void MainWin::PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format) { int64 frames = 0; playTrack->ReadFrames(buffer, &frames); MainWin *window = (MainWin *)cookie; bigtime_t now; if (sp->CurrentTime() < time) now = time + sp->CurrentTime(); else now = time = sp->CurrentTime(); char timestamp[64]; MainWin::Timestamp(timestamp, time); BMessage *update = new BMessage(MSG_UPDATE_PROGRESS); update->AddFloat("current", (float) now); update->AddString("time", timestamp); window->PostMessage(update); if (frames <= 0) { sp->SetHasData(false); window->PostMessage(MSG_NEXT); } }
int main(int argc, char* argv[]) { QApplication app(argc, argv); MainWin win; win.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWin w; w.show(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setStyle("plastique"); MainWin fenetre; fenetre.show(); return app.exec(); }
int main (int argc, char **argv) { QApplication a(argc, argv); MainWin w; w.resize(300,600); w.show(); return a.exec(); }
int main(int argc, char *argv[]) { //setup application QApplication app(argc, argv); //execute app //show Windows MainWin *window; window = new MainWin(); window->show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QApplication::setApplicationName("Redis Desktop Manager"); QApplication::setApplicationVersion("0.6.3-dev"); QApplication::setOrganizationDomain("redisdesktop.com"); MainWin w; w.show(); return a.exec(); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); MainWin win; #ifdef _DEBUG win.show(); #else win.showMaximized(); #endif return app.exec(); }
// TODO: TestModels error. Why? void TestEmanualCmd::test_gui() { int test_gui = 0; if (test_gui){ int argc = 0; char* argv[1] = {0}; QApplication app(argc, argv); MainWin win; win.show(); app.exec(); } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); CrashHandler::instance()->Init(QDir::homePath()); QApplication::setApplicationName("Redis Desktop Manager"); QApplication::setApplicationVersion(RDM_VERSION); QApplication::setOrganizationDomain("redisdesktop.com"); MainWin w; w.show(); return a.exec(); }
int main (int argc, char **argv) { QApplication a(argc, argv); MainWin w; #if QT_VERSION < 0x040000 a.setMainWidget(&w); #endif w.resize(300,600); w.show(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc,argv); MainWin mainWin; cout << "MothDB" << endl; if(mainWin.init() != 0) { app.exit(); } else { mainWin.showWidgets(); mainWin.show(); return app.exec(); } }
void MainApp::RefsReceived(BMessage* message) { // The user dropped a file (or files) on this app's icon, // or double clicked a file that's handled by this app. // Command line arguments are also redirected to here by // ArgvReceived() but without MIME type check. // If multiple refs are received in short succession we // combine them into a single window/playlist. Tracker // will send multiple messages when opening a multi- // selection for example and we don't want to spawn large // numbers of windows when someone just tries to open an // album. We use half a second time and prolong it for // each new ref received. static bigtime_t sLastRefsReceived = 0; static MainWin* sLastRefsWindow = NULL; if (system_time() - sLastRefsReceived < 500000) { // Find the last opened window for (int32 i = CountWindows() - 1; i >= 0; i--) { MainWin* playerWindow = dynamic_cast<MainWin*>(WindowAt(i)); if (playerWindow == NULL) continue; if (playerWindow != sLastRefsWindow) { // The window has changed since the last refs sLastRefsReceived = 0; sLastRefsWindow = NULL; break; } message->AddBool("append to playlist", true); playerWindow->PostMessage(message); sLastRefsReceived = system_time(); return; } } sLastRefsWindow = NewWindow(message); sLastRefsReceived = system_time(); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); int ret = FALSE; WSADATA wsad; ret = WSAStartup(MAKEWORD(2, 2), &wsad); if (ret != 0) { OutputDebugString(_T("WSAStartup failed!\n")); return FALSE; } GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); MWinMgr::Init(hInstance); MWinMgr* mgr = MWinMgr::GetInstance(); MainWin* mainWin = new MainWin(); if (mainWin->Create(NULL)) { mainWin->Show(nCmdShow); mainWin->Update(); mgr->LoadAccelerators(IDC_NBKSHELL); ret = mgr->MainLoop(); } delete mainWin; mgr->Quit(); GdiplusShutdown(gdiplusToken); WSACleanup(); return ret; }
int main( int argc, char **argv ) { qInstallMsgHandler( myMessageOutput ); QApplication app( argc, argv ); MainWin mainWin; QStringList unknown; // very simple parsing (tm) for (int i=1; i<argc; ++i) { if (QString(argv[i]) == "--debug") { mainWin.setConsoleLogging( true ); } else if (QString(argv[i]) == "--print") { mainWin.setConsoleOutput( true ); } else if (QString(argv[i]) == "--help" || QString(argv[i]) == "-?") { printHelp(); } else unknown += argv[i]; } if (unknown.size()) { std::cerr << "Unknown command line options:" << std::endl; for (int i=0; i<unknown.size(); ++i) { std::cerr << " " << unknown[i].latin1() << std::endl; } printHelp(); } app.setMainWidget( &mainWin ); mainWin.show(); mainWin.move( 100, 100 ); return app.exec(); }
/** * Windows callback to handle window-specific events */ void MainWin::window_cb( Widget*w, void* data) { MainWin* mw; switch( Fl::event() ) { case FL_CLOSE: mw = (MainWin*) data; mw->close_cb_i(); break; case FL_SHORTCUT: if( (Fl::event_key() == FL_Escape) ) break; default: //cout << Fl::event() << "< fl mainwin event" <<endl; break; } }
int main(int argc, char *argv[]) { /* At least on Linux, we have to initialize SDL video subsystem prior to * creating/initializing QApplication, otherwise we'll segfault miserably * in SDL_CreateWindow(). Here's a stack trace if you're interested: Thread [7] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.) 13 XCreateIC() 12 SetupWindowData() 11 X11_CreateWindow() 10 SDL_CreateWindow() .. */ if ( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 ) { printf("Unable to init SDL: %s\n", SDL_GetError()); return 1; } QApplication app(argc, argv); MainWin win; win.show(); if (!win.initStack()) { win.quit(); return 1; } /* We want to be registrar too! */ if (pjsua_get_pjsip_endpt()) { pjsip_endpt_register_module(pjsua_get_pjsip_endpt(), &mod_default_handler); } return app.exec(); }
int main( int argc, char **argv ) { qInstallMsgHandler( myMessageOutput ); QApplication app( argc, argv ); MainWin mainWin; // very simple parsing (tm) for (int i=0; i<argc; ++i) { if (QString(argv[i]) == "--console") { mainWin.setConsoleLogging( true ); break; } } app.setMainWidget( &mainWin ); mainWin.show(); mainWin.move( 100, 100 ); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setOrganizationName("btbn.de"); app.setOrganizationDomain("btbn.de"); app.setApplicationName("TwitchWatcher"); qsrand((uint)QTime::currentTime().msec()); try { MainWin win; win.show(); return app.exec(); } catch(const std::exception &e) { QMessageBox::critical(nullptr, "Exception occured!", e.what()); } return -1; }
void MainWin::open_lm_cb( Widget* w, void* data) { MainWin* mw = (MainWin*) data; mw->open_lm_cb_i(); }
void MainWin::today_cb(Widget*, void* data) { MainWin* mw = (MainWin*) data; mw->today_cb_i(); }
void MainWin::back_cb(Widget*, void* data) { MainWin* mw = (MainWin*) data; mw->back_cb_i(); }
void MainApp::MessageReceived(BMessage* message) { switch (message->what) { case M_NEW_PLAYER: { MainWin* window = NewWindow(); if (window != NULL) window->Show(); break; } case M_PLAYER_QUIT: { // store the window settings of this instance MainWin* window = NULL; bool audioOnly = false; BRect windowFrame; bigtime_t creationTime; if (message->FindPointer("instance", (void**)&window) == B_OK && message->FindBool("audio only", &audioOnly) == B_OK && message->FindRect("window frame", &windowFrame) == B_OK && message->FindInt64("creation time", &creationTime) == B_OK) { if (audioOnly && (!fAudioWindowFrameSaved || creationTime < fLastSavedAudioWindowCreationTime)) { fAudioWindowFrameSaved = true; fLastSavedAudioWindowCreationTime = creationTime; Settings::Default()->SetAudioPlayerWindowFrame(windowFrame); } } // Store the playlist if there is one. Since the app is doing // this, it is "atomic". If the user has multiple instances // playing audio at the same time, the last instance which is // quit wins. BMessage playlistArchive; if (message->FindMessage("playlist", &playlistArchive) == B_OK) _StoreCurrentPlaylist(&playlistArchive); // quit if this was the last player window fPlayerCount--; if (fPlayerCount == 0) PostMessage(B_QUIT_REQUESTED); break; } case B_SOME_APP_LAUNCHED: case B_SOME_APP_QUIT: { const char* mimeSig; if (message->FindString("be:signature", &mimeSig) < B_OK) break; bool isMediaServer = strcmp(mimeSig, kMediaServerSig) == 0; bool isAddonServer = strcmp(mimeSig, kMediaServerAddOnSig) == 0; if (!isMediaServer && !isAddonServer) break; bool running = (message->what == B_SOME_APP_LAUNCHED); if (isMediaServer) fMediaServerRunning = running; if (isAddonServer) fMediaAddOnServerRunning = running; if (!fMediaServerRunning && !fMediaAddOnServerRunning) { fprintf(stderr, "media server has quit.\n"); // trigger closing of media nodes BMessage broadcast(M_MEDIA_SERVER_QUIT); _BroadcastMessage(broadcast); } else if (fMediaServerRunning && fMediaAddOnServerRunning) { fprintf(stderr, "media server has launched.\n"); // HACK! // quit our now invalid instance of the media roster // so that before new nodes are created, // we get a new roster (it is a normal looper) // TODO: This functionality could become part of // BMediaRoster. It could detect the start/quit of // the servers like it is done here, and either quit // itself, or re-establish the connection, and send some // notification to the app... something along those lines. BMediaRoster* roster = BMediaRoster::CurrentRoster(); if (roster) { roster->Lock(); roster->Quit(); } // give the servers some time to init... snooze(3000000); // trigger re-init of media nodes BMessage broadcast(M_MEDIA_SERVER_STARTED); _BroadcastMessage(broadcast); } break; } case M_SETTINGS: _ShowSettingsWindow(); break; case M_SHOW_OPEN_PANEL: _ShowOpenFilePanel(message); break; case M_SHOW_SAVE_PANEL: _ShowSaveFilePanel(message); break; case M_OPEN_PANEL_RESULT: _HandleOpenPanelResult(message); break; case M_SAVE_PANEL_RESULT: _HandleSavePanelResult(message); break; case B_CANCEL: { // The user canceled a file panel, but store at least the current // file panel folder. uint32 oldWhat; if (message->FindInt32("old_what", (int32*)&oldWhat) != B_OK) break; if (oldWhat == M_OPEN_PANEL_RESULT && fOpenFilePanel != NULL) fOpenFilePanel->GetPanelDirectory(&fLastFilePanelFolder); else if (oldWhat == M_SAVE_PANEL_RESULT && fSaveFilePanel != NULL) fSaveFilePanel->GetPanelDirectory(&fLastFilePanelFolder); break; } default: BApplication::MessageReceived(message); break; } }
void MainWin::prev_cb( Widget* w, void* data ) { MainWin* mw = (MainWin*) data; mw->prev_cb_i(); }
void MainWin::daym_cb( Widget* w, void*data) { MainWin* mw = (MainWin*) data; mw->daym_cb_i(); }
void MainWin::weekm_cb( Widget*w, void* data) { MainWin* mw = (MainWin*) data; mw->weekm_cb_i(); }
void MainWin::monthm_cb( Widget* w, void* data) { MainWin* mw = (MainWin*) data; mw->monthm_cb_i(); }
void MainWin::new_cb( Widget*, void* data ) { MainWin* mw = (MainWin*) data; mw->new_cb_i(); }