void MainWindow::showLanguageIn2(int i){ if(i!=0){ showLanguage(i-1,2); }else{ ui->languageDisplay_2->setText(""); } }
void PropertiesPalette_Text::updateStyle(const ParagraphStyle& newCurrent) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; const CharStyle& charStyle = newCurrent.charStyle(); advancedWidgets->updateStyle(newCurrent); fontfeaturesWidget->updateStyle(newCurrent); colorWidgets->updateStyle(newCurrent); optMargins->updateStyle(newCurrent); orphanBox->updateStyle (newCurrent); parEffectWidgets->updateStyle(newCurrent); hyphenationWidget->updateStyle(newCurrent); showFontFace(charStyle.font().scName()); showFontSize(charStyle.fontSize()); showLanguage(charStyle.language()); bool tmp = m_haveItem; m_haveItem = false; setupLineSpacingSpinbox(newCurrent.lineSpacingMode(), newCurrent.lineSpacing()); lineSpacingModeCombo->setCurrentIndex(newCurrent.lineSpacingMode()); textAlignment->setStyle(newCurrent.alignment(), newCurrent.direction()); textDirection->setStyle(newCurrent.direction()); m_haveItem = tmp; }
void PropertiesPalette_Text::updateCharStyle(const CharStyle& charStyle) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; advancedWidgets->updateCharStyle(charStyle); fontfeaturesWidget->updateCharStyle(charStyle); colorWidgets->updateCharStyle(charStyle); hyphenationWidget->updateCharStyle(charStyle); showFontFace(charStyle.font().scName()); showFontSize(charStyle.fontSize()); showLanguage(charStyle.language()); }
void SMCStyleWidget::show(QList<CharStyle*> &cstyles, QList<CharStyle> &cstylesAll, const QString &defLang, int unitIndex) { // int decimals = unitGetDecimalsFromIndex(unitIndex); // QString suffix = unitGetSuffixFromIndex(unitIndex); if (cstyles.count() == 1) show(cstyles[0], cstylesAll, defLang, unitIndex); else if (cstyles.count() > 1) { showSizeAndPosition(cstyles); showEffects(cstyles); showColors(cstyles); showLanguage(cstyles, defLang); showParent(cstyles); } }
Window::Window(const QString& file) : m_pause_action(0), m_previous_state(0) { setAcceptDrops(true); // Create states m_states.insert("NewGame", new NewGameState(this)); m_states.insert("OpenGame", new OpenGameState(this)); m_states.insert("Optimizing", new OptimizingState(this)); m_states.insert("Play", new PlayState(this)); m_states.insert("AutoPause", new AutoPauseState(this)); m_states.insert("Pause", new PauseState(this)); m_states.insert("Finish", new FinishState(this)); m_state = m_states.value("NewGame"); // Create widgets m_contents = new QStackedWidget(this); setCentralWidget(m_contents); m_board = new Board(this); m_contents->addWidget(m_board); connect(m_board, &Board::started, this, &Window::gameStarted); connect(m_board, &Board::finished, this, &Window::gameFinished); connect(m_board, &Board::optimizingStarted, this, &Window::optimizingStarted); connect(m_board, &Board::optimizingFinished, this, &Window::optimizingFinished); // Create pause screen m_pause_screen = new QLabel(tr("<p><b><big>Paused</big></b><br>Click to resume playing.</p>"), this); m_pause_screen->setAlignment(Qt::AlignCenter); m_pause_screen->installEventFilter(this); m_contents->addWidget(m_pause_screen); // Create open game screen QLabel* open_game_screen = new QLabel(tr("<p><b><big>Please wait</big></b><br>Loading game...</p>"), this); open_game_screen->setAlignment(Qt::AlignCenter); m_contents->addWidget(open_game_screen); // Create start screen QLabel* start_screen = new QLabel(tr("Click to start a new game."), this); start_screen->setAlignment(Qt::AlignCenter); start_screen->installEventFilter(this); m_contents->addWidget(start_screen); // Create new game screen QLabel* new_game_screen = new QLabel(tr("<p><b><big>Please wait</big></b><br>Generating a new board...</p>"), this); new_game_screen->setAlignment(Qt::AlignCenter); m_contents->addWidget(new_game_screen); // Create optimizing screen QLabel* optimizing_screen = new QLabel(tr("<p><b><big>Please wait</big></b><br>Optimizing word list...</p>"), this); optimizing_screen->setAlignment(Qt::AlignCenter); m_contents->addWidget(optimizing_screen); // Create game menu QMenu* menu = menuBar()->addMenu(tr("&Game")); menu->addAction(tr("New &Game..."), this, SLOT(newGame()), tr("Ctrl+Shift+N")); menu->addAction(tr("&New Roll"), this, SLOT(newRoll()), QKeySequence::New); menu->addAction(tr("&Choose..."), this, SLOT(chooseGame())); menu->addAction(tr("&Share..."), this, SLOT(shareGame())); menu->addSeparator(); QAction* end_action = menu->addAction(tr("&End"), this, SLOT(endGame())); end_action->setEnabled(false); connect(m_board, &Board::pauseAvailable, end_action, &QAction::setEnabled); m_pause_action = menu->addAction(tr("&Pause")); m_pause_action->setCheckable(true); m_pause_action->setShortcut(tr("Ctrl+P")); m_pause_action->setEnabled(false); connect(m_pause_action, &QAction::triggered, this, &Window::setPaused); connect(m_board, &Board::pauseAvailable, m_pause_action, &QAction::setEnabled); menu->addSeparator(); m_details_action = menu->addAction(tr("&Details"), this, SLOT(showDetails())); m_details_action->setEnabled(false); menu->addAction(tr("&High Scores"), this, SLOT(showScores())); menu->addSeparator(); QAction* action = menu->addAction(tr("&Quit"), this, SLOT(close()), tr("Ctrl+Q")); action->setMenuRole(QAction::QuitRole); monitorVisibility(menu); // Create settings menu menu = menuBar()->addMenu(tr("&Settings")); QMenu* submenu = menu->addMenu(tr("Show &Maximum Score")); QAction* score_actions[3]; score_actions[0] = submenu->addAction(tr("&Never")); score_actions[1] = submenu->addAction(tr("&End Of Game")); score_actions[2] = submenu->addAction(tr("&Always")); QActionGroup* group = new QActionGroup(this); for (int i = 0; i < 3; ++i) { score_actions[i]->setData(i); score_actions[i]->setCheckable(true); group->addAction(score_actions[i]); } connect(group, &QActionGroup::triggered, m_board, &Board::setShowMaximumScore); QAction* missed_action = menu->addAction(tr("Show Missed &Words")); missed_action->setCheckable(true); connect(missed_action, &QAction::toggled, m_board, &Board::setShowMissedWords); QAction* counts_action = menu->addAction(tr("Show Word &Counts")); counts_action->setCheckable(true); counts_action->setChecked(true); connect(counts_action, &QAction::toggled, m_board, &Board::setShowWordCounts); menu->addAction(tr("&Board Language..."), this, SLOT(showLanguage())); menu->addSeparator(); menu->addAction(tr("Application &Language..."), this, SLOT(showLocale())); monitorVisibility(menu); // Create help menu menu = menuBar()->addMenu(tr("&Help")); menu->addAction(tr("&Controls"), this, SLOT(showControls())); menu->addSeparator(); action = menu->addAction(tr("&About"), this, SLOT(about())); action->setMenuRole(QAction::AboutRole); action = menu->addAction(tr("About &Hspell"), this, SLOT(aboutHspell())); action->setMenuRole(QAction::ApplicationSpecificRole); action = menu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); action->setMenuRole(QAction::AboutQtRole); action = menu->addAction(tr("About &SCOWL"), this, SLOT(aboutScowl())); action->setMenuRole(QAction::ApplicationSpecificRole); monitorVisibility(menu); // Load settings QSettings settings; QAction* score_action = score_actions[qBound(0, settings.value("ShowMaximumScore", 1).toInt(), 2)]; score_action->setChecked(true); m_board->setShowMaximumScore(score_action); missed_action->setChecked(settings.value("ShowMissed", true).toBool()); counts_action->setChecked(settings.value("ShowWordCounts", true).toBool()); restoreGeometry(settings.value("Geometry").toByteArray()); // Start game QString current = file; if (settings.contains("Current/Version")) { if (current.isEmpty() || QMessageBox::question(this, tr("Question"), tr("End the current game?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) { current = ":saved:"; } } m_state->finish(); m_contents->setCurrentIndex(3); if (current.isEmpty()) { newGame(); } else { startGame(current); } }