Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); loadIcons(); }
int main(int argc, char ** argv) { bool CLIdone = false; for(int i=1; i<argc; i++){ //skip the first arg (app binary) if(QString(argv[i]) == "--reset-monitors"){ RRSettings::ApplyPrevious(); CLIdone = true; break; } } if(CLIdone){ return 0; } LTHEME::LoadCustomEnvSettings(); LSingleApplication a(argc, argv, "lumina-xconfig"); //loads translations inside constructor if( !a.isPrimaryProcess()){ return 0; } //qDebug() << "Loaded QApplication"; a.setApplicationName("Lumina Screen Configuration"); LuminaThemeEngine themes(&a); //Start the UI MainUI w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(loadIcons()) ); w.show(); int retCode = a.exec(); return retCode; }
ofxPanel * ofxPanel::setup(string collectionName, string filename, float x, float y){ if(!loadIcon.isAllocated() || !saveIcon.isAllocated()){ loadIcons(); } registerMouseEvents(); return (ofxPanel*)ofxGuiGroup::setup(collectionName,filename,x,y); }
ofxPanel * ofxPanel::setup(const ofParameterGroup & parameters, string filename, float x, float y){ if(!loadIcon.isAllocated() || !saveIcon.isAllocated()){ loadIcons(); } registerMouseEvents(); return (ofxPanel*)ofxGuiGroup::setup(parameters,filename,x,y); }
CSceneExplorer::CSceneExplorer(QWidget *parent) : QTreeView(parent) { loadIcons(); createParentItems(); header()->hide(); setObjectName("scene-explorer"); setSelectionMode(QAbstractItemView::ExtendedSelection); }
void PanelButton::resizeEvent(QResizeEvent*) { loadTiles(); if (calculateIconSize()) { loadIcons(); } }
ItemDatabase::ItemDatabase(SDL_Surface *_screen, FontEngine *_font) { screen = _screen; font = _font; vendor_ratio = 4; // this means scrap/vendor pays 1/4th price to buy items from hero load(); loadSounds(); loadIcons(); }
void PanelButton::updateIcon(int group) { if (group != KIcon::Panel) { return; } loadIcons(); update(); }
void XDesktopContainer::run() { times[0] = 0; times[1] = 0; times[2] = 0; numClicks[0] = 0; numClicks[1] = 0; numClicks[2] = 0; configure(); create(); loadIcons(); arrangeIcons(); eventLoop(); }
ofxPanel * ofxPanel::setup(const ofParameterGroup & parameters, string filename, float x, float y){ if(!loadIcon.isAllocated() || !saveIcon.isAllocated()){ loadIcons(); } registerMouseEvents(); if(parameters.contains("isPiping")){ isDynamic = true; isPiping = static_cast<ofParameter<bool> *>(¶meters.get("isPiping")); } return (ofxPanel*)ofxGuiGroup::setup(parameters,filename,x,y); }
void PanelButton::setIcon(const QString& icon) { if (icon == m_iconName) { return; } m_iconName = icon; loadIcons(); update(); emit iconChanged(); }
NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ QVBoxLayout *vlay = new QVBoxLayout(); this->setLayout( new QVBoxLayout() ); this->layout()->setContentsMargins(0,0,0,0); vlay->setContentsMargins(3,3,3,3); frame = new QFrame(this); frame->setObjectName("notepadbase"); frame->setStyleSheet("QFrame#notepadbase{border-size: 1px; background: rgba(255,255,255,50); color: black;} QFrame{ border: none; border-radius: 3px; background: rgba(255,255,255,100); color: black;}"); this->layout()->addWidget(frame); frame->setLayout(vlay); //Setup the title bar header buttons QHBoxLayout *hlay = new QHBoxLayout(); next = new QToolButton(this); next->setAutoRaise(true); prev = new QToolButton(this); prev->setAutoRaise(true); add = new QToolButton(this); add->setAutoRaise(true); rem = new QToolButton(this); rem->setAutoRaise(true); label = new QLabel(this); label->setAlignment(Qt::AlignCenter); hlay->addWidget(prev); hlay->addWidget(next); hlay->addWidget(label); hlay->addWidget(add); hlay->addWidget(rem); vlay->addLayout(hlay); //Setup the main text widget edit = new QPlainTextEdit(this); edit->setReadOnly(false); vlay->addWidget(edit); //Now setup the initial values cnote = this->settings->value("currentNote", 1).toInt(); maxnote = this->settings->value("availableNotes",1).toInt(); this->setInitialSize(200,300); //Setup the button connections connect(next, SIGNAL(clicked()), this, SLOT(nextNote()) ); connect(prev, SIGNAL(clicked()), this, SLOT(prevNote()) ); connect(add, SIGNAL(clicked()), this, SLOT(newNote()) ); connect(rem, SIGNAL(clicked()), this, SLOT(remNote()) ); connect(edit, SIGNAL(textChanged()), this, SLOT(noteChanged()) ); QTimer::singleShot(0,this, SLOT(loadIcons()) ); QTimer::singleShot(0,this, SLOT(updateContents()) ); }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); QString title = tr("Archive Manager"); if( getuid()==0){ title.append(" ("+tr("Admin Mode")+")"); } this->setWindowTitle(title); BACKEND = new Backend(this); connect(BACKEND, SIGNAL(ProcessStarting()), this, SLOT(ProcStarting()) ); connect(BACKEND, SIGNAL(ProcessFinished(bool, QString)), this, SLOT(ProcFinished(bool, QString)) ); connect(BACKEND, SIGNAL(ProgressUpdate(int, QString)), this, SLOT(ProcUpdate(int, QString)) ); //Add a spacer between toolbar items QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->toolBar->insertWidget(ui->actionAdd_File, spacer); //Connect the UI signals/slots connect(ui->action_New, SIGNAL(triggered()), this, SLOT(NewArchive()) ); connect(ui->action_Open, SIGNAL(triggered()), this, SLOT(OpenArchive()) ); connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(close()) ); connect(ui->actionAdd_File, SIGNAL(triggered()), this, SLOT(addFiles()) ); connect(ui->actionRemove_File, SIGNAL(triggered()), this, SLOT(remFiles()) ); connect(ui->actionExtract_All, SIGNAL(triggered()), this, SLOT(extractFiles()) ); connect(ui->actionExtract_Sel, SIGNAL(triggered()), this, SLOT(extractSelection()) ); connect(ui->actionAdd_Dirs, SIGNAL(triggered()), this, SLOT(addDirs()) ); connect(ui->tree_contents, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(ViewFile(QTreeWidgetItem*)) ); connect(ui->actionUSB_Image, SIGNAL(triggered()), this, SLOT(BurnImgToUSB()) ); //Set Keyboard Shortcuts ui->action_New->setShortcut(tr("CTRL+N")); ui->action_Open->setShortcut(tr("CTRL+O")); ui->action_Quit->setShortcut(tr("CTRL+Q")); ui->actionExtract_All->setShortcut(tr("CTRL+E")); ui->progressBar->setVisible(false); ui->label_progress->setVisible(false); ui->label_progress_icon->setVisible(false); ui->actionAdd_File->setEnabled(false); ui->actionRemove_File->setEnabled(false); ui->actionExtract_All->setEnabled(false); ui->actionAdd_Dirs->setEnabled(false); ui->actionUSB_Image->setEnabled(false); loadIcons(); ui->tree_contents->setHeaderLabels( QStringList() << tr("File") << tr("MimeType") << tr("Size")+" " ); }
//----------------------------- // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } mainWnd = hWnd; loadIcons(hInstance,hWnd); return TRUE; }
ItemDatabase::ItemDatabase(SDL_Surface *_screen, FontEngine *_font) { screen = _screen; font = _font; items = new Item[MAX_ITEM_ID]; for (int i=0; i<MAX_ITEM_ID; i++) { items[i].bonus_stat = new string[ITEM_MAX_BONUSES]; items[i].bonus_val = new int[ITEM_MAX_BONUSES]; for (int j=0; j<ITEM_MAX_BONUSES; j++) { items[i].bonus_stat[j] = ""; items[i].bonus_val[j] = 0; } } vendor_ratio = 4; // this means scrap/vendor pays 1/4th price to buy items from hero load(); loadSounds(); loadIcons(); }
MenuManager::MenuManager(PowerManager *_powers, SDL_Surface *_screen, InputState *_inp, FontEngine *_font, StatBlock *_stats, CampaignManager *_camp) { powers = _powers; screen = _screen; inp = _inp; font = _font; stats = _stats; powers = _powers; camp = _camp; loadIcons(); items = new ItemDatabase(screen, font); inv = new MenuInventory(screen, font, items, stats, powers); pow = new MenuPowers(screen, font, stats, powers); chr = new MenuCharacter(screen, font, stats); log = new MenuLog(screen, font); hudlog = new MenuHUDLog(screen, font); act = new MenuActionBar(screen, font, inp, powers, icons); hpmp = new MenuHPMP(screen, font); tip = new MenuTooltip(font, screen); mini = new MenuMiniMap(screen); xp = new MenuExperience(screen, font); enemy = new MenuEnemy(screen, font); vendor = new MenuVendor(screen, font, items, stats); talker = new MenuTalker(screen, inp, font, camp); exit = new MenuExit(screen, inp, font); pause = false; dragging = false; drag_stack.item = 0; drag_stack.quantity = 0; drag_power = -1; drag_src = 0; drop_stack.item = 0; drop_stack.quantity = 0; loadSounds(); done = false; }
//----------------------------- // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } mainWnd = hWnd; g_iTaskbarCreated = RegisterWindowMessage("TaskbarCreated"); // for PCRaw (tray icon) loadIcons(hInstance,hWnd); return TRUE; }
MenuManager::MenuManager(PowerManager *_powers, StatBlock *_stats, CampaignManager *_camp, ItemManager *_items) { powers = _powers; stats = _stats; powers = _powers; camp = _camp; items = _items; loadIcons(); chr = new MenuCharacter(stats); inv = new MenuInventory(items, stats, powers); pow = new MenuPowers(stats, powers); log = new MenuLog(); hudlog = new MenuHUDLog(); act = new MenuActionBar(powers, stats, icons); hpmp = new MenuHPMP(); tip = new WidgetTooltip(); mini = new MenuMiniMap(); xp = new MenuExperience(); enemy = new MenuEnemy(); vendor = new MenuVendor(items, stats); talker = new MenuTalker(camp); exit = new MenuExit(); pause = false; dragging = false; drag_stack.item = 0; drag_stack.quantity = 0; drag_power = -1; drag_src = 0; drop_stack.item = 0; drop_stack.quantity = 0; loadSounds(); done = false; }
TDEActionSelector::TDEActionSelector( TQWidget *parent, const char *name ) : TQWidget( parent, name ) { d = new TDEActionSelectorPrivate(); d->moveOnDoubleClick = true; d->keyboardEnabled = true; d->iconSize = SmallIcon; d->addIcon = TQApplication::reverseLayout()? "back" : "forward"; d->removeIcon = TQApplication::reverseLayout()? "forward" : "back"; d->upIcon = "up"; d->downIcon = "down"; d->availableInsertionPolicy = Sorted; d->selectedInsertionPolicy = BelowCurrent; d->showUpDownButtons = true; //int isz = IconSize( TDEIcon::Small ); TQHBoxLayout *lo = new TQHBoxLayout( this ); lo->setSpacing( KDialog::spacingHint() ); TQVBoxLayout *loAv = new TQVBoxLayout( lo ); d->lAvailable = new TQLabel( i18n("&Available:"), this ); loAv->addWidget( d->lAvailable ); d->availableListBox = new TQListBox( this ); loAv->addWidget( d->availableListBox ); d->lAvailable->setBuddy( d->availableListBox ); TQVBoxLayout *loHBtns = new TQVBoxLayout( lo ); loHBtns->addStretch( 1 ); d->btnAdd = new TQToolButton( this ); loHBtns->addWidget( d->btnAdd ); d->btnRemove = new TQToolButton( this ); loHBtns->addWidget( d->btnRemove ); loHBtns->addStretch( 1 ); TQVBoxLayout *loS = new TQVBoxLayout( lo ); d->lSelected = new TQLabel( i18n("&Selected:"), this ); loS->addWidget( d->lSelected ); d->selectedListBox = new TQListBox( this ); loS->addWidget( d->selectedListBox ); d->lSelected->setBuddy( d->selectedListBox ); TQVBoxLayout *loVBtns = new TQVBoxLayout( lo ); loVBtns->addStretch( 1 ); d->btnUp = new TQToolButton( this ); d->btnUp->setAutoRepeat( true ); loVBtns->addWidget( d->btnUp ); d->btnDown = new TQToolButton( this ); d->btnDown->setAutoRepeat( true ); loVBtns->addWidget( d->btnDown ); loVBtns->addStretch( 1 ); loadIcons(); connect( d->btnAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonAddClicked()) ); connect( d->btnRemove, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonRemoveClicked()) ); connect( d->btnUp, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonUpClicked()) ); connect( d->btnDown, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonDownClicked()) ); connect( d->availableListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)), this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) ); connect( d->selectedListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)), this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) ); connect( d->availableListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)), this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) ); connect( d->selectedListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)), this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) ); d->availableListBox->installEventFilter( this ); d->selectedListBox->installEventFilter( this ); }
void TDEActionSelector::setButtonIconSize( ButtonIconSize size ) { d->iconSize = size; // reload icons loadIcons(); }
/* MainApp::OnInit * Application initialization, run when program is started *******************************************************************/ bool MainApp::OnInit() { // Set locale to C so that the tokenizer will work properly // even in locales where the decimal separator is a comma. setlocale(LC_ALL, "C"); // Init global variables Global::error = ""; ArchiveManager::getInstance(); init_ok = false; // Init variables action_invalid = new SAction("invalid", "Invalid Action", "", "Something's gone wrong here"); // Setup system options wxSystemOptions::SetOption("mac.listctrl.always_use_generic", 1); // Set application name (for wx directory stuff) #ifdef __WINDOWS__ wxApp::SetAppName("SLADE3"); #else wxApp::SetAppName("slade3"); #endif // Handle exceptions using wxDebug stuff, but only in release mode #ifdef NDEBUG wxHandleFatalExceptions(true); #endif // Init application directories if (!initDirectories()) return false; // Load image handlers wxInitAllImageHandlers(); // Init logfile initLogFile(); // Init keybinds KeyBind::initBinds(); // Load configuration file wxLogMessage("Loading configuration"); readConfigFile(); Global::log_verbosity = log_verbosity; // Check that SLADE.pk3 can be found wxLogMessage("Loading resources"); theArchiveManager->init(); if (!theArchiveManager->resArchiveOK()) { wxMessageBox("Unable to find slade.pk3, make sure it exists in the same directory as the SLADE executable", "Error", wxICON_ERROR); return false; } // Init lua Lua::init(); // Calculate scaling factor (from system ppi) wxMemoryDC dc; Global::ppi_scale = (double)(dc.GetPPI().x) / 96.0; // Show splash screen theSplashWindow->init(); theSplashWindow->show("Starting up..."); // Init SImage formats SIFormat::initFormats(); // Load program icons wxLogMessage("Loading icons"); loadIcons(); // Load program fonts Drawing::initFonts(); // Load entry types wxLogMessage("Loading entry types"); EntryDataFormat::initBuiltinFormats(); EntryType::loadEntryTypes(); // Load text languages wxLogMessage("Loading text languages"); TextLanguage::loadLanguages(); // Init text stylesets wxLogMessage("Loading text style sets"); StyleSet::loadResourceStyles(); StyleSet::loadCustomStyles(); // Init colour configuration wxLogMessage("Loading colour configuration"); ColourConfiguration::init(); // Init nodebuilders NodeBuilders::init(); // Init game executables Executables::init(); // Init actions initActions(); theMainWindow; // Init base resource wxLogMessage("Loading base resource"); theArchiveManager->initBaseResource(); wxLogMessage("Base resource loaded"); // Show the main window theMainWindow->Show(true); SetTopWindow(theMainWindow); theSplashWindow->SetParent(theMainWindow); theSplashWindow->CentreOnParent(); // Open any archives on the command line // argv[0] is normally the executable itself (i.e. Slade.exe) // and opening it as an archive should not be attempted... for (int a = 1; a < argc; a++) { string arg = argv[a]; theArchiveManager->openArchive(arg); } // Hide splash screen theSplashWindow->hide(); init_ok = true; wxLogMessage("SLADE Initialisation OK"); // Init game configuration theGameConfiguration->init(); // Show Setup Wizard if needed if (!setup_wizard_run) { SetupWizardDialog dlg(theMainWindow); dlg.ShowModal(); setup_wizard_run = true; } // Check for updates #ifdef __WXMSW__ wxHTTP::Initialize(); if (update_check) checkForUpdates(false); #endif // Bind events Bind(wxEVT_MENU, &MainApp::onMenu, this); Bind(wxEVT_COMMAND_VERSIONCHECK_COMPLETED, &MainApp::onVersionCheckCompleted, this); return true; }
//First Boot Message void firstBootInitiation() { firstBoot = setFileDefaultsInt("system/settings/boot.bin", 1, firstBoot); iconPackLoad(); //Loads our images into memory loadIcons(); background = oslLoadImageFile(backgroundPath, OSL_IN_RAM, OSL_PF_8888); cursor = oslLoadImageFilePNG(cursorPath, OSL_IN_VRAM, OSL_PF_8888); navbar = oslLoadImageFile(navbarPath, OSL_IN_RAM, OSL_PF_8888); navbar2 = oslLoadImageFile(navbar2Path, OSL_IN_RAM, OSL_PF_8888); //notif = oslLoadImageFile("system/home/menu/notif.png", OSL_IN_RAM, OSL_PF_8888); welcome = oslLoadImageFilePNG("system/home/icons/welcome.png", OSL_IN_RAM, OSL_PF_8888); transbackground = oslLoadImageFilePNG("system/home/icons/transbackground.png", OSL_IN_RAM, OSL_PF_8888); control = oslLoadImageFilePNG("system/home/menu/brightnesscontrol.png", OSL_IN_VRAM, OSL_PF_8888); ic_launcher_apollo = oslLoadImageFilePNG(apolloPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_browser = oslLoadImageFile(browserPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_calculator = oslLoadImageFilePNG(calcPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_filemanager = oslLoadImageFilePNG(fmPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_gallery = oslLoadImageFilePNG(galleryPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_game = oslLoadImageFilePNG(gamePath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_messenger = oslLoadImageFilePNG(messagesPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_settings = oslLoadImageFilePNG(settingsPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_umd = oslLoadImageFilePNG(umdPath, OSL_IN_RAM, OSL_PF_8888); usbdebug = oslLoadImageFilePNG("system/home/icons/usbdebug.png", OSL_IN_RAM, OSL_PF_8888); music = oslLoadImageFilePNG("system/home/icons/music.png", OSL_IN_RAM, OSL_PF_8888); //Debugger - Displays an error message if the following resources are missing. if (!background || !cursor || !ic_allapps || !ic_allapps_pressed || !navbar || !ic_launcher_apollo || !ic_launcher_settings || !ic_launcher_messenger || !ic_launcher_browser || !batt100 || !batt80 || !batt60 || !batt40 || !batt20 || !batt10 || !batt0 || !battcharge || !navbar2 || !usbdebug || !music) debugDisplay(); //Sets the cursor's original position on the screen cursor->x = 240; cursor->y = 136; if (firstBoot!= 0) { while (!osl_quit) { oslStartDrawing(); controls(); oslDrawImage(background); oslDrawImageXY(ic_launcher_apollo, 105, 190); oslDrawImageXY(ic_launcher_browser, 276, 190); oslDrawImageXY(ic_launcher_settings, 331, 190); oslDrawImageXY(ic_launcher_messenger, 160, 190); oslSetTransparentColor(RGB(0,0,0)); appDrawerIcon(); oslDisableTransparentColor(); oslIntraFontSetStyle(Roboto, 0.5f, WHITE, 0, INTRAFONT_ALIGN_LEFT); digitaltime(420,4,0,hrTime); volumeController(); battery(370,2,1); navbarButtons(0); oslDrawImageXY(transbackground, 0, 0); oslDrawImageXY(welcome, 0, 0); oslIntraFontSetStyle(Roboto, 0.8f,BLACK,0,INTRAFONT_ALIGN_LEFT); oslDrawStringf(20,30, "%s", lang_welcome[language][0]); oslIntraFontSetStyle(Roboto, 0.6f,DARKGRAY,0,INTRAFONT_ALIGN_LEFT); oslDrawStringf(20,60, "%s", lang_welcome[language][1]); oslDrawStringf(20,80, "%s", lang_welcome[language][2]); oslIntraFontSetStyle(Roboto, 0.6f,WHITE,0,INTRAFONT_ALIGN_LEFT); oslDrawStringf(385,110, "%s", lang_welcome[language][3]); oslDrawImage(cursor); if (cursor->x >= 388 && cursor->x <= 464 && cursor->y >= 98 && cursor->y <= 132 && osl_keys->pressed.cross) { FILE * firstBootTxt = fopen("system/settings/boot.bin", "w"); fprintf(firstBootTxt, "0"); fclose(firstBootTxt); oslPlaySound(KeypressStandard, 1); oslDeleteImage(welcome); oslDeleteImage(transbackground); unloadIcons(); home(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } } if (firstBoot == 0) { oslDeleteImage(welcome); oslDeleteImage(transbackground); unloadIcons(); lockscreen(); home(); } }
MenuManager::MenuManager(PowerManager *_powers, StatBlock *_stats, CampaignManager *_camp, ItemManager *_items) : icons(NULL) , powers(_powers) , stats(_stats) , camp(_camp) , tip_buf() , key_lock(false) , dragging(0) , drag_stack() , drag_power(0) , drag_src(0) , done(false) /*std::vector<Menu*> menus;*/ , items(_items) , inv(NULL) , pow(NULL) , chr(NULL) , log(NULL) , hudlog(NULL) , act(NULL) , hp(NULL) , mp(NULL) , xp(NULL) , tip(NULL) , mini(NULL) , npc(NULL) , enemy(NULL) , vendor(NULL) , talker(NULL) , exit(NULL) , effects(NULL) , stash(NULL) , pause(false) , menus_open(false) , drop_stack() { loadIcons(); hp = new MenuStatBar("hp"); menus.push_back(hp); // menus[0] mp = new MenuStatBar("mp"); menus.push_back(mp); // menus[1] xp = new MenuStatBar("xp"); menus.push_back(xp); // menus[2] effects = new MenuActiveEffects(icons); menus.push_back(effects); // menus[3] hudlog = new MenuHUDLog(); menus.push_back(hudlog); // menus[4] act = new MenuActionBar(powers, stats, icons); menus.push_back(act); // menus[5] enemy = new MenuEnemy(); menus.push_back(enemy); // menus[6] vendor = new MenuVendor(items, stats); menus.push_back(vendor); // menus[7] talker = new MenuTalker(this, camp); menus.push_back(talker); // menus[8] exit = new MenuExit(); menus.push_back(exit); // menus[9] mini = new MenuMiniMap(); menus.push_back(mini); // menus[10] chr = new MenuCharacter(stats); menus.push_back(chr); // menus[11] inv = new MenuInventory(items, stats, powers); menus.push_back(inv); // menus[12] pow = new MenuPowers(stats, powers, icons); menus.push_back(pow); // menus[13] log = new MenuLog(); menus.push_back(log); // menus[14] stash = new MenuStash(items, stats); menus.push_back(stash); // menus[15] npc = new MenuNPCActions(); menus.push_back(npc); // menus[16] tip = new WidgetTooltip(); // Load the menu layout and sound effects from menus/menus.txt FileParser infile; if (infile.open(mods->locate("menus/menus.txt"))) { int menu_index = -1; while (infile.next()) { if (infile.key == "id") { /* finalize previously parsed menu */ if (menu_index != -1) menus[menu_index]->align(); if (infile.val == "hp") menu_index = 0; else if (infile.val == "mp") menu_index = 1; else if (infile.val == "xp") menu_index = 2; else if (infile.val == "effects") menu_index = 3; else if (infile.val == "hudlog") menu_index = 4; else if (infile.val == "actionbar") menu_index = 5; else if (infile.val == "enemy") menu_index = 6; else if (infile.val == "vendor") menu_index = 7; else if (infile.val == "talker") menu_index = 8; else if (infile.val == "exit") menu_index = 9; else if (infile.val == "minimap") menu_index = 10; else if (infile.val == "character") menu_index = 11; else if (infile.val == "inventory") menu_index = 12; else if (infile.val == "powers") menu_index = 13; else if (infile.val == "log") menu_index = 14; else if (infile.val == "stash") menu_index = 15; else if (infile.val == "npc") menu_index = 16; else menu_index = -1; } if (menu_index == -1) continue; if (infile.key == "layout") { infile.val = infile.val + ','; int x = eatFirstInt(infile.val, ','); int y = eatFirstInt(infile.val, ','); int w = eatFirstInt(infile.val, ','); int h = eatFirstInt(infile.val, ','); menus[menu_index]->window_area.x = x; menus[menu_index]->window_area.y = y; menus[menu_index]->window_area.w = w; menus[menu_index]->window_area.h = h; } else if (infile.key == "align") { menus[menu_index]->alignment = infile.val; } else if (infile.key == "soundfx_open") { menus[menu_index]->sfx_open = snd->load(infile.val, "MenuManager open tab"); } else if (infile.key == "soundfx_close") { menus[menu_index]->sfx_close = snd->load(infile.val, "MenuManager close tab"); } } infile.close(); } else fprintf(stderr, "Unable to open menus/menus.txt!\n"); // Some menus need to be updated to apply their new dimensions act->update(); vendor->update(); vendor->buyback_stock.init(NPC_VENDOR_MAX_STOCK, items); talker->update(); exit->update(); chr->update(); inv->update(); pow->update(); log->update(); stash->update(); pause = false; dragging = false; drag_stack.item = 0; drag_stack.quantity = 0; drag_power = 0; drag_src = 0; drop_stack.item = 0; drop_stack.quantity = 0; done = false; closeAll(); // make sure all togglable menus start closed }
void RSSFeedPlugin::ThemeChange(){ QTimer::singleShot(0,this, SLOT(loadIcons())); updateOptionsMenu(); }
// // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; POINT point; char buf[1024]; if(message == g_iTaskbarCreated) // for PCRaw (tray icon) loadIcons(hInst, hWnd); switch (message) { case WM_SHOWGUI: createGUI(hWnd); break; case WM_TRAYICON: switch((UINT)lParam) { case WM_LBUTTONDOWN: if (allowTrayMenu) SendMessage(hWnd,WM_SHOWMENU,2,0); SetForegroundWindow(hWnd); break; case WM_RBUTTONDOWN: if (allowTrayMenu) SendMessage(hWnd,WM_SHOWMENU,1,0); SetForegroundWindow(hWnd); break; case WM_LBUTTONDBLCLK: createGUI(hWnd); break; } break; case WM_COPYDATA: { COPYDATASTRUCT *pc = (COPYDATASTRUCT *)lParam; LOG_DEBUG("URL request: %s",pc->lpData); if (pc->dwData == WM_PLAYCHANNEL) { ChanInfo info; servMgr->procConnectArgs((char *)pc->lpData,info); chanMgr->findAndPlayChannel(info,false); } //sys->callLocalURL((const char *)pc->lpData,servMgr->serverHost.port); } break; case WM_GETPORTNUMBER: { int port; port=servMgr->serverHost.port; ReplyMessage(port); } break; case WM_SHOWMENU: { if (servMgr->saveGuiPos) { CheckMenuItem(trayMenu, ID_POPUP_SAVE_GUI_POS, MF_CHECKED|MF_BYCOMMAND); } else { CheckMenuItem(trayMenu, ID_POPUP_SAVE_GUI_POS, MF_UNCHECKED|MF_BYCOMMAND); } SetForegroundWindow(hWnd); bool skipMenu=false; allowTrayMenu = false; // check for notifications if (currNotify & ServMgr::NT_UPGRADE) { if (servMgr->downloadURL[0]) { if ((sys->getTime()-seenNewVersionTime) > (60*60)) // notify every hour { if (MessageBox(hWnd,"A newer version of PeerCast is available, press OK to upgrade.","PeerCast",MB_OKCANCEL|MB_APPLMODAL|MB_ICONEXCLAMATION) == IDOK) sys->getURL(servMgr->downloadURL); seenNewVersionTime=sys->getTime(); skipMenu=true; } } } if (!skipMenu) { RECT rcWnd; HMENU menu; UINT flg = 0; SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWnd, 0); GetCursorPos(&point); if (point.x < rcWnd.left) { point.x = rcWnd.left; flg |= TPM_LEFTALIGN; } if (point.x > rcWnd.right) { point.x = rcWnd.right; flg |= TPM_RIGHTALIGN; } if (point.y < rcWnd.top) { point.y = rcWnd.top; flg |= TPM_TOPALIGN; } if (point.y > rcWnd.bottom) { point.y = rcWnd.bottom; flg |= TPM_BOTTOMALIGN; } if (flg == 0) { flg = TPM_RIGHTALIGN; } switch (wParam) { case 1: menu = GetSubMenu(trayMenu,0); addAllChannelsMenu(GetSubMenu(menu,0)); addRelayedChannelsMenu(GetSubMenu(menu,1)); break; case 2: menu = GetSubMenu(ltrayMenu,0); addAllChannelsMenu(menu); break; } if (!TrackPopupMenu(menu,flg,point.x,point.y,0,hWnd,NULL)) { LOG_ERROR("Can`t track popup menu: %d",GetLastError()); } PostMessage(hWnd,WM_NULL,0,0); } allowTrayMenu = true; } break; case WM_CREATE: if (showGUI) createGUI(hWnd); break; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); if ((wmId >= INFO_CMD) && (wmId < INFO_CMD+MAX_CHANNELS)) { int c = wmId - INFO_CMD; chanInfo = getChannelInfo(c); chanInfoIsRelayed = false; if (winDistinctionNT) DialogBox(hInst, (LPCTSTR)IDD_CHANINFO, hWnd, (DLGPROC)ChanInfoProc); else { HWND WKDLG; //JP-Patch WKDLG = CreateDialog(hInst, (LPCTSTR)IDD_CHANINFO, hWnd, (DLGPROC)ChanInfoProc); //JP-Patch ShowWindow(WKDLG,SW_SHOWNORMAL); //JP-Patch } return 0; } if ((wmId >= URL_CMD) && (wmId < URL_CMD+MAX_CHANNELS)) { int c = wmId - URL_CMD; chanInfo = getChannelInfo(c); if (chanInfo.url.isValidURL()) sys->getURL(chanInfo.url); return 0; } if ((wmId >= PLAY_CMD) && (wmId < PLAY_CMD+MAX_CHANNELS)) { int c = wmId - PLAY_CMD; chanInfo = getChannelInfo(c); chanMgr->findAndPlayChannel(chanInfo,false); return 0; } if ((wmId >= RELAY_CMD) && (wmId < RELAY_CMD+MAX_CHANNELS)) { int c = wmId - RELAY_CMD; chanInfo = getChannelInfo(c); chanMgr->findAndPlayChannel(chanInfo,true); return 0; } // Parse the menu selections: switch (wmId) { case ID_POPUP_SHOWMESSAGES_PEERCAST: flipNotifyPopup(ID_POPUP_SHOWMESSAGES_PEERCAST,ServMgr::NT_PEERCAST); break; case ID_POPUP_SHOWMESSAGES_BROADCASTERS: flipNotifyPopup(ID_POPUP_SHOWMESSAGES_BROADCASTERS,ServMgr::NT_BROADCASTERS); break; case ID_POPUP_SHOWMESSAGES_TRACKINFO: flipNotifyPopup(ID_POPUP_SHOWMESSAGES_TRACKINFO,ServMgr::NT_TRACKINFO); break; case ID_POPUP_ABOUT: case IDM_ABOUT: DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case ID_POPUP_SHOWGUI: case IDM_SETTINGS_GUI: case ID_POPUP_ADVANCED_SHOWGUI: { createGUI(hWnd); break; } case ID_POPUP_YELLOWPAGES: sys->getURL("http://yp.peercast.org/"); break; case ID_POPUP_YELLOWPAGES1: sprintf(buf, "http://%s",servMgr->rootHost.cstr()); sys->getURL(buf); break; case ID_POPUP_YELLOWPAGES2: sprintf(buf, "http://%s",servMgr->rootHost2.cstr()); sys->getURL(buf); break; case ID_POPUP_ADVANCED_VIEWLOG: showHTML("viewlog.html"); break; case ID_POPUP_ADVANCED_SAVESETTINGS: servMgr->saveSettings(iniFileName.cstr()); break; case ID_POPUP_ADVANCED_INFORMATION: showHTML("index.html"); break; case ID_FIND_CHANNELS: case ID_POPUP_ADVANCED_ALLCHANNELS: case ID_POPUP_UPGRADE: sys->callLocalURL("admin?cmd=upgrade",servMgr->serverHost.port); break; case ID_POPUP_ADVANCED_RELAYEDCHANNELS: case ID_POPUP_FAVORITES_EDIT: showHTML("relays.html"); break; case ID_POPUP_ADVANCED_BROADCAST: showHTML("broadcast.html"); break; case ID_POPUP_SETTINGS: showHTML("settings.html"); break; case ID_POPUP_CONNECTIONS: showHTML("connections.html"); break; case ID_POPUP_HELP: sys->getURL("http://www.peercast.org/help.php"); break; case ID_POPUP_SAVE_GUI_POS: if (servMgr->saveGuiPos) { servMgr->saveGuiPos = false; CheckMenuItem(trayMenu, ID_POPUP_SAVE_GUI_POS, MF_UNCHECKED|MF_BYCOMMAND); } else { servMgr->saveGuiPos = true; CheckMenuItem(trayMenu, ID_POPUP_SAVE_GUI_POS, MF_CHECKED|MF_BYCOMMAND); } peercastInst->saveSettings(); break; case ID_POPUP_KEEP_DOWNSTREAMS: if (servMgr->keepDownstreams) { servMgr->keepDownstreams = false; CheckMenuItem(trayMenu, ID_POPUP_KEEP_DOWNSTREAMS, MF_UNCHECKED|MF_BYCOMMAND); } else { servMgr->keepDownstreams = true; CheckMenuItem(trayMenu, ID_POPUP_KEEP_DOWNSTREAMS, MF_CHECKED|MF_BYCOMMAND); } //peercastInst->saveSettings(); break; case ID_POPUP_EXIT_CONFIRM: case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
void PanelButton::setEnabled(bool enable) { QButton::setEnabled(enable); loadIcons(); update(); }
MenuManager::MenuManager(PowerManager *_powers, StatBlock *_stats, CampaignManager *_camp, ItemManager *_items) { powers = _powers; stats = _stats; powers = _powers; camp = _camp; items = _items; loadIcons(); hp = new MenuStatBar("hp"); menus.push_back(hp); // menus[0] mp = new MenuStatBar("mp"); menus.push_back(mp); // menus[1] xp = new MenuStatBar("xp"); menus.push_back(xp); // menus[2] effects = new MenuActiveEffects(icons); menus.push_back(effects); // menus[3] hudlog = new MenuHUDLog(); menus.push_back(hudlog); // menus[4] act = new MenuActionBar(powers, stats, icons); menus.push_back(act); // menus[5] enemy = new MenuEnemy(); menus.push_back(enemy); // menus[6] vendor = new MenuVendor(items, stats); menus.push_back(vendor); // menus[7] talker = new MenuTalker(camp); menus.push_back(talker); // menus[8] exit = new MenuExit(); menus.push_back(exit); // menus[9] mini = new MenuMiniMap(); menus.push_back(mini); // menus[10] chr = new MenuCharacter(stats); menus.push_back(chr); // menus[11] inv = new MenuInventory(items, stats, powers); menus.push_back(inv); // menus[12] pow = new MenuPowers(stats, powers, icons); menus.push_back(pow); // menus[13] log = new MenuLog(); menus.push_back(log); // menus[14] stash = new MenuStash(items, stats); menus.push_back(stash); // menus[15] tip = new WidgetTooltip(); // Load the menu positions and alignments from menus/menus.txt int x,y,w,h; std::string align; int menu_index; FileParser infile; if (infile.open(mods->locate("menus/menus.txt"))) { while (infile.next()) { infile.val = infile.val + ','; x = eatFirstInt(infile.val, ','); y = eatFirstInt(infile.val, ','); w = eatFirstInt(infile.val, ','); h = eatFirstInt(infile.val, ','); align = eatFirstString(infile.val, ','); menu_index = -1; if (infile.key == "hp") menu_index = 0; else if (infile.key == "mp") menu_index = 1; else if (infile.key == "xp") menu_index = 2; else if (infile.key == "effects") menu_index = 3; else if (infile.key == "hudlog") menu_index = 4; else if (infile.key == "actionbar") menu_index = 5; else if (infile.key == "enemy") menu_index = 6; else if (infile.key == "vendor") menu_index = 7; else if (infile.key == "talker") menu_index = 8; else if (infile.key == "exit") menu_index = 9; else if (infile.key == "minimap") menu_index = 10; else if (infile.key == "character") menu_index = 11; else if (infile.key == "inventory") menu_index = 12; else if (infile.key == "powers") menu_index = 13; else if (infile.key == "log") menu_index = 14; else if (infile.key == "stash") menu_index = 15; if (menu_index != -1) { menus[menu_index]->window_area.x = x; menus[menu_index]->window_area.y = y; menus[menu_index]->window_area.w = w; menus[menu_index]->window_area.h = h; menus[menu_index]->alignment = align; menus[menu_index]->align(); } } infile.close(); } else fprintf(stderr, "Unable to open menus/menus.txt!\n"); // Some menus need to be updated to apply their new dimensions act->update(); vendor->update(); vendor->buyback_stock.init(NPC_VENDOR_MAX_STOCK, items); talker->update(); exit->update(); chr->update(); inv->update(); pow->update(); log->update(); stash->update(); pause = false; dragging = false; drag_stack.item = 0; drag_stack.quantity = 0; drag_power = 0; drag_src = 0; drop_stack.item = 0; drop_stack.quantity = 0; loadSounds(); done = false; closeAll(false); // make sure all togglable menus start closed }