예제 #1
0
void Engine::openMainMenuDialog() {
	if (!_mainMenuDialog)
		_mainMenuDialog = new MainMenuDialog(this);

	setGameToLoadSlot(-1);

	runDialog(*_mainMenuDialog);

	// Load savegame after main menu execution
	// (not from inside the menu loop to avoid
	// mouse cursor glitches and simliar bugs,
	// e.g. #2822778).
	if (_saveSlotToLoad >= 0) {
		Common::Error status = loadGameState(_saveSlotToLoad);
		if (status.getCode() != Common::kNoError) {
			Common::String failMessage = Common::String::format(_("Failed to load saved game (%s)! "
				  "Please consult the README for basic information, and for "
				  "instructions on how to obtain further assistance."), status.getDesc().c_str());
			GUI::MessageDialog dialog(failMessage);
			dialog.runModal();
		}
	}

	syncSoundSettings();
}
예제 #2
0
bool PasswordRecoveryDialog::run(NetworkAuthenticationManager &mgr) {
	std::string errorMessage;
	std::string email;
	while (true) {
		if (!runDialog(email, errorMessage)) {
			LogOutRunnable logout(mgr);
			logout.executeWithUI();
			return false;
		}

		PasswordRecoveryRunnable recovery(mgr, email);
		recovery.executeWithUI();
		if (recovery.hasErrors()) {
			errorMessage = recovery.errorMessage();
			LogOutRunnable logout(mgr);
			logout.executeWithUI();
			continue;
		}

		ZLResourceKey boxKey("recoverySuccessfulBox");
		const std::string message =
			ZLStringUtil::printf(ZLDialogManager::dialogMessage(boxKey), email);
		ZLDialogManager::Instance().informationBox(boxKey, message);

		return true;
	}
}
예제 #3
0
//=====================================
// slotSelected
//-------------------------------------
void SCCFrame::slotSelected ( Q3ListBoxItem* item ) {
	// .../
	// if the selection has changed this method is called.
	// the selection will be copied to be shown as module title
	// and the runDialog() method is called to start the dialog
	// ----
	//=====================================
	// get translation pointer
	//-------------------------------------
	SCCWrapPointer< Q3Dict<QString> > mText (getTextPtr());

	//=====================================
	// prepare module title text/pixmap
	//-------------------------------------
	QPixmap titlePixmap;
	QString selection = item -> text();
	QString titletext = selection;
	if (selection == mText["MonitorModule"]) {
		titletext   = mText["MonitorModuleTopic"];
		titlePixmap = QPixmap ( SMALL_MONITORS_PIXMAP );
	}
	if (selection == mText["MouseModule"]) {
		titletext   = mText["MouseModuleTopic"];
		titlePixmap = QPixmap ( SMALL_POINTERS_PIXMAP );
	}
	if (selection == mText["KeyboardModule"]) {
		titletext   = mText["KeyboardModuleTopic"];
		titlePixmap = QPixmap ( SMALL_KEYBOARD_PIXMAP );
	}
	if (selection == mText["TabletModule"]) {	
		titletext   = mText["TabletModuleTopic"];
		titlePixmap = QPixmap ( SMALL_XTABLETS_PIXMAP );
	}
	if (selection == mText["ToucherModule"]) {
		titletext   = mText["ToucherModuleTopic"];
		titlePixmap = QPixmap ( SMALL_TOUCHERS_PIXMAP );
	}
	if (selection == mText["VNCModule"]) {
		titletext   = mText["VNCModuleTopic"];
		titlePixmap = QPixmap ( SMALL_VNCSERVE_PIXMAP );
	}
	if (qApp->desktop()->height() > 600) {
		mModuleTitle -> setText ( titletext );
		mModuleTitleIcon -> setPixmap ( titlePixmap );
	}
	//=====================================
	// run the selected dialog
	//-------------------------------------
	runDialog ( item );
}
/**
 * Constructor.
 * @param property :: A property to edit.
 * @param parent :: A widget parent for the editor widget.
 */
DoubleDialogEditor::DoubleDialogEditor(QtProperty *property, QWidget *parent):QWidget(parent),m_property(property)
{
  QHBoxLayout *layout = new QHBoxLayout;
  m_editor = new DoubleEditor(property, this);
  layout->addWidget(m_editor);
  setFocusProxy(m_editor);
  setFocusPolicy(Qt::StrongFocus);

  m_button = new QPushButton("...",this);
  m_button->setMaximumSize(20,1000000);
  connect(m_button,SIGNAL(clicked()),this,SLOT(runDialog()));
  layout->addWidget(m_button);
  layout->setContentsMargins(0,0,0,0);
  layout->setSpacing(0);
  layout->setStretchFactor(m_button,0);
  this->setLayout(layout);

  m_editor->installEventFilter(this);
  m_button->installEventFilter(this);
}
예제 #5
0
void Engine::openMainMenuDialog() {
	if (!_mainMenuDialog)
		_mainMenuDialog = new MainMenuDialog(this);

	setGameToLoadSlot(-1);

	runDialog(*_mainMenuDialog);

	// Load savegame after main menu execution
	// (not from inside the menu loop to avoid
	// mouse cursor glitches and simliar bugs,
	// e.g. #2822778).
	// FIXME: For now we just ignore the return
	// value, which is quite bad since it could
	// be a fatal loading error, which renders
	// the engine unusable.
	if (_saveSlotToLoad >= 0)
		loadGameState(_saveSlotToLoad);

	syncSoundSettings();
}
StringDialogEditor::StringDialogEditor(QtProperty *property, QWidget *parent):QWidget(parent),m_property(property)
{
  QHBoxLayout *layout = new QHBoxLayout;
  m_lineEdit = new QLineEdit(this);
  layout->addWidget(m_lineEdit);
  setFocusProxy(m_lineEdit);
  connect(m_lineEdit,SIGNAL(editingFinished()),this,SLOT(updateProperty()));
  QtStringPropertyManager* mgr = dynamic_cast<QtStringPropertyManager*>(property->propertyManager());
  if (mgr)
  {
    m_lineEdit->setText(mgr->value(property));
  }

  QPushButton* button = new QPushButton("...",this);
  button->setMaximumSize(20,1000000);
  connect(button,SIGNAL(clicked()),this,SLOT(runDialog()));
  layout->addWidget(button);
  layout->setContentsMargins(0,0,0,0);
  layout->setSpacing(0);
  layout->setStretchFactor(button,0);
  this->setLayout(layout);
}
bool AuthenticationDialog::run(NetworkAuthenticationManager &mgr) {
	std::string errorMessage;
	UserList userList;
	while (true) {
		std::string password;
		if (!runDialog(mgr, userList, errorMessage, password)) {
			LogOutRunnable logout(mgr);
			logout.executeWithUI();
			return false;
		}

		if (mgr.UserNameOption.value().empty()) {
			const ZLResource &resource = ZLResource::resource("dialog")["AuthenticationDialog"];
			errorMessage = resource["loginIsEmpty"].value();
			continue;
		}

		AuthoriseRunnable authoriser(mgr, password);
		authoriser.executeWithUI();
		if (authoriser.hasErrors()) {
			errorMessage = authoriser.errorMessage();
			LogOutRunnable logout(mgr);
			logout.executeWithUI();
			continue;
		}
		if (mgr.needsInitialization()) {
			InitializeAuthenticationManagerRunnable initializer(mgr);
			initializer.executeWithUI();
			if (initializer.hasErrors()) {
				errorMessage = initializer.errorMessage();
				LogOutRunnable logout(mgr);
				logout.executeWithUI();
				continue;
			}
		}
		userList.saveUser(mgr.currentUserName());
		return true;
	}
}
예제 #8
0
void MohawkEngine::pauseGame() {
    runDialog(*_pauseDialog);
}
예제 #9
0
파일: engine.cpp 프로젝트: jvprat/residual
void Engine::openMainMenuDialog() {
	if (!_mainMenuDialog)
		_mainMenuDialog = new MainMenuDialog(this);
	runDialog(*_mainMenuDialog);
	syncSoundSettings();
}
예제 #10
0
void MohawkEngine_Riven::doFrame() {
	// Update background running things
	_sound->updateSLST();
	_video->updateMovies();

	if (!_scriptMan->hasQueuedScripts()) {
		_stack->keyResetAction();
	}

	Common::Event event;
	while (_eventMan->pollEvent(event)) {
		switch (event.type) {
		case Common::EVENT_MOUSEMOVE:
			_stack->onMouseMove(event.mouse);
			break;
		case Common::EVENT_LBUTTONDOWN:
			_stack->onMouseDown(_eventMan->getMousePos());
			break;
		case Common::EVENT_LBUTTONUP:
			_stack->onMouseUp(_eventMan->getMousePos());
			_inventory->checkClick(_eventMan->getMousePos());
			break;
		case Common::EVENT_KEYUP:
			_stack->keyResetAction();
			break;
		case Common::EVENT_KEYDOWN:
			switch (event.kbd.keycode) {
			case Common::KEYCODE_d:
				if (event.kbd.flags & Common::KBD_CTRL) {
					_console->attach();
					_console->onFrame();
				}
				break;
			case Common::KEYCODE_SPACE:
				pauseGame();
				break;
			case Common::KEYCODE_F5:
				runDialog(*_optionsDialog);
				if (_optionsDialog->getLoadSlot() >= 0)
					loadGameStateAndDisplayError(_optionsDialog->getLoadSlot());
				_gfx->setTransitionMode((RivenTransitionMode) _vars["transitionmode"]);
				_card->initializeZipMode();
				break;
			case Common::KEYCODE_r:
				// Return to the main menu in the demo on ctrl+r
				if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) {
					if (_stack->getId() != kStackAspit)
						changeToStack(kStackAspit);
					changeToCard(1);
				}
				break;
			case Common::KEYCODE_p:
				// Play the intro videos in the demo on ctrl+p
				if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) {
					if (_stack->getId() != kStackAspit)
						changeToStack(kStackAspit);
					changeToCard(6);
				}
				break;
			default:
				if (event.kbdRepeat) {
					continue;
				}
				_stack->onKeyPressed(event.kbd);
				break;
			}
			break;
		default:
			break;
		}
	}

	_stack->onFrame();

	if (!_scriptMan->runningQueuedScripts()) {
		// Don't run queued scripts if we are calling from a queued script
		// otherwise infinite looping will happen.
		_scriptMan->runQueuedScripts();
	}

	_inventory->onFrame();

	// Update the screen once per frame
	_system->updateScreen();

	// Cut down on CPU usage
	_system->delayMillis(10);
}
예제 #11
0
void MohawkEngine_Riven::handleEvents() {
	// Update background running things
	checkTimer();
	bool needsUpdate = _gfx->runScheduledWaterEffects();
	needsUpdate |= _video->updateMovies();

	Common::Event event;

	while (_eventMan->pollEvent(event)) {
		switch (event.type) {
		case Common::EVENT_MOUSEMOVE:
			checkHotspotChange();

			if (!(getFeatures() & GF_DEMO)) {
				// Check to show the inventory, but it is always "showing" in the demo
				if (_eventMan->getMousePos().y >= 392)
					_gfx->showInventory();
				else
					_gfx->hideInventory();
			}

			needsUpdate = true;
			break;
		case Common::EVENT_LBUTTONDOWN:
			if (_curHotspot >= 0) {
				checkSunnerAlertClick();
				runHotspotScript(_curHotspot, kMouseDownScript);
			}
			break;
		case Common::EVENT_LBUTTONUP:
			// See RivenScript::switchCard() for more information on why we sometimes
			// disable the next up event.
			if (!_ignoreNextMouseUp) {
				if (_curHotspot >= 0)
					runHotspotScript(_curHotspot, kMouseUpScript);
				else
					checkInventoryClick();
			}
			_ignoreNextMouseUp = false;
			break;
		case Common::EVENT_KEYDOWN:
			switch (event.kbd.keycode) {
			case Common::KEYCODE_d:
				if (event.kbd.flags & Common::KBD_CTRL) {
					_console->attach();
					_console->onFrame();
				}
				break;
			case Common::KEYCODE_SPACE:
				pauseGame();
				break;
			case Common::KEYCODE_F4:
				_showHotspots = !_showHotspots;
				if (_showHotspots) {
					for (uint16 i = 0; i < _hotspotCount; i++)
						_gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled);
					needsUpdate = true;
				} else
					refreshCard();
				break;
			case Common::KEYCODE_F5:
				runDialog(*_optionsDialog);
				updateZipMode();
				break;
			case Common::KEYCODE_r:
				// Return to the main menu in the demo on ctrl+r
				if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) {
					if (_curStack != kStackAspit)
						changeToStack(kStackAspit);
					changeToCard(1);
				}
				break;
			case Common::KEYCODE_p:
				// Play the intro videos in the demo on ctrl+p
				if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) {
					if (_curStack != kStackAspit)
						changeToStack(kStackAspit);
					changeToCard(6);
				}
				break;
			default:
				break;
			}
			break;
		default:
			break;
		}
	}

	if (_curHotspot >= 0)
		runHotspotScript(_curHotspot, kMouseInsideScript);

	// Update the screen if we need to
	if (needsUpdate)
		_system->updateScreen();

	// Cut down on CPU usage
	_system->delayMillis(10);
}
예제 #12
0
파일: GuiApp.cpp 프로젝트: bketech/element
    bool GuiApp::perform (const InvocationInfo& info)
    {


        if (Commands::devicePadPress <= info.commandID
                && (Commands::devicePadPress + 13) > info.commandID)
        {
            const uint16 pad = info.commandID - Commands::devicePadPress;
            //ModifierKeys modKeys = ModifierKeys::getCurrentModifiersRealtime();
            //unsigned long modifiers = 13;//kNoModifiers;

            if (info.isKeyDown)
                std::clog << "Pad pressed: " << pad << std::endl;
            else
                std::clog << "Pad released: " << pad << std::endl;
        }

        if (Commands::isDeviceTrackCommand (info.commandID)) {
        //    pattern->setTrackIndex (info.commandID - Commands::deviceTrack);
            return true;
        }

        SessionRef sr (session());

        switch (info.commandID)
        {
            case Commands::mediaSave: {
                //if (MediaManager::Document* doc = sr->media().openFile (sr.get(), pattern->getFile()))
                 //   doc->save();
                return true;
            }
            case Commands::sessionClose:
                return true;
                break;
            case Commands::sessionNew:
                newSession();
                return true;
                break;
            case Commands::sessionOpen:
                openSession();
                return true;
                break;
            case Commands::sessionSave:
            {
                saveSession();
                return true;
                break;
            }
            case Commands::sessionSaveAs:
                saveSession (true);
                return true;
                break;
            case Commands::showAbout:
                return true;
                break;
            case Commands::showLegacyView:
                openWindow (ELEMENT_LEGACY_WINDOW);
                return true;
                break;
            case Commands::showPluginManager:
                openWindow (ELEMENT_PLUGIN_MANAGER);
                return true;
                break;
            case Commands::showPreferences:
                runDialog (ELEMENT_PREFERENCES);
                return true;
            break;
            case Commands::transportRewind:
                break;
            case Commands::transportForward:
                break;
            case Commands::transportPlay:
                sr->testSetPlaying (true);
                break;
            case Commands::transportRecord:
                break;
            case Commands::transportSeekZero:
                break;
            case Commands::transportStop:
                sr->testSetRecording (false);
                sr->testSetPlaying (false);
                break;
        }
        return true;
    }
예제 #13
0
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE h0, LPWSTR cmdLine, int cmdShow)
{
	int ret = runDialog(hInst, cmdShow, DLG_MAIN, ICO_FROG, 0, Main_dialogProc, 0);
	_ASSERT(!_CrtDumpMemoryLeaks());
	return ret;
}