//---------------------------------------------------------------------- // Save Single File Dialog Widget //---------------------------------------------------------------------- SaveSingleDialogWidget::SaveSingleDialogWidget(MainWindow *mainWindow, RideItem *rideItem) : QDialog(mainWindow, Qt::Dialog), mainWindow(mainWindow), rideItem(rideItem) { setWindowTitle(tr("Save and Conversion")); QVBoxLayout *mainLayout = new QVBoxLayout(this); // Warning text warnText = new QLabel(tr("WARNING\n\nYou have made changes to ") + rideItem->fileName + tr(" If you want to save\nthem, we need to convert the ride to GoldenCheetah\'s\nnative format. Should we do so?\n")); mainLayout->addWidget(warnText); // Buttons QHBoxLayout *buttonLayout = new QHBoxLayout; saveButton = new QPushButton(tr("&Save and Convert"), this); buttonLayout->addWidget(saveButton); abandonButton = new QPushButton(tr("&Discard Changes"), this); buttonLayout->addWidget(abandonButton); cancelButton = new QPushButton(tr("&Cancel Save"), this); buttonLayout->addWidget(cancelButton); mainLayout->addLayout(buttonLayout); // Don't warn me! warnCheckBox = new QCheckBox(tr("Always warn me about file conversions"), this); warnCheckBox->setChecked(true); mainLayout->addWidget(warnCheckBox); // connect up slots connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked())); connect(abandonButton, SIGNAL(clicked()), this, SLOT(abandonClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(warnCheckBox, SIGNAL(clicked()), this, SLOT(warnSettingClicked())); }
SaveOnExitDialogWidget::SaveOnExitDialogWidget(MainWindow *mainWindow, QList<RideItem *>dirtyList) : QDialog(mainWindow, Qt::Dialog), mainWindow(mainWindow), dirtyList(dirtyList) { setWindowTitle("Save Changes"); QVBoxLayout *mainLayout = new QVBoxLayout(this); // Warning text warnText = new QLabel(tr("WARNING\n\nYou have made changes to some rides which\nhave not been saved. They are listed below.")); mainLayout->addWidget(warnText); // File List dirtyFiles = new QTableWidget(dirtyList.count(), 0, this); dirtyFiles->setColumnCount(2); dirtyFiles->horizontalHeader()->hide(); dirtyFiles->verticalHeader()->hide(); // Populate with dirty List for (int i=0; i<dirtyList.count(); i++) { // checkbox QCheckBox *c = new QCheckBox; c->setCheckState(Qt::Checked); dirtyFiles->setCellWidget(i,0,c); // filename QTableWidgetItem *t = new QTableWidgetItem; t->setText(dirtyList.at(i)->fileName); t->setFlags(t->flags() & (~Qt::ItemIsEditable)); dirtyFiles->setItem(i,1,t); } // prettify the list dirtyFiles->setShowGrid(false); dirtyFiles->resizeColumnToContents(0); dirtyFiles->resizeColumnToContents(1); mainLayout->addWidget(dirtyFiles); // Buttons QHBoxLayout *buttonLayout = new QHBoxLayout; saveButton = new QPushButton(tr("&Save and Exit"), this); buttonLayout->addWidget(saveButton); abandonButton = new QPushButton(tr("&Discard and Exit"), this); buttonLayout->addWidget(abandonButton); cancelButton = new QPushButton(tr("&Cancel Exit"), this); buttonLayout->addWidget(cancelButton); mainLayout->addLayout(buttonLayout); // Don't warn me! exitWarnCheckBox = new QCheckBox(tr("Always check for unsaved changes on exit"), this); exitWarnCheckBox->setChecked(true); mainLayout->addWidget(exitWarnCheckBox); // connect up slots connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked())); connect(abandonButton, SIGNAL(clicked()), this, SLOT(abandonClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(exitWarnCheckBox, SIGNAL(clicked()), this, SLOT(warnSettingClicked())); }
void MainWindow::initiateWindowWidgets() { okButton->setEnabledPixmap(QPixmap("images/button/ok.png")); okButton->setDisabledPixmap(QPixmap("images/button/ok-disabled.png")); connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked())); cancelButton->setEnabledPixmap(QPixmap("images/button/cancel.png")); cancelButton->setDisabledPixmap( QPixmap("images/button/cancel-disabled.png")); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); abandonButton->setEnabledPixmap(QPixmap("images/button/discard.png")); abandonButton->setDisabledPixmap( QPixmap("images/button/discard-disabled.png")); connect(abandonButton, SIGNAL(clicked()), this, SLOT(abandonClicked())); quitButton->setEnabledPixmap(QPixmap("images/button/close.png")); quitButton->setDisabledPixmap(QPixmap("images/button/close.png")); quitButton->setPressedPixmap(QPixmap("images/button/close-pressed.png")); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); aboutButton->setEnabledPixmap(QPixmap("images/button/enabled-big.png")); aboutButton->setDisabledPixmap(QPixmap("images/button/disabled-big.png")); aboutButton->setPressedPixmap(QPixmap("images/button/pressed-big.png")); bigPauseButton->setEnabledPixmap( QPixmap("images/button/enabled-large.png")); bigPauseButton->setDisabledPixmap( QPixmap("images/button/disabled-large.png")); bigPauseButton->setPressedPixmap( QPixmap("images/button/pressed-large.png")); connect(bigPauseButton, SIGNAL(clicked()), pauseButton, SLOT(click())); helpButton->setEnabledPixmap(QPixmap("images/button/enabled-large.png")); helpButton->setDisabledPixmap(QPixmap("images/button/disabled-large.png")); helpButton->setPressedPixmap(QPixmap("images/button/pressed-large.png")); tipBox = new MessageBox(this); tipBox->hide(); pauseBox = new MessageBox(this); pauseBox->hide(); cardContainer = new CardContainer(this); cardContainer->hide(); wujiangChooseBox = new WujiangChooseBox(this); wujiangChooseBox->hide(); guanxingBox = new GuanxingBox(this); guanxingBox->hide(); zhuangbeiLabel = new ZhuangbeiLabel(this); zhuangbeiLabel->hide(); aboutFrame = new AboutFrame(this); aboutFrame->hide(); connect(aboutButton, SIGNAL(clicked()), aboutFrame, SLOT(showAboutInfo())); helpBox = new HelpBox(this); helpBox->hide(); connect(helpButton, SIGNAL(clicked()), helpBox, SLOT(displayHelp())); wugufengdengBox = new WugufengdengBox(this); wugufengdengBox->hide(); fanjianBox = new FanjianBox(this); fanjianBox->hide(); cardViewer = new CardViewer(this); cardViewer->hide(); gameOverBox = new GameOverBox(this); gameOverBox->hide(); cardDeckLabel->hide(); blockingFrameMovingAnimation = new QPropertyAnimation(this); blockingFrameMovingAnimation->setPropertyName("pos"); blockingFrameMovingAnimation->setDuration( GUIStaticData::blockingFrameMovingDuration); debugCheckBox->hide(); debugTabWidget->hide(); testWidget->hide(); connect(pauseButton, SIGNAL(clicked()), this, SLOT(pauseClicked())); checkButtons(); }