Kludget::Kludget(KClient *parent) : QObject(parent), client(parent), window(new KWindow), settings(new KSettings(this)), system(new KSystem(this)), prefWindow(0), aboutWindow(0), firstShow(true) { setObjectName("Kludget"); settings->setRootKey("kludget"); connect(system, SIGNAL(execUpdate(long)), this, SLOT(onSystemExecUpdate(long))); connect(system, SIGNAL(execFinish(long)), this, SLOT(onSystemExecFinish(long))); connect(window, SIGNAL(destroyed()), this, SLOT(onWindowDestroyed())); connect(window, SIGNAL(onShow()), this, SLOT(onShow())); connect(window, SIGNAL(onHide()), this, SLOT(onHide())); connect(window, SIGNAL(onStartDrag()), this, SLOT(onStartDrag())); connect(window, SIGNAL(onEndDrag()), this, SLOT(onEndDrag())); connect(window, SIGNAL(onSettingsChanged()), this, SLOT(onSettingsChanged())); connect(window->view(), SIGNAL(contextMenuRequested()), this, SLOT(onContextMenu())); connect(window->view(), SIGNAL(urlReceived(const QUrl*)), this, SLOT(onUrlReceived(const QUrl*))); connect(window->view()->page(), SIGNAL(loadFinished(bool)), this, SLOT(show())); connect(window->view()->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared())); connect(window->view()->page(), SIGNAL(frameCreated(QWebFrame*)), this, SLOT(onFrameCreated(QWebFrame*))); connect(this, SIGNAL(evaluate(const QString &)), this, SLOT(onEvaluate(const QString &))); connect(&customMenuMapper, SIGNAL(mapped(const QString &)), this, SIGNAL(evaluate(const QString &))); connect(&ipcClient, SIGNAL(messageReceived(QString,QString,QString)), this, SLOT(messageReceived(QString,QString,QString))); KLog::log("Kludget::created"); }
void BleMainWindow::activated(QSystemTrayIcon::ActivationReason reason) { switch (reason) { case QSystemTrayIcon::Context: { QMenu menu; menu.addAction(tr("show"), this, SLOT(onShow())); menu.addAction(tr("hide"), this, SLOT(hide())); menu.addAction(tr("quit"), this, SLOT(onClose())); QPoint globalPoint = QCursor::pos(); menu.exec(globalPoint); break; } case QSystemTrayIcon::DoubleClick: case QSystemTrayIcon::Trigger: default: if (!isVisible()) { onShow(); } else { hide(); } break; } }
Dashboard::Dashboard(QWidget *parent) : QMainWindow(parent) , d_ptr(new DashboardPrivate(this)) { setWindowTitle("Maliit Keyboard Viewer"); resize(854, 480); QGraphicsView *v = new QGraphicsView; v->setScene(new QGraphicsScene(v)); v->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); v->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setCentralWidget(v); v->show(); QWidget *w = 0; d_ptr->proxy_widget = v->scene()->addWidget(w = new QWidget); d_ptr->proxy_widget->setTransformOriginPoint(d_ptr->proxy_widget->geometry().center()); w->resize(size()); QVBoxLayout *vbox = d_ptr->vbox; w->setLayout(vbox); QSpacerItem *top_spacer = d_ptr->top; vbox->addItem(top_spacer); QWidget *buttons = d_ptr->buttons; buttons->show(); vbox->addWidget(buttons); QHBoxLayout *hbox = new QHBoxLayout; buttons->setLayout(hbox); QPushButton *show = new QPushButton("Show virtual keyboard"); connect(show, SIGNAL(clicked()), this, SLOT(onShow())); hbox->addWidget(show); show->show(); QPushButton *orientation_changed = new QPushButton("Change orientation"); connect(orientation_changed, SIGNAL(clicked()), this, SLOT(onOrientationChangeClicked())); hbox->addWidget(orientation_changed); orientation_changed->show(); QPushButton *close = new QPushButton("Close application"); connect(close, SIGNAL(clicked()), qApp, SLOT(quit())); hbox->addWidget(close); close->show(); QTextEdit *te = d_ptr->text_entry; vbox->addWidget(te); te->show(); te->setFocus(); QSpacerItem *bottom_spacer = d_ptr->bottom; vbox->addItem(bottom_spacer); onShow(); }
PopupTooltip::PopupTooltip() : TWidget(0) , _shower(0) , _st(0) { PopupTooltipInstance = this; setWindowFlags(Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::ToolTip | Qt::NoDropShadowWindowHint); setAttribute(Qt::WA_NoSystemBackground, true); _showTimer.setSingleShot(true); connect(&_showTimer, SIGNAL(timeout()), this, SLOT(onShow())); }
void Dashboard::onOrientationChangeClicked() { Q_D(Dashboard); d->orientation = (d->orientation == Logic::Layout::Landscape ? Logic::Layout::Portrait : Logic::Layout::Landscape); static_cast<QGraphicsView *>(centralWidget())->rotate(d->orientation == Logic::Layout::Landscape ? 90 : 270); const QSize &s(centralWidget()->size()); d->proxy_widget->resize(d->orientation == Logic::Layout::Landscape ? s : QSize(s.height(), s.width())); onShow(); Q_EMIT orientationChanged(d->orientation); }
bool DlgPreferences::eventFilter(QObject* o, QEvent* e) { // Send a close signal if dialog is closing if (e->type() == QEvent::Hide) { onHide(); } if (e->type() == QEvent::Show) { onShow(); } // Standard event processing return QWidget::eventFilter(o,e); }
void GuiElement::setVisible(bool is_visible) { if(visible != is_visible) { visible = is_visible; if(visible) onShow(); else onHide(); } //Else do nothing -- already correct visibility }
//-----------------------------------------// void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason reason) { if(reason == QSystemTrayIcon::DoubleClick) { if(isVisible() == true) { onHide(); } else { onShow(); } } }
//-----------------------------------------// MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent, Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui_(std::unique_ptr<Ui::MainWindow>(new Ui::MainWindow)), armsManager_(std::unique_ptr<ArmsManager>(new ArmsManager())), remoteDevicesManager_(std::unique_ptr<RemoteDevicesManager>(new RemoteDevicesManager())) { ui_->setupUi(this); setWindowTitle(QApplication::applicationName()); setWindowIcon(QApplication::windowIcon()); // tray connect(&tray_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onTrayActivated(QSystemTrayIcon::ActivationReason))); menu_.addAction(tr("Открыть"),this,SLOT(onShow()))->setVisible(false); menu_.setDefaultAction(menu_.addAction(tr("Спрятать"),this,SLOT(onHide()))); menu_.addSeparator(); // menu_.addAction(tr("Лог"),this,SLOT(onShowLog())); // menu_.addAction(tr("Выход"),this,SLOT(onExit())); menu_.addSeparator(); tray_.setContextMenu(&menu_); // movia_.stop(); // movia_.setFileName(":/new/list/LAN.png"); // movia_.start(); // tray_.setIcon(QIcon(movia_.currentPixmap())); tray_.setIcon(QIcon(":/new/list/LAN.png")); tray_.show(); onHide(); assert(armsManager_); armsManager_->init(); tray_.showMessage(QApplication::applicationName(), tr("Программа запущена: порт %1").arg(Settings::value("server/port").toUInt())); }
bool ConfirmLayer::init() { if ( !InfoLayer::init() ) { return false; } onShow([&](const std::string content, const std::function<void()>& ok,const std::function<void()>& cancle){ InfoLayer::emitShow(content); if(ok){ buttonOK->onPushed(ok); buttonOK->onPushed([&](){ this->emitClose(); }); } if(cancle){ buttonClose->onPushed(cancle); } buttonClose->onPushed([&](){ this->emitClose(); }); }); buttonClose->removeFromParentAndCleanup(true); buttonClose = WidgetUtils::createTTFButton(" Thôi ",Size(90,0),nullptr); buttonOK = WidgetUtils::createTTFButton("Đồng ý",Size(90,0),nullptr); buttonClose->setPosition(Point(background->getContentSize().width/2+buttonClose->getContentSize().width/2,0)); buttonOK->setPosition(Point(background->getContentSize().width/2-buttonOK->getContentSize().width/2,0)); background->addChild(buttonClose); background->addChild(buttonOK); return true; }
void DlgMissing::clicked() { // all marked tracks are gone now anyway onShow(); }
void MyWidget::myVFunc(QString srt) { onShow(3, 4); }
void SDL2Window::hide() { SDL_HideWindow(m_window); onShow(false); }
void SDL2Window::tick() { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_WINDOWEVENT: { switch(event.window.event) { case SDL_WINDOWEVENT_SHOWN: onShow(true); break; case SDL_WINDOWEVENT_HIDDEN: onShow(false); break; case SDL_WINDOWEVENT_EXPOSED: onPaint(); break; case SDL_WINDOWEVENT_MINIMIZED: onMinimize(); break; case SDL_WINDOWEVENT_MAXIMIZED: onMaximize(); break; case SDL_WINDOWEVENT_RESTORED: onRestore(); break; case SDL_WINDOWEVENT_FOCUS_GAINED: onFocus(true); break; case SDL_WINDOWEVENT_FOCUS_LOST: onFocus(false); break; case SDL_WINDOWEVENT_MOVED: { onMove(event.window.data1, event.window.data2); break; } case SDL_WINDOWEVENT_SIZE_CHANGED: { Vec2i newSize(event.window.data1, event.window.data2); if(newSize != m_size && !m_fullscreen) { m_renderer->beforeResize(false); updateSize(); } else { // SDL regrettably sends resize events when a fullscreen window // is minimized - we'll have none of that! } break; } case SDL_WINDOWEVENT_CLOSE: { // The user has requested to close a single window // TODO we only support one main window for now break; } } break; } case SDL_QUIT: { // The user has requested to close the whole program // TODO onDestroy() fits SDL_WINDOWEVENT_CLOSE better, but SDL captures Ctrl+C // evenst and *only* sends the SDL_QUIT event for them while normal close // generates *both* SDL_WINDOWEVENT_CLOSE and SDL_QUIT onDestroy(); return; // abort event loop! } } if(m_input) { m_input->onEvent(event); } } if(!m_renderer->isInitialized()) { updateSize(); m_renderer->afterResize(); m_renderer->SetViewport(Rect(m_size.x, m_size.y)); } }
bool SDL2Window::initialize() { arx_assert(!m_displayModes.empty()); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); #if ARX_PLATFORM == ARX_PLATFORM_WIN32 // Used on Windows to prevent software opengl fallback. // The linux situation: // Causes SDL to require visuals without caveats. // On linux some drivers only supply multisample capable GLX Visuals // with a GLX_NON_CONFORMANT_VISUAL_EXT caveat. // see: https://www.opengl.org/registry/specs/EXT/visual_rating.txt SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); #endif // TODO EGL and core profile are not supported yet SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); if(gldebug::isEnabled()) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); } int x = SDL_WINDOWPOS_UNDEFINED, y = SDL_WINDOWPOS_UNDEFINED; Uint32 windowFlags = getSDLFlagsForMode(m_size, m_fullscreen); windowFlags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN; for(int msaa = m_maxMSAALevel; msaa > 0; msaa--) { bool lastTry = (msaa == 1); // Cleanup context and window from previous tries if(m_glcontext) { SDL_GL_DeleteContext(m_glcontext); m_glcontext = NULL; } if(m_window) { SDL_DestroyWindow(m_window); m_window = NULL; } SDL_ClearError(); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, msaa > 1 ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa > 1 ? msaa : 0); m_window = SDL_CreateWindow(m_title.c_str(), x, y, m_size.x, m_size.y, windowFlags); if(!m_window) { if(lastTry) { LogError << "Could not create window: " << SDL_GetError(); return false; } continue; } m_glcontext = SDL_GL_CreateContext(m_window); if(!m_glcontext) { if(lastTry) { LogError << "Could not create GL context: " << SDL_GetError(); return false; } continue; } // Verify that the MSAA setting matches what was requested int msaaEnabled, msaaValue; SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &msaaEnabled); SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaaValue); if(!lastTry) { if(!msaaEnabled || msaaValue < msaa) { continue; } } if(msaaEnabled) { m_MSAALevel = msaaValue; } else { m_MSAALevel = 0; } // Verify that we actually got an accelerated context (void)glGetError(); // clear error flags GLint texunits = 0; glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texunits); if(glGetError() != GL_NO_ERROR || texunits < GLint(m_minTextureUnits)) { if(lastTry) { LogError << "Not enough GL texture units available: have " << texunits << ", need at least " << m_minTextureUnits; return false; } continue; } // All good const char * system = "(unknown)"; { ARX_SDL_SysWMinfo info; info.version.major = 2; info.version.minor = 0; info.version.patch = 4; if(SDL_GetWindowWMInfo(m_window, reinterpret_cast<SDL_SysWMinfo *>(&info))) { switch(info.subsystem) { case ARX_SDL_SYSWM_UNKNOWN: break; case ARX_SDL_SYSWM_WINDOWS: system = "Windows"; break; case ARX_SDL_SYSWM_X11: system = "X11"; break; #if SDL_VERSION_ATLEAST(2, 0, 3) case ARX_SDL_SYSWM_WINRT: system = "WinRT"; break; #endif case ARX_SDL_SYSWM_DIRECTFB: system = "DirectFB"; break; case ARX_SDL_SYSWM_COCOA: system = "Cocoa"; break; case ARX_SDL_SYSWM_UIKIT: system = "UIKit"; break; #if SDL_VERSION_ATLEAST(2, 0, 2) case ARX_SDL_SYSWM_WAYLAND: system = "Wayland"; break; case ARX_SDL_SYSWM_MIR: system = "Mir"; break; #endif #if SDL_VERSION_ATLEAST(2, 0, 4) case ARX_SDL_SYSWM_ANDROID: system = "Android"; break; #endif } } } int red = 0, green = 0, blue = 0, alpha = 0, depth = 0, doublebuffer = 0; SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &red); SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &green); SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blue); SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &alpha); SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth); SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer); LogInfo << "Window: " << system << " r:" << red << " g:" << green << " b:" << blue << " a:" << alpha << " depth:" << depth << " aa:" << msaa << "x" << " doublebuffer:" << doublebuffer; break; } // Use the executable icon for the window #if ARX_PLATFORM == ARX_PLATFORM_WIN32 { SDL_SysWMinfo info; SDL_VERSION(&info.version); if(SDL_GetWindowWMInfo(m_window, &info) && info.subsystem == SDL_SYSWM_WINDOWS) { platform::WideString filename; filename.allocate(filename.capacity()); while(true) { DWORD size = GetModuleFileNameW(NULL, filename.data(), filename.size()); if(size < filename.size()) { filename.resize(size); break; } filename.allocate(filename.size() * 2); } HICON largeIcon = 0; HICON smallIcon = 0; ExtractIconExW(filename, 0, &largeIcon, &smallIcon, 1); if(smallIcon) { SendMessage(info.info.win.window, WM_SETICON, ICON_SMALL, LPARAM(smallIcon)); } if(largeIcon) { SendMessage(info.info.win.window, WM_SETICON, ICON_BIG, LPARAM(largeIcon)); } } } #endif setVSync(m_vsync); SDL_ShowWindow(m_window); SDL_ShowCursor(SDL_DISABLE); m_renderer->initialize(); onCreate(); onToggleFullscreen(m_fullscreen); updateSize(true); onShow(true); onFocus(true); return true; }
void DropDownList::show(bool in_place, wxPoint pos, RealRect* rect) { if (IsShown()) return; onShow(); // find selection selected_item = selection(); // width size_t count = itemCount(); if (item_size.width == 100) { // not initialized wxClientDC dc(this); dc.SetFont(*wxNORMAL_FONT); for (size_t i = 0 ; i < count ; ++i) { int text_width; dc.GetTextExtent(capitalize(itemText(i)), &text_width, 0); item_size.width = max(item_size.width, text_width + icon_size.width + 14); // 14 = room for popup arrow + padding } } // height int line_count = 0; for (size_t i = 0 ; i < count ; ++i) if (lineBelow(i)) line_count += 1; // size RealSize border_size(2,2); // GetClientSize() - GetSize(), assume 1px borders RealSize size( item_size.width + marginW * 2, item_size.height * count + marginH * 2 + line_count ); // placement int parent_height = 0; if (!in_place && viewer) { // Position the drop down list below the editor control (based on the style) Rotation rot = viewer->viewer.getRotation(); Rotater rr(rot, viewer->getRotation()); RealRect r = rot.trRectToBB(rect ? *rect : rot.getInternalRect()); if (viewer->viewer.nativeLook()) { pos = RealPoint(r.x - 3, r.y - 3); size.width = max(size.width, r.width + 6); parent_height = (int)r.height + 6; } else { pos = RealPoint(r.x - 1, r.y - 1); parent_height = (int)r.height; } } else if (parent_menu) { parent_height = -(int)item_size.height - 1; } pos = GetParent()->ClientToScreen(pos); // virtual size = item size RealSize virtual_size = size; SetVirtualSize(virtual_size); item_size.width = virtual_size.width - marginW * 2; // is there enough room for all items, or do we need a scrollbar? int room_below = wxGetDisplaySize().y - border_size.height - pos.y - parent_height - 50; int max_height = max(300, room_below); if (size.height > max_height) { size.height = max_height; size.width += wxSystemSettings::GetMetric(wxSYS_VSCROLL_ARROW_X); // width of scrollbar SetScrollbar(wxVERTICAL, 0, size.height, virtual_size.height, false); } else { SetScrollbar(wxVERTICAL,0,0,0,false); } // move & resize SetSize(add_diagonal(size, border_size)); Position(pos, wxSize(0, parent_height)); // visible item visible_start = 0; ensureSelectedItemVisible(); // set event handler if (hider) { assert(hider2); wxGetTopLevelParent(GetParent())->PushEventHandler(hider); GetParent() ->PushEventHandler(hider2); } // show if (selected_item == NO_SELECTION && itemCount() > 0) selected_item = 0; // select first item by default mouse_down = false; close_on_mouse_out = false; wxPopupWindow::Show(); if (isRoot() && GetParent()->HasCapture()) { // release capture on parent GetParent()->ReleaseMouse(); } // fix drop down arrow redrawArrowOnParent(); }
void SDL2Window::tick() { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_WINDOWEVENT: { switch(event.window.event) { case SDL_WINDOWEVENT_SHOWN: onShow(true); break; case SDL_WINDOWEVENT_HIDDEN: onShow(false); break; case SDL_WINDOWEVENT_EXPOSED: onPaint(); break; case SDL_WINDOWEVENT_MINIMIZED: onMinimize(); break; case SDL_WINDOWEVENT_MAXIMIZED: onMaximize(); break; case SDL_WINDOWEVENT_RESTORED: onRestore(); break; case SDL_WINDOWEVENT_FOCUS_GAINED: onFocus(true); break; case SDL_WINDOWEVENT_FOCUS_LOST: onFocus(false); break; case SDL_WINDOWEVENT_MOVED: { onMove(event.window.data1, event.window.data2); break; } case SDL_WINDOWEVENT_SIZE_CHANGED: { Vec2i newSize(event.window.data1, event.window.data2); if(newSize != m_size && !m_fullscreen) { m_renderer->beforeResize(false); updateSize(); } else { // SDL regrettably sends resize events when a fullscreen window // is minimized - we'll have none of that! } break; } case SDL_WINDOWEVENT_CLOSE: { // The user has requested to close a single window // TODO we only support one main window for now break; } } break; } #if ARX_PLATFORM == ARX_PLATFORM_WIN32 case SDL_KEYDOWN: { // SDL2 is still eating our ALT+F4 under windows... // See bug report here: https://bugzilla.libsdl.org/show_bug.cgi?id=1555 if(event.key.keysym.sym == SDLK_F4 && (event.key.keysym.mod & KMOD_ALT) != KMOD_NONE) { SDL_Event quitevent; quitevent.type = SDL_QUIT; SDL_PushEvent(&quitevent); } break; } #endif case SDL_QUIT: { // The user has requested to close the whole program // TODO onDestroy() fits SDL_WINDOWEVENT_CLOSE better, but SDL captures Ctrl+C // evenst and *only* sends the SDL_QUIT event for them while normal close // generates *both* SDL_WINDOWEVENT_CLOSE and SDL_QUIT onDestroy(); return; // abort event loop! } } if(m_input) { m_input->onEvent(event); } } if(!m_renderer->isInitialized()) { updateSize(); m_renderer->afterResize(); m_renderer->SetViewport(Rect(m_size.x, m_size.y)); } }
void Win32Window::hide() { ShowWindow(m_hWnd, SW_MINIMIZE | SW_HIDE); onShow(false); }
void SDLWindow::hide() { SDL_WM_IconifyWindow(); onShow(false); }
void Dialog::show() { view->dialog = this; onShow(); }
int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("SRFGames"); QCoreApplication::setOrganizationDomain("sol-online.org"), QCoreApplication::setApplicationName("TrackYourTime"); #ifdef Q_OS_MAC QDir dir(argv[0]); dir.cdUp(); QString currentDir = dir.absolutePath(); dir.cdUp(); dir.cd("PlugIns"); QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath())); #endif QApplication a(argc, argv); QApplication::setQuitOnLastWindowClosed(false); #ifdef Q_OS_MAC QDir::setCurrent(currentDir); #endif qDebug() << "application start\n"; cSettings settings; QString Language = QLocale::system().name(); Language.truncate(Language.lastIndexOf('_')); Language = settings.db()->value(cDataManager::CONF_LANGUAGE_ID,Language).toString(); if (settings.db()->value(cDataManager::CONF_FIRST_LAUNCH_ID,true).toBool()){ settings.db()->setValue(cDataManager::CONF_FIRST_LAUNCH_ID,false); settings.db()->setValue(cDataManager::CONF_LANGUAGE_ID,Language); settings.db()->setValue(cDataManager::CONF_AUTORUN_ID,true); setAutorun(); settings.db()->sync(); } qDebug() << "laod translation\n"; QTranslator translator; translator.load("lang_" + Language,QDir::currentPath()+"/data/languages"); QApplication::installTranslator(&translator); qDebug() << "init datamanager\n"; cDataManager datamanager; qDebug() << "init schedule\n"; cSchedule schedule(&datamanager); qDebug() << "init updater\n"; cUpdater updater; QObject::connect(&schedule,SIGNAL(checkUpdates()),&updater,SLOT(checkUpdates())); qDebug() << "init tray icon\n"; cTrayIcon trIcon(&datamanager); QObject::connect(&datamanager, SIGNAL(trayActive()), &trIcon, SLOT(setActive())); QObject::connect(&datamanager, SIGNAL(traySleep()), &trIcon, SLOT(setInactive())); QObject::connect(&datamanager, SIGNAL(trayShowHint(QString)), &trIcon, SLOT(showHint(QString))); QObject::connect(&datamanager, SIGNAL(profilesChanged()), &trIcon, SLOT(onProfilesChange())); qDebug() << "init applications window\n"; ApplicationsWindow applicationsWindow(&datamanager); QObject::connect(&trIcon, SIGNAL(showApplications()), &applicationsWindow, SLOT(showNormal())); QObject::connect(&datamanager, SIGNAL(profilesChanged()), &applicationsWindow, SLOT(onProfilesChange())); QObject::connect(&datamanager, SIGNAL(applicationsChanged()), &applicationsWindow, SLOT(onApplicationsChange())); qDebug() << "init profiles window\n"; ProfilesWindow profilesWindow(&datamanager); QObject::connect(&applicationsWindow, SIGNAL(showProfiles()), &profilesWindow, SLOT(showNormal())); qDebug() << "init app settings window\n"; App_SettingsWindow app_settingsWindow(&datamanager); QObject::connect(&applicationsWindow, SIGNAL(showAppSettings(int)), &app_settingsWindow, SLOT(showApp(int))); QObject::connect(&datamanager, SIGNAL(debugScriptResult(QString,sSysInfo)), &app_settingsWindow, SLOT(onScriptResult(QString,sSysInfo))); qDebug() << "init settings window\n"; SettingsWindow settingsWindow(&datamanager); QObject::connect(&trIcon, SIGNAL(showSettings()), &settingsWindow, SLOT(showNormal())); QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &datamanager, SLOT(onPreferencesChanged())); qDebug() << "init schedule window\n"; ScheduleWindow scheduleWindow(&datamanager,&schedule); QObject::connect(&datamanager, SIGNAL(profilesChanged()), &scheduleWindow, SLOT(rebuild())); QObject::connect(&trIcon, SIGNAL(showSchedule()), &scheduleWindow, SLOT(showNormal())); qDebug() << "init statistic window\n"; StatisticWindow statisticWindow(&datamanager); QObject::connect(&trIcon, SIGNAL(showStatistic()), &statisticWindow, SLOT(showNormal())); qDebug() << "init about window\n"; AboutWindow aboutWindow; QObject::connect(&trIcon, SIGNAL(showAbout()), &aboutWindow, SLOT(showNormal())); qDebug() << "init update window\n"; UpdateAvailableWindow updateAvailableWindow; QObject::connect(&updater, SIGNAL(newVersionAvailable(QString)), &updateAvailableWindow, SLOT(showUpdate(QString))); QObject::connect(&updateAvailableWindow, SIGNAL(ignoreUpdate()), &updater, SLOT(ignoreNewVersion())); qDebug() << "init notification window\n"; NotificationWindow notificationWindow(&datamanager); QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), ¬ificationWindow, SLOT(onPreferencesChanged())); QObject::connect(&datamanager, SIGNAL(showNotification()), ¬ificationWindow, SLOT(onShow())); qDebug() << "start schedule\n"; schedule.start(); qDebug() << "start app loop\n"; int result = a.exec(); qDebug() << "application close\n"; return result; }
void DlgHidden::clicked() { // all marked tracks are gone now anyway onShow(); }
void Kludget::show() { onShow(); window->show(); }
bool SDLWindow::initialize(const std::string & title, Vec2i size, bool fullscreen, unsigned depth) { arx_assert(!displayModes.empty()); SDL_SetEventFilter(eventFilter); SDL_EventState(SDL_ACTIVEEVENT, SDL_ENABLE); SDL_EventState(SDL_QUIT, SDL_ENABLE); SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE); SDL_EventState(SDL_VIDEOEXPOSE, SDL_ENABLE); SDL_EventState(SDL_USEREVENT, SDL_IGNORE); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, config.video.vsync ? 1 : 0); size_ = Vec2i_ZERO; depth_ = 0; for(int msaa = config.video.antialiasing ? 8 : 1; msaa >= 0; msaa--) { if(msaa > 1) { SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa); } else if(msaa > 0) { SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); } else { LogError << "Failed to initialize SDL Window: " << SDL_GetError(); return false; } if(setMode(DisplayMode(size, fullscreen ? depth : 0), fullscreen)) { break; } } isFullscreen_ = fullscreen; SDL_WM_SetCaption(title.c_str(), title.c_str()); title_ = title; SDL_ShowCursor(SDL_DISABLE); onCreate(); renderer = new OpenGLRenderer; renderer->Initialize(); updateSize(false); onShow(true); onFocus(true); onRendererInit(); return true; }
bool SDL2Window::initialize() { arx_assert(!m_displayModes.empty()); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); // We need an accelerated OpenGL context or we'll likely fail later SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // TODO EGL and core profile are not supported yet SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 0); if(gldebug::isEnabled()) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); } int x = SDL_WINDOWPOS_UNDEFINED, y = SDL_WINDOWPOS_UNDEFINED; Uint32 windowFlags = getSDLFlagsForMode(m_size, m_fullscreen); windowFlags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN; for(int msaa = m_maxMSAALevel; msaa > 0; msaa--) { bool lastTry = (msaa == 1); // Cleanup context and window from previous tries if(m_glcontext) { SDL_GL_DeleteContext(m_glcontext); m_glcontext = NULL; } if(m_window) { SDL_DestroyWindow(m_window); m_window = NULL; } SDL_ClearError(); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, msaa > 1 ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa > 1 ? msaa : 0); m_window = SDL_CreateWindow(m_title.c_str(), x, y, m_size.x, m_size.y, windowFlags); if(!m_window) { if(lastTry) { LogError << "Could not create window: " << SDL_GetError(); return false; } continue; } m_glcontext = SDL_GL_CreateContext(m_window); if(!m_glcontext) { if(lastTry) { LogError << "Could not create GL context: " << SDL_GetError(); return false; } continue; } // Verify that the MSAA setting matches what was requested int msaaEnabled, msaaValue; SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &msaaEnabled); SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaaValue); if(!lastTry) { if(!msaaEnabled || msaaValue < msaa) { continue; } } if(msaaEnabled) { m_MSAALevel = msaaValue; } else { m_MSAALevel = 0; } // Verify that we actually got an accelerated context (void)glGetError(); // clear error flags GLint texunits = 0; glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texunits); if(glGetError() != GL_NO_ERROR || texunits < GLint(m_minTextureUnits)) { if(lastTry) { LogError << "Not enough GL texture units available: have " << texunits << ", need at least " << m_minTextureUnits; return false; } continue; } // All good int red = 0, green = 0, blue = 0, alpha = 0, depth = 0, doublebuffer = 0; SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &red); SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &green); SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blue); SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &alpha); SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth); SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer); LogInfo << "Window: r:" << red << " g:" << green << " b:" << blue << " a:" << alpha << " depth:" << depth << " aa:" << msaa << "x doublebuffer:" << doublebuffer; break; } setVSync(m_vsync); SDL_ShowWindow(m_window); SDL_ShowCursor(SDL_DISABLE); m_renderer->initialize(); onCreate(); onToggleFullscreen(m_fullscreen); updateSize(true); onShow(true); onFocus(true); return true; }