MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { QTextStream out(stdout); //for debug ui->setupUi(this); setWindowTitle("Zoggle"); gameRunning = false; setupDice(); spellChecker = Hunspell_create("en_US.aff","en_US.dic"); if(Hunspell_spell(spellChecker,"GEO")) { out << "GEO is a word\n"; } if(Hunspell_spell(spellChecker,"geo")) { out << "geo is a word\n"; } if(Hunspell_spell(spellChecker,"Geo")) { out << "Geo is a word\n"; } timeRemaining = TOTAL_TIME; //in seconds; ui->timeBar->setMaximum(TOTAL_TIME); ui->timeBar->setValue(TOTAL_TIME - timeRemaining); ui->timeRemaining->display(timeRemaining); QPalette timePalette = ui->timeRemaining->palette(); timePalette.setColor(QPalette::Foreground, QColor("green")); ui->timeRemaining->setPalette(timePalette); timePalette = ui->timeBar->palette(); timePalette.setColor(QPalette::Highlight, QColor("green")); ui->timeBar->setPalette(timePalette); ui->calculateBar->setValue(0); ui->calculateBar->setEnabled(false); connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(close())); connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newGame())); connect(ui->newWord,SIGNAL(returnPressed()),this,SLOT(addToList())); ui->newWord->setFocus(); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateTimeRemaining())); //validWords->setup(button,buttonLink); }
m_scrollArea->setWidget(m_container); m_scrollArea->setWidgetResizable(true); m_vbox->setContentsMargins(0, 0, 0, 0); m_layout->addWidget(m_timeLabel, 0, 0); m_layout->addWidget(m_scrollArea, 1, 0); m_layout->addWidget(m_buttonBox, 1, 1); m_layout->setRowStretch(1, 1); foreach (const QVariant &setting, settings) { addWidget(setting.toMap()); } connect(m_timer, SIGNAL(timeout()), this, SLOT(updateTimeRemaining())); connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); } QVariantMap PluginSettingsDialog::settings() const { return m_settings; } int PluginSettingsDialog::timeout() const { return m_timeout; } void PluginSettingsDialog::setTimeout(int t) { m_timeout = t; m_remaining = t;
void LoadingBar::increaseProgress(int iIterations) const { this->dProgress += this->dStepSize * iIterations; updateTimeRemaining(this->iImageSize); }