void MainWindow::reloadGUI(const std::string& fileName) { std::ifstream guiSettings(fileName); // Remove old elements before creating new ones clearGUI(); if (guiSettings.is_open()) { resetAllTemps(); while (!guiSettings.eof()) { std::string temp; std::getline(guiSettings, temp); parseLine(std::move(temp)); } } }
bool Application::init() { Ui::create_dispatcher(); init_win7_features(); app_->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false); #ifndef INTERNAL_RESOURCES QResource::registerResource(app_->applicationDirPath() + "/qresource"); #endif QPixmapCache::setCacheLimit(0); QObject::connect(Ui::GetDispatcher(), SIGNAL(guiSettings()), this, SLOT(initMainWindow()), Qt::DirectConnection); return true; }
uint16 KyraRpgEngine::processDialogue() { int df = _dialogueHighlightedButton; int res = 0; for (int i = 0; i < _dialogueNumButtons; i++) { int x = _dialogueButtonPosX[i]; int y = ((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1 : (_dialogueButtonYoffs + _dialogueButtonPosY[i])); Common::Point p = getMousePos(); if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonWidth, y + guiSettings()->buttons.height)) { _dialogueHighlightedButton = i; break; } } if (_dialogueNumButtons == 0) { int e = checkInput(0, false) & 0xFF; removeInputTop(); if (e) { gui_notifyButtonListChanged(); if (e == _keyMap[Common::KEYCODE_SPACE] || e == _keyMap[Common::KEYCODE_RETURN]) { snd_stopSpeech(true); } } if (snd_updateCharacterSpeech() != 2) { res = 1; if (!shouldQuit()) { removeInputTop(); gui_notifyButtonListChanged(); } } } else { int e = checkInput(0, false, 0) & 0xFF; removeInputTop(); if (e) gui_notifyButtonListChanged(); if ((_flags.gameID == GI_LOL && (e == 200 || e == 202)) || (_flags.gameID != GI_LOL && (e == 199 || e == 201))) { for (int i = 0; i < _dialogueNumButtons; i++) { int x = _dialogueButtonPosX[i]; int y = (gameFlags().use16ColorMode ? ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1 : (_dialogueButtonYoffs + _dialogueButtonPosY[i])); Common::Point p = getMousePos(); if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonWidth, y + guiSettings()->buttons.height)) { _dialogueHighlightedButton = i; res = _dialogueHighlightedButton + 1; break; } } } else if (e == _keyMap[Common::KEYCODE_SPACE] || e == _keyMap[Common::KEYCODE_RETURN]) { snd_stopSpeech(true); res = _dialogueHighlightedButton + 1; } else if (e == _keyMap[Common::KEYCODE_LEFT] || e == _keyMap[Common::KEYCODE_DOWN]) { if (_dialogueNumButtons > 1 && _dialogueHighlightedButton > 0) _dialogueHighlightedButton--; } else if (e == _keyMap[Common::KEYCODE_RIGHT] || e == _keyMap[Common::KEYCODE_UP]) { if (_dialogueNumButtons > 1 && _dialogueHighlightedButton < (_dialogueNumButtons - 1)) _dialogueHighlightedButton++; } } if (df != _dialogueHighlightedButton) drawDialogueButtons(); screen()->updateScreen(); if (res == 0) return 0; stopPortraitSpeechAnim(); if (game() == GI_LOL) { if (!textEnabled() && _currentControlMode) { screen()->setScreenDim(5); const ScreenDim *d = screen()->getScreenDim(5); screen()->fillRect(d->sx, d->sy + d->h - 9, d->sx + d->w - 1, d->sy + d->h - 1, d->unkA); } else { const ScreenDim *d = screen()->_curDim; if (gameFlags().use16ColorMode) screen()->fillRect(d->sx, d->sy, d->sx + d->w - 3, d->sy + d->h - 2, d->unkA); else screen()->fillRect(d->sx, d->sy, d->sx + d->w - 2, d->sy + d->h - 1, d->unkA); txt()->clearDim(4); txt()->resetDimTextPositions(4); } } return res; }