int NotifyArea::Command(int id, int code) { switch(id) { case ID_SHOW_HIDDEN_ICONS: _show_hidden = !_show_hidden; UpdateIcons(); break; case ID_SHOW_ICON_BUTTON: _show_button = !_show_button; UpdateIcons(); break; case ID_CONFIG_NOTIFYAREA: Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), GetParent(_hwnd)); break; case ID_CONFIG_TIME: launch_cpanel(_hwnd, TEXT("timedate.cpl")); break; default: SendParent(WM_COMMAND, MAKELONG(id,code), 0); } return 0; }
MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MultimediaWidget){ ui->setupUi(this); //load the designer file //Add in the special QMultimediaWidgets mediaObj = new QMediaPlayer(this); mediaObj->setVolume(100); mediaObj->setNotifyInterval(500); //only every 1/2 second update videoDisplay = new QVideoWidget(this); videoDisplay->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->videoLayout->addWidget(videoDisplay); mediaObj->setVideoOutput(videoDisplay); videoDisplay->setVisible(false); UpdateIcons(); UpdateText(); //Connect the special signals/slots for the media object connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) ); connect(mediaObj, SIGNAL(seekableChanged(bool)), ui->playerSlider, SLOT(setEnabled(bool)) ); connect(mediaObj, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playerStatusChanged(QMediaPlayer::MediaStatus)) ); connect(mediaObj, SIGNAL(positionChanged(qint64)), this, SLOT(playerTimeChanged(qint64)) ); connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) ); connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) ); connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) ); //Disable some of the initial states ui->tool_player_stop->setEnabled(false); //nothing to stop yet ui->tool_player_pause->setVisible(false); //nothing to pause yet ui->playerSlider->setEnabled(false); //nothing to seek yet }
BOOL CSysTray::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID) { HRESULT hr; if (hWnd != m_hWnd) return FALSE; switch (uMsg) { case WM_NCCREATE: case WM_NCDESTROY: return FALSE; case WM_CREATE: InitIcons(); SetTimer(1, 2000, NULL); return TRUE; case WM_TIMER: UpdateIcons(); return TRUE; case WM_DESTROY: KillTimer(1); ShutdownIcons(); return TRUE; } TRACE("SysTray message received %u (%08p %08p)\n", uMsg, wParam, lParam); hr = ProcessIconMessage(uMsg, wParam, lParam, lResult); if (FAILED(hr)) return FALSE; return (hr == S_OK); }
int FullUpdate() { ERROR_OUTPUT(__func__); // desura_update.mcf if (FileExists(UPDATEFILE)) DeleteFile(UPDATEFILE); if (FileExists(UPDATE_LOCK)) { ERROR_OUTPUT("It looks like Desura tried to update and failed."); DeleteFile(UPDATE_LOCK); return 2; } FILE* fh = Safe::fopen(UPDATE_LOCK, "wb"); if (fh) fclose(fh); int res = DownloadAndInstallMCF(); // .desura_lock if (FileExists(UPDATE_LOCK)) DeleteFile(UPDATE_LOCK); // desura_update.mcf if (FileExists(UPDATEFILE)) DeleteFile(UPDATEFILE); UpdateIcons(true); return res; }
LRESULT TabView::OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled) { // load icon UpdateIcons(); LRESULT result = -1; CREATESTRUCT* createStruct = reinterpret_cast<CREATESTRUCT*>(lParam); ConsoleViewCreate* consoleViewCreate = reinterpret_cast<ConsoleViewCreate*>(createStruct->lpCreateParams); ATLTRACE(_T("TabView::OnCreate\n")); MutexLock viewMapLock(m_viewsMutex); HWND hwndConsoleView = CreateNewConsole(consoleViewCreate, m_consoleOptions); if( hwndConsoleView ) { result = multisplitClass::OnCreate(uMsg, wParam, lParam, bHandled); TRACE(L"multisplitClass::OnCreate returns %p\n", result); if( result == 0 ) { multisplitClass::tree.window = hwndConsoleView; CRect rect; m_views.begin()->second->GetRect(rect); multisplitClass::RectSet(rect, true); } } bHandled = TRUE; ATLTRACE(_T("TabView::OnCreate done\n")); return result; // windows sets focus to first control }
void DemoState::AdvanceFrame(float delta_time) { HandleInput(); UpdateIcons(delta_time); audio_engine_.AdvanceFrame(delta_time); RemoveInvalidSounds(); SDL_RenderClear(renderer_); DrawInstructions(); DrawIcons(); SDL_RenderPresent(renderer_); SDL_Delay(kDelayMilliseconds); }
int main(int argc, char ** argv) { LTHEME::LoadCustomEnvSettings(); QApplication a(argc, argv); LUtils::LoadTranslation(&a, "lumina-fileinfo"); LuminaThemeEngine theme(&a); //Read the input variables QString path = ""; QString flag = ""; if (argc==2) { path = QString::fromLocal8Bit(argv[1]); } else if (argc==3) { flag = QString::fromLocal8Bit(argv[1]); path = QString::fromLocal8Bit(argv[2]); } //Check the input variables // - path if(!path.isEmpty()) { path = LUtils::PathToAbsolute(path); } // - flag if(!flag.isEmpty()) { if(flag=="-application") { flag = "APP"; //for internal use } else if(flag=="-link") { flag = "LINK"; //for internal use } else { //Invalid flag - clear the path as well path.clear(); } } if(!path.isEmpty()) { //if(!QFile::exists(path)){ LUtils::writeFile(path,QStringList()); } //create an empty file MainUI w; QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) ); w.LoadFile(path, flag); w.show(); int retCode = a.exec(); return retCode; } else { //Show an error text and exit QStringList msg; msg << "ERROR: Invalid input arguments"; msg << "Usage: \"lumina-fileinfo [-application | -link] <file>"; qDebug() << msg.join("\n"); return 1; } }
ToolBar::ToolBar(QWidget* parent) : QToolBar(parent) { setToolButtonStyle(Qt::ToolButtonTextUnderIcon); setMovable(false); setFloatable(false); setIconSize(ICON_SIZE); MakeActions(); UpdateIcons(); EmulationStopped(); }
void NotifyArea::Refresh(bool update) { // Look for task icons without valid owner window. // This is an extended feature missing in MS Windows. for(NotifyIconSet::const_iterator it=_sorted_icons.begin(); it!=_sorted_icons.end(); ++it) { const NotifyInfo& entry = *it; if (!IsWindow(entry._hWnd)) if (_icon_map.erase(entry)) // delete icons without valid owner window ++update; } DWORD now = GetTickCount(); // handle icon hiding for(NotifyIconMap::iterator it=_icon_map.begin(); it!=_icon_map.end(); ++it) { NotifyInfo& entry = it->second; DetermineHideState(entry); switch(entry._mode) { case NIM_HIDE: if (!(entry._dwState & NIS_HIDDEN)) { entry._dwState |= NIS_HIDDEN; ++update; } break; case NIM_SHOW: if (entry._dwState&NIS_HIDDEN) { entry._dwState &= ~NIS_HIDDEN; ++update; } break; case NIM_AUTO: // automatically hide icons after long periods of inactivity if (_hide_inactive) if (!(entry._dwState & NIS_HIDDEN)) if (now-entry._lastChange > ICON_AUTOHIDE_SECONDS*1000) { entry._dwState |= NIS_HIDDEN; ++update; } break; } } if (update) UpdateIcons(); }
int main(int argc, char ** argv) { LTHEME::LoadCustomEnvSettings(); QApplication a(argc, argv); LUtils::LoadTranslation(&a, "lumina-fileinfo"); LuminaThemeEngine theme(&a); //Read the input variables QString path = ""; QString flag = ""; for(int i=1; i<argc; i++){ if( QString(argv[i]).startsWith("-") ){ flag = QString(argv[i]); } else{ path = QString(argv[i]); break; } } //Check the input variables // - path if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); } // - flag if(!flag.isEmpty()){ if(flag=="-application"){ flag = "APP"; //for internal use }else if(flag=="-link"){ flag = "LINK"; //for internal use }else{ //Invalid flag - clear the path as well flag.clear(); path.clear(); } } if(!path.isEmpty() || !flag.isEmpty()){ MainUI w; QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) ); w.LoadFile(path, flag); w.show(); int retCode = a.exec(); return retCode; }else{ //Show an error text and exit qDebug() << "ERROR: Invalid input arguments"; qDebug() << "Usage: \"lumina-fileinfo [-application | -link] [file]"; return 1; } }
DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){ ui->setupUi(this); //load the designer file ID = objID; //Assemble the toolbar for the widget toolbar = new QToolBar(this); toolbar->setContextMenuPolicy(Qt::CustomContextMenu); toolbar->setFloatable(false); toolbar->setMovable(false); toolbar->setOrientation(Qt::Horizontal); toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); //toolbar->setIconSize(QSize(32,32)); ui->toolbar_layout->addWidget(toolbar); // - Add the buttons to the toolbar toolbar->addAction(ui->actionBack); toolbar->addAction(ui->actionUp); toolbar->addAction(ui->actionHome); line_dir = new QLineEdit(this); toolbar->addWidget(line_dir); toolbar->addAction(ui->actionStopLoad); toolbar->addAction(ui->actionClose_Browser); //Add the browser widgets listWidget = new DDListWidget(this); treeWidget = new DDTreeWidget(this); ui->browser_layout->addWidget(listWidget); ui->browser_layout->addWidget(treeWidget); //Create the keyboard shortcuts /*copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this); pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this); cutFilesShort = new QShortcut( QKeySequence(tr("Ctrl+X")), this); deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this);*/ //Create the filesystem watcher watcher = new QFileSystemWatcher(this); synctimer = new QTimer(this); synctimer->setInterval(300); // 300 millisecond pause (combine simultaneous signals from the watcher) synctimer->setSingleShot(true); //Now update the rest of the UI canmodify = false; //initial value contextMenu = new QMenu(this); setDateFormat(); setShowDetails(true); setShowThumbnails(true); UpdateIcons(); UpdateText(); setupConnections(); }
void GUIManager::InitializeInventory() { int itemNum = 0; GameObject* item; Inventory* inven = GAMEENGINE.GetPlayer()->GetInventory(); for(size_t i = 0 ; i < inventorySize ; i++) { for(size_t j = 0 ; j < inventorySize ; j++) { item = inven->GetSpecificItem(itemNum); d_buttons[i][j]->SetItem(item); itemNum++; } } UpdateIcons(); }
WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent) { // i18n: This kind of "watch" is used for watching emulated memory. // It's not related to timekeeping devices. setWindowTitle(tr("Watch")); setObjectName(QStringLiteral("watch")); setAllowedAreas(Qt::AllDockWidgetAreas); auto& settings = Settings::GetQSettings(); restoreGeometry(settings.value(QStringLiteral("watchwidget/geometry")).toByteArray()); setFloating(settings.value(QStringLiteral("watchwidget/floating")).toBool()); CreateWidgets(); ConnectWidgets(); connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) { if (!Settings::Instance().IsDebugModeEnabled()) return; m_load->setEnabled(Core::IsRunning()); m_save->setEnabled(Core::IsRunning()); if (state != Core::State::Starting) Update(); }); connect(&Settings::Instance(), &Settings::WatchVisibilityChanged, [this](bool visible) { setHidden(!visible); }); connect(&Settings::Instance(), &Settings::DebugModeToggled, [this](bool enabled) { setHidden(!enabled || !Settings::Instance().IsWatchVisible()); }); connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons); UpdateIcons(); setHidden(!Settings::Instance().IsWatchVisible() || !Settings::Instance().IsDebugModeEnabled()); Update(); }
LRESULT NotifyArea::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) { switch(nmsg) { case WM_PAINT: Paint(); break; case WM_TIMER: { Refresh(); ClockWindow* clock_window = GET_WINDOW(ClockWindow, _hwndClock); if (clock_window) clock_window->TimerTick(); break;} case PM_REFRESH: Refresh(true); break; case WM_SIZE: { int cx = LOWORD(lparam); SetWindowPos(_hwndClock, 0, cx-_clock_width, 0, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); break;} case PM_GET_WIDTH: { int w = _sorted_icons.size()*NOTIFYICON_DIST + NOTIFYAREA_SPACE + _clock_width; if (_show_button) w += NOTIFYICON_DIST; return w;} case PM_REFRESH_CONFIG: read_config(); break; case WM_CONTEXTMENU: { Point pt(lparam); POINTS p; p.x = (SHORT) pt.x; p.y = (SHORT) pt.y; ScreenToClient(_hwnd, &pt); if (IconHitTest(pt) == _sorted_icons.end()) { // display menu only when no icon clicked PopupMenu menu(IDM_NOTIFYAREA); SetMenuDefaultItem(menu, 0, MF_BYPOSITION); CheckMenuItem(menu, ID_SHOW_HIDDEN_ICONS, MF_BYCOMMAND|(_show_hidden?MF_CHECKED:MF_UNCHECKED)); CheckMenuItem(menu, ID_SHOW_ICON_BUTTON, MF_BYCOMMAND|(_show_button?MF_CHECKED:MF_UNCHECKED)); menu.TrackPopupMenu(_hwnd, p); } break;} case WM_COPYDATA: { // receive NotifyHook answers String path; HWND hwnd; if (_hook.ModulePathCopyData(lparam, &hwnd, path)) _window_modules[hwnd] = path; break;} default: if (nmsg>=WM_MOUSEFIRST && nmsg<=WM_MOUSELAST) { // close startup menu and other popup menus // This functionality is missing in MS Windows. if (nmsg==WM_LBUTTONDOWN || nmsg==WM_MBUTTONDOWN || nmsg==WM_RBUTTONDOWN #ifdef WM_XBUTTONDOWN || nmsg==WM_XBUTTONDOWN #endif ) CancelModes(); Point pt(lparam); NotifyIconSet::const_iterator found = IconHitTest(pt); if (found != _sorted_icons.end()) { const NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?! // set activation time stamp if (nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage(). nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages #ifdef WM_XBUTTONDOWN nmsg == WM_XBUTTONDOWN || #endif nmsg == WM_RBUTTONDOWN) { _icon_map[entry]._lastChange = GetTickCount(); } // Notify the message if the owner is still alive if (IsWindow(entry._hWnd)) { if (nmsg == WM_MOUSEMOVE || // avoid to call blocking SendMessage() for merely moving the mouse over icons nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage(). nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages #ifdef WM_XBUTTONDOWN nmsg == WM_XBUTTONDOWN || #endif nmsg == WM_RBUTTONDOWN) PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg); else { // allow SetForegroundWindow() in client process DWORD pid; if (GetWindowThreadProcessId(entry._hWnd, &pid)) { // bind dynamically to AllowSetForegroundWindow() to be compatible to WIN98 static DynamicFct<BOOL(WINAPI*)(DWORD)> AllowSetForegroundWindow(TEXT("USER32"), "AllowSetForegroundWindow"); if (AllowSetForegroundWindow) (*AllowSetForegroundWindow)(pid); } // use PostMessage() for notifcation icons of Shell Service Objects in the own process if (pid == GetCurrentProcessId()) PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg); else SendMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg); } } else if (_icon_map.erase(entry)) // delete icons without valid owner window UpdateIcons(); } else // handle clicks on notification area button "show hidden icons" if (_show_button) if (nmsg == WM_LBUTTONDOWN) if (pt.x>=NOTIFYICON_X && pt.x<NOTIFYICON_X+NOTIFYICON_SIZE && pt.y>=NOTIFYICON_Y && pt.y<NOTIFYICON_Y+NOTIFYICON_SIZE) PostMessage(_hwnd, WM_COMMAND, MAKEWPARAM(ID_SHOW_HIDDEN_ICONS,0), 0); } return super::WndProc(nmsg, wparam, lparam); } return 0; }
LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pnid) { switch(notify_code) { case NIM_ADD: case NIM_MODIFY: if ((int)pnid->uID >= 0) { ///@todo This is a fix for Windows Task Manager. NotifyInfo& entry = _icon_map[pnid]; // a new entry? if (entry._idx == -1) entry._idx = ++_next_idx; /* equivalent code using iterator::find(); NotifyIconMap::iterator found = _icon_map.find(pnid); NotifyInfo* pentry; // a new entry? if (found == _icon_map.end()) { pentry = &_icon_map[pnid]; pentry->_idx = ++_next_idx; } else { pentry = &found->second; } NotifyInfo& entry = *pentry; */ bool changes = entry.modify(pnid); #if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers if (DetermineHideState(entry) && entry._mode==NIM_HIDE) { entry._dwState |= NIS_HIDDEN; changes = true; } #endif if (changes) UpdateIcons(); ///@todo call only if really changes occurred return TRUE; } break; case NIM_DELETE: { NotifyIconMap::iterator found = _icon_map.find(pnid); if (found != _icon_map.end()) { if (found->second._hIcon) DestroyIcon(found->second._hIcon); _icon_map.erase(found); UpdateIcons(); return TRUE; } break;} #if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers case NIM_SETFOCUS: SetForegroundWindow(_hwnd); return TRUE; case NIM_SETVERSION: NotifyIconMap::iterator found = _icon_map.find(pnid); if (found != _icon_map.end()) { found->second._version = pnid->UNION_MEMBER(uVersion); return TRUE; } else return FALSE; #endif } return FALSE; }
void EyeOfTheStorm::UpdateCPs() { uint32 i; set<Player*>::iterator itr, itrend; Player * plr; GameObject * go; int32 delta = 0; uint32 playercounts[2]; uint32 towers[2] = {0,0}; EOTSCaptureDisplayList::iterator eitr, eitr2, eitrend; EOTSCaptureDisplayList * disp; for(i = 0; i < EOTS_TOWER_COUNT; ++i) { /* loop players inrange, add any that arent in the set to the set */ playercounts[0] = playercounts[1] = 0; go = m_CPStatusGO[i]; disp = &m_CPDisplay[i]; itr = go->GetInRangePlayerSetBegin(); itrend = go->GetInRangePlayerSetEnd(); for( ; itr != itrend; ++itr ) { plr = *itr; if( plr->isAlive() && !(plr->IsStealth()) && !(plr->m_invisible) && !(plr->SchoolImmunityList[0]) && plr->GetDistance2dSq( go ) <= EOTS_CAPTURE_DISTANCE ) { playercounts[plr->GetTeam()]++; if( disp->find( plr ) == disp->end() ) { disp->insert( plr ); plr->SendWorldStateUpdate(EOTS_WORLDSTATE_DISPLAYON, 1); } } } /* score diff calculation */ //printf("EOTS: Playercounts = %u %u\n", playercounts[0], playercounts[1]); if(playercounts[0] != playercounts[1]) { if(playercounts[0] > playercounts[1]) delta = playercounts[0]; else if(playercounts[1] > playercounts[0]) delta = -(int32)playercounts[1]; delta *= EOTS_CAPTURE_RATE; m_CPStatus[i] += delta; if( m_CPStatus[i] > 100 ) m_CPStatus[i] = 100; else if( m_CPStatus[i] < 0 ) m_CPStatus[i] = 0; // change the flag depending on cp status if( m_CPStatus[i] == 0 ) { if( m_CPBanner[i]->GetEntry() != EOTS_BANNER_HORDE ) { RespawnCPFlag(i, EOTS_BANNER_HORDE); if( m_spiritGuides[i] != NULL ) { RepopPlayersOfTeam( 0, m_spiritGuides[i] ); m_spiritGuides[i]->Despawn( 0, 0 ); RemoveSpiritGuide( m_spiritGuides[i] ); m_spiritGuides[i] = NULL; } m_spiritGuides[i] = SpawnSpiritGuide( EOTSGraveyardLocations[i][0], EOTSGraveyardLocations[i][1], EOTSGraveyardLocations[i][2], 0, 1 ); AddSpiritGuide( m_spiritGuides[i] ); SetWorldState(m_iconsStates[i][0], 0); SetWorldState(m_iconsStates[i][1], 0); SetWorldState(m_iconsStates[i][2], 1); } } else if( m_CPStatus[i] == 100 ) { if( m_CPBanner[i]->GetEntry() != EOTS_BANNER_ALLIANCE ) { RespawnCPFlag(i, EOTS_BANNER_ALLIANCE); if( m_spiritGuides[i] != NULL ) { RepopPlayersOfTeam( 1, m_spiritGuides[i] ); m_spiritGuides[i]->Despawn( 0, 0 ); RemoveSpiritGuide( m_spiritGuides[i] ); m_spiritGuides[i] = NULL; } m_spiritGuides[i] = SpawnSpiritGuide( EOTSGraveyardLocations[i][0], EOTSGraveyardLocations[i][1], EOTSGraveyardLocations[i][2], 0, 0 ); AddSpiritGuide( m_spiritGuides[i] ); SetWorldState(m_iconsStates[i][0], 0); SetWorldState(m_iconsStates[i][1], 1); SetWorldState(m_iconsStates[i][2], 0); } } else { if( m_CPBanner[i]->GetEntry() != EOTS_BANNER_NEUTRAL ) { RespawnCPFlag(i, EOTS_BANNER_NEUTRAL); if( m_spiritGuides[i] != NULL ) { RepopPlayersOfTeam( -1, m_spiritGuides[i] ); m_spiritGuides[i]->Despawn( 0, 0 ); RemoveSpiritGuide( m_spiritGuides[i] ); m_spiritGuides[i] = NULL; } SetWorldState(m_iconsStates[i][0], 1); SetWorldState(m_iconsStates[i][1], 0); SetWorldState(m_iconsStates[i][2], 0); } } UpdateIcons(); } /* update the players with the new value */ eitr = disp->begin(); eitrend = disp->end(); for( ; eitr != eitrend; ) { plr = *eitr; eitr2 = eitr; ++eitr; if( plr->GetDistance2dSq( go ) > EOTS_CAPTURE_DISTANCE ) { disp->erase( eitr2 ); plr->SendWorldStateUpdate(EOTS_WORLDSTATE_DISPLAYON, 0); // hide the cp bar } else plr->SendWorldStateUpdate(EOTS_WORLDSTATE_DISPLAYVALUE, m_CPStatus[i]); } } for(i = 0; i < EOTS_TOWER_COUNT; ++i) { if( m_CPStatus[i] == 100 ) towers[0]++; else if( m_CPStatus[i] == 0 ) towers[1]++; } SetWorldState( EOTS_WORLDSTATE_ALLIANCE_BASES, towers[0] ); SetWorldState( EOTS_WORLDSTATE_HORDE_BASES, towers[1] ); }
DMainWindow::DMainWindow(QWidget* parent_widget) : QMainWindow(parent_widget) { m_ui = std::make_unique<Ui::DMainWindow>(); m_ui->setupUi(this); Resources::Init(); UpdateIcons(); setWindowIcon(Resources::GetIcon(Resources::DOLPHIN_LOGO)); // Create the GameList m_game_tracker = new DGameTracker(this); m_ui->centralWidget->addWidget(m_game_tracker); m_game_tracker->ScanForGames(); m_game_tracker->SelectLastBootedGame(); // Setup the GameList style switching actions QActionGroup* gamelistGroup = new QActionGroup(this); gamelistGroup->addAction(m_ui->actionListView); gamelistGroup->addAction(m_ui->actionTreeView); gamelistGroup->addAction(m_ui->actionGridView); gamelistGroup->addAction(m_ui->actionIconView); // TODO: save/load this from user prefs! m_ui->actionListView->setChecked(true); OnGameListStyleChanged(); // Connect all the signals/slots connect(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState))); connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen())); connect(m_ui->actionBrowse, SIGNAL(triggered()), this, SLOT(OnBrowse())); connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(OnExit())); connect(m_ui->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); connect(m_ui->actionTreeView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); connect(m_ui->actionGridView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); connect(m_ui->actionIconView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); connect(m_ui->actionPlay, SIGNAL(triggered()), this, SLOT(OnPlay())); connect(m_ui->actionPlay_mnu, SIGNAL(triggered()), this, SLOT(OnPlay())); connect(m_game_tracker, SIGNAL(StartGame()), this, SLOT(OnPlay())); connect(m_ui->actionStop, SIGNAL(triggered()), this, SLOT(OnStop())); connect(m_ui->actionStop_mnu, SIGNAL(triggered()), this, SLOT(OnStop())); connect(m_ui->actionReset, SIGNAL(triggered()), this, SLOT(OnReset())); connect(m_ui->actionWebsite, SIGNAL(triggered()), this, SLOT(OnOpenWebsite())); connect(m_ui->actionOnlineDocs, SIGNAL(triggered()), this, SLOT(OnOpenDocs())); connect(m_ui->actionGitHub, SIGNAL(triggered()), this, SLOT(OnOpenGitHub())); connect(m_ui->actionSystemInfo, SIGNAL(triggered()), this, SLOT(OnOpenSystemInfo())); connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(OnOpenAbout())); connect(m_ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(OnOpenAboutQt())); // Update GUI items emit CoreStateChanged(Core::CORE_UNINITIALIZED); // Platform-specific stuff #ifdef Q_OS_MACX m_ui->toolbar->setMovable(false); #endif }
void cGtkmmMainWindow::OnThemeChanged() { UpdateIcons(); }
cGtkmmMainWindow::cGtkmmMainWindow(int argc, char** argv) : updateChecker(*this), notifyMainThread(*this), pMenuPopup(nullptr), comboBoxFolder(true), statusBar("0 photos"), photoBrowser(*this) { settings.Load(); set_title(BUILD_APPLICATION_NAME); set_size_request(400, 400); set_default_size(800, 800); // Restore the window size size_t width = 800; size_t height = 800; settings.GetMainWindowSize(width, height); resize(width, height); if (settings.IsMainWindowMaximised()) maximize(); // Set icon list std::vector<Glib::RefPtr<Gdk::Pixbuf> > icons; icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_16x16.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_32x32.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_48x48.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_64x64.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_128x128.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_256x256.png")); // GTK complains if we pass icons larger than 256x256 //icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_512x512.png")); set_icon_list(icons); // Menu and toolbar // void Gtk::Application::set_app_menu(const Glib::RefPtr< Gio::MenuModel > & app_menu) // Sets or unsets the application menu for application. // The application menu is a single menu containing items that typically impact the application as a whole, rather than acting on a specific window or document. For example, you would expect to see "Preferences" or "Quit" in an application menu, but not "Save" or "Print". // If supported, the application menu will be rendered by the desktop environment. // You might call this method in your Application::property_startup() signal handler. // Use the base ActionMap interface to add actions, to respond to the user selecting these menu items. // Since gtkmm 3.4: // Create actions for menus and toolbars m_refActionGroup = Gtk::ActionGroup::create(); // File menu m_refActionGroup->add(Gtk::Action::create("FileMenu", "File")); m_refActionGroup->add(Gtk::Action::create("FileAddFiles", "Add Files"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileBrowseFiles)); m_refActionGroup->add(Gtk::Action::create("FileAddFolder", "Add Folder"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileBrowseFolder)); m_refActionGroup->add(Gtk::Action::create("FileAddFilesFromPicturesFolder", "Add Files From Pictures Folder"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionAddFilesFromPicturesFolder)); m_refActionGroup->add(Gtk::Action::create("FileImportFolder", "Import Folder From Removable Media"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileImportFolder)); //m_refActionGroup->add(Gtk::Action::create("FileRemove", "Remove"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionRemoveTrack)); //m_refActionGroup->add(Gtk::Action::create("FileMoveToFolderMenu", "Move to Folder")); //m_refActionGroup->add(Gtk::Action::create("FileMoveToFolderBrowse", "Browse..."), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToFolderBrowse)); //m_refActionGroup->add(Gtk::Action::create("FileMoveToRubbishBin", "Move to the Rubbish Bin"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToRubbishBin)); //m_refActionGroup->add(Gtk::Action::create("FileShowInFileManager", "Show in the File Manager"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackShowInFileManager)); //m_refActionGroup->add(Gtk::Action::create("FileProperties", "Properties"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackProperties)); m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileQuit)); // Edit menu m_refActionGroup->add(Gtk::Action::create("EditMenu", "Edit")); //Edit Tags -> edits each track separately //Batch Edit Tags -> edits all tracks at the same time m_refActionGroup->add(Gtk::Action::create("EditPreferences", Gtk::Stock::PREFERENCES), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuEditPreferences)); // Playback menu m_refActionGroup->add(Gtk::Action::create("PlaybackMenu", "Playback")); //m_refActionGroup->add(Gtk::Action::create("PlaybackPrevious", Gtk::Stock::MEDIA_PREVIOUS), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackPreviousClicked)); //pPlayPauseAction = Gtk::ToggleAction::create("PlaybackPlayPause", Gtk::Stock::MEDIA_PLAY, "Play/Pause"); //m_refActionGroup->add(pPlayPauseAction, sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackPlayPauseMenuToggled)); //m_refActionGroup->add(Gtk::Action::create("PlaybackNext", Gtk::Stock::MEDIA_NEXT), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackNextClicked)); //m_refActionGroup->add(Gtk::Action::create("JumpToPlaying", "Jump to Playing"), // Gtk::AccelKey("<control>J"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionJumpToPlaying)); //pRepeatAction = Gtk::ToggleAction::create("PlaybackRepeatToggle", Gtk::Stock::GOTO_TOP, "Repeat"); //m_refActionGroup->add(pRepeatAction, sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackRepeatMenuToggled)); // Help menu m_refActionGroup->add( Gtk::Action::create("HelpMenu", "Help") ); m_refActionGroup->add( Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuHelpAbout) ); m_refUIManager = Gtk::UIManager::create(); m_refUIManager->insert_action_group(m_refActionGroup); add_accel_group(m_refUIManager->get_accel_group()); // Layout the actions in a menubar and toolbar { Glib::ustring ui_info = "<ui>" " <menubar name='MenuBar'>" " <menu action='FileMenu'>" " <menuitem action='FileAddFiles'/>" " <menuitem action='FileAddFolder'/>" " <menuitem action='FileAddFilesFromPicturesFolder'/>" " <menuitem action='FileImportFolder'/>" //" <menuitem action='FileRemove'/>" //" <menu action='FileMoveToFolderMenu'>" //" <menuitem action='FileMoveToFolderBrowse'/>" //" </menu>" //" <menuitem action='FileMoveToRubbishBin'/>" //" <menuitem action='FileShowInFileManager'/>" //" <menuitem action='FileProperties'/>" //" <separator/>" " <menuitem action='FileQuit'/>" " </menu>" " <menu action='EditMenu'>" " <menuitem action='EditPreferences'/>" " </menu>" " <menu action='PlaybackMenu'>" //" <menuitem action='PlaybackPrevious'/>" //" <menuitem action='PlaybackPlayPause'/>" //" <menuitem action='PlaybackNext'/>" //" <menuitem action='JumpToPlaying'/>" //" <separator/>" //" <menuitem action='PlaybackRepeatToggle'/>" " </menu>" " <menu action='HelpMenu'>" " <menuitem action='HelpAbout'/>" " </menu>" " </menubar>" " <toolbar name='ToolBar'>" //" <toolitem action='PlaybackPrevious'/>" //" <toolitem action='PlaybackPlayPause'/>" //" <toolitem action='PlaybackNext'/>" //" <toolitem action='PlaybackRepeatToggle'/>" " </toolbar>" "</ui>"; try { m_refUIManager->add_ui_from_string(ui_info); } catch(const Glib::Error& ex) { std::cerr<<"building menus failed: "<<ex.what(); } } // Get the menubar and toolbar widgets, and add them to a container widget Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar"); if (pMenubar != nullptr) boxMainWindow.pack_start(*pMenubar, Gtk::PACK_SHRINK); // Photo browser right click menu Glib::RefPtr<Gtk::ActionGroup> popupActionGroupRef; // Right click menu popupActionGroupRef = Gtk::ActionGroup::create(); // File|New sub menu: // These menu actions would normally already exist for a main menu, because a context menu should // not normally contain menu items that are only available via a context menu. popupActionGroupRef->add(Gtk::Action::create("ContextMenu", "Context Menu")); popupActionGroupRef->add(Gtk::Action::create("ContextAddFiles", "Add Files"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFiles)); popupActionGroupRef->add(Gtk::Action::create("ContextAddFolder", "Add Folder"), Gtk::AccelKey("<control>P"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFolder)); popupActionGroupRef->add(Gtk::Action::create("ContextRemove", "Remove"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionRemovePhoto)); //Edit Tags -> edits each track separately //Batch Edit Tags -> edits all tracks at the same time /*/popupActionGroupRef->add(Gtk::Action::create("ContextMoveToFolderMenu", "Move to Folder")); popupActionGroupRef->add(Gtk::Action::create("ContextTrackMoveToFolderBrowse", "Browse..."), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToFolderBrowse)); popupActionGroupRef->add(Gtk::Action::create("ContextTrackMoveToRubbishBin", "Move to the Rubbish Bin"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToRubbishBin)); popupActionGroupRef->add(Gtk::Action::create("ContextShowInFileManager", "Show in the File Manager"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackShowInFileManager)); popupActionGroupRef->add(Gtk::Action::create("ContextProperties", "Properties"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackProperties));*/ popupUIManagerRef = Gtk::UIManager::create(); popupUIManagerRef->insert_action_group(popupActionGroupRef); add_accel_group(popupUIManagerRef->get_accel_group()); // Layout the actions in our popup menu { Glib::ustring ui_info = "<ui>" " <popup name='PopupMenu'>" " <menuitem action='ContextAddFiles'/>" " <menuitem action='ContextAddFolder'/>" " <menuitem action='ContextRemove'/>" /*" <menu action='ContextMoveToFolderMenu'>" " <menuitem action='ContextTrackMoveToFolderBrowse'/>" " </menu>" " <menuitem action='ContextTrackMoveToRubbishBin'/>" " <menuitem action='ContextShowInFileManager'/>" " <menuitem action='ContextProperties'/>"*/ " </popup>" "</ui>"; try { popupUIManagerRef->add_ui_from_string(ui_info); } catch(const Glib::Error& ex) { std::cerr<<"building menus failed: "<<ex.what(); } } // Get the menu pMenuPopup = dynamic_cast<Gtk::Menu*>(popupUIManagerRef->get_widget("/PopupMenu")); if (pMenuPopup == nullptr) g_warning("Popup menu not found"); assert(pMenuPopup != nullptr); // In gtkmm 3 set_orientation is not supported so we create our own toolbar out of plain old buttons //Gtk::Toolbar* pToolbar = dynamic_cast<Gtk::Toolbar*>(m_refUIManager->get_widget("/ToolBar")); //if (pToolbar != nullptr) { // pToolbar->property_orientation() = Gtk::ORIENTATION_VERTICAL; // //pToolbar->set_orientation(Gtk::ORIENTATION_VERTICAL); // pToolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS); // boxToolbar.pack_start(*pToolbar); //} buttonAddFiles.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFiles)); buttonAddFolder.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFolder)); boxToolbar.pack_start(buttonFolderUp, Gtk::PACK_SHRINK); boxToolbar.pack_start(buttonFolderShowInFileManager, Gtk::PACK_SHRINK); boxToolbar.pack_start(buttonAddFiles, Gtk::PACK_SHRINK); boxToolbar.pack_start(buttonAddFolder, Gtk::PACK_SHRINK); boxToolbar.pack_start(*Gtk::manage(new Gtk::Separator()), Gtk::PACK_SHRINK); // Controls comboBoxFolder.get_entry()->signal_changed().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionChangeFolder)); buttonFolderUp.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionFolderUp)); buttonFolderUp.set_tooltip_text("Move up"); buttonFolderShowInFileManager.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionFolderShowInFileManager)); buttonFolderShowInFileManager.set_tooltip_text("Show folder in file manager"); buttonStopLoading.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionStopLoading)); photoBrowser.Init(argc, argv); boxControls.pack_start(comboBoxFolder, Gtk::PACK_SHRINK); boxControls.pack_start(photoBrowser.GetWidget(), Gtk::PACK_EXPAND_WIDGET); boxControlsAndToolbar.pack_start(boxControls, Gtk::PACK_EXPAND_WIDGET); boxControlsAndToolbar.pack_start(boxToolbar, Gtk::PACK_SHRINK); // Hide the stop button until we start loading some files buttonStopLoading.hide(); boxStatusBar.pack_start(statusBar, Gtk::PACK_SHRINK); boxStatusBar.pack_start(buttonStopLoading, Gtk::PACK_SHRINK); //... show progress bar indeterminate when we are loading any files or playlists boxMainWindow.pack_start(boxControlsAndToolbar, Gtk::PACK_EXPAND_WIDGET); boxMainWindow.pack_start(boxStatusBar, Gtk::PACK_SHRINK); // Add the box layout to the main window add(boxMainWindow); { // Get a typical selection colour for the selections on our photo browser Gtk::Table table; Glib::RefPtr<Gtk::StyleContext> pStyleContext = table.get_style_context(); ASSERT(pStyleContext); const Gdk::RGBA colour = pStyleContext->get_background_color(Gtk::STATE_FLAG_SELECTED); const spitfire::math::cColour colourSelected(colour.get_red(), colour.get_green(), colour.get_blue(), colour.get_alpha()); photoBrowser.SetSelectionColour(colourSelected); } // Register our icon theme and update our icons iconTheme.RegisterThemeChangedListener(*this); UpdateIcons(); ApplySettings(); show_all_children(); // Start the update checker now that we have finished doing the serious work updateChecker.Run(); notifyMainThread.Create(); }
SlideshowWidget::SlideshowWidget(QWidget *parent) : QWidget(parent), ui(new Ui::SlideshowWidget){ ui->setupUi(this); //load the designer file UpdateIcons(); UpdateText(); }
bool GUIManager::ItemClicked(const CEGUI::EventArgs& event) { const CEGUI::WindowEventArgs& win = static_cast<const CEGUI::WindowEventArgs&>(event); ItemButton* currentButton = static_cast<ItemButton*>(win.window); win.window->deactivate(); //allow the user to select an item if no item is currently selected //do some error checkin to make sure user does not select item's not in inventory //when an item is selected, let them swap with another item if(GAMEENGINE.GetMouse()->getMouseState().buttonDown(OIS::MB_Left)) { if(itemSelected == NULL) { if(currentButton->GetItem() != NULL && currentButton->GetItem()->GetItemType() != 0) { itemSelected = currentButton->GetItem(); if(currentButton->getID() == 0) itemSelectedID = currentButton->GetItemButtonID(); else itemSelectedID = currentButton->getID(); std::cout << "Selected " << itemSelected->GetName() << std::endl; CEGUI::System::getSingleton().setDefaultMouseCursor("Items", currentButton->GetItem()->GetItemTexture()); } } else { if(itemSelected != currentButton->GetItem()) { //swap items if(itemSelectedID >= 0 && currentButton->getID() > 0 && currentButton->GetItem()->GetItemType() != NULL) { GAMEENGINE.GetPlayer()->GetInventory()->SwapItems(itemSelected, currentButton->GetItem()); } //equip item else if(itemSelectedID > 0 && currentButton->GetItemButtonID() < 0) { if(itemSelected->GetItemType() == 1) { int currentItem = (currentButton->GetItemButtonID() * -1) - 1; if(itemSelected->GetItemSlot() == currentItem) { std::cout << "Swap items" << std::endl; GAMEENGINE.GetPlayer()->GetInventory()->EquipItem(itemSelected, itemSelectedID); char_buttons[currentItem]->SetItem(&(GAMEENGINE.GetPlayer()->GetInventory()->GetEquipment()[currentItem])); } else { std::cout << "This item does not belong here." << std::endl; } } else { std::cout << "You cannot equip this item." << std::endl; } } //unequip item else if(itemSelectedID < 0 && currentButton->getID() > 0) { GAMEENGINE.GetPlayer()->GetInventory()->UnequipItem(itemSelected, currentButton->getID()); } //try to move equipment item to another equipment slot else if(itemSelectedID <0 && currentButton->GetItemButtonID() < 0) { } //move item else if(itemSelectedID >= 0 && currentButton->getID() > 0) { GAMEENGINE.GetPlayer()->GetInventory()->MoveItem(itemSelected, currentButton->getID()); } UpdateCharacterSheetIcons(); UpdateIcons(); } RestoreDefaultCursor(); itemSelected = NULL; } } return false; }
MainUI::MainUI() : QDialog(), ui(new Ui::MainUI){ ui->setupUi(this); //load the designer form canwrite = false; UpdateIcons(); //Set all the icons in the dialog SetupConnections(); }