diff options
Diffstat (limited to 'indexerdialog.cpp')
-rw-r--r-- | indexerdialog.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/indexerdialog.cpp b/indexerdialog.cpp index c9e6ca3..1909c9e 100644 --- a/indexerdialog.cpp +++ b/indexerdialog.cpp @@ -9,16 +9,23 @@ IndexerDialog::IndexerDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){ //indexer mIndexer = new IndexerWidget; + connect(mIndexer, &IndexerWidget::indexingDone, this, &IndexerDialog::indexingCanceled); //buttons - QPushButton *startB = new QPushButton(tr("Start")); - connect(startB, &QPushButton::clicked, mIndexer, &IndexerWidget::startIndexing); - QPushButton *stopB = new QPushButton(tr("Stop")); - connect(stopB, &QPushButton::clicked, mIndexer, &IndexerWidget::stopIndexing); + mStartBtn = new QPushButton(tr("Start")); + connect(mStartBtn, &QPushButton::clicked, mIndexer, &IndexerWidget::startIndexing); + connect(mStartBtn, &QPushButton::clicked, this, &IndexerDialog::indexingStarted); + mCancelBtn = new QPushButton(tr("Cancel")); + mCancelBtn->setEnabled(false); + connect(mCancelBtn, &QPushButton::clicked, mIndexer, &IndexerWidget::stopIndexing); + connect(mCancelBtn, &QPushButton::clicked, this, &IndexerDialog::indexingCanceled); + mCloseBtn = new QPushButton(tr("Close")); + connect(mCloseBtn, &QPushButton::clicked, this, &IndexerDialog::close); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(); - buttonLayout->addWidget(startB); - buttonLayout->addWidget(stopB); + buttonLayout->addWidget(mStartBtn); + buttonLayout->addWidget(mCancelBtn); + buttonLayout->addWidget(mCloseBtn); buttonLayout->addStretch(); //mainlayout @@ -29,3 +36,15 @@ IndexerDialog::IndexerDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(paren setWindowTitle(QString(tr("%1 - Indexer")).arg(qApp->applicationName())); setMinimumWidth(768); } + +void IndexerDialog::indexingStarted(){ + mStartBtn->setEnabled(false); + mCancelBtn->setEnabled(true); + mCloseBtn->setEnabled(false); +} + +void IndexerDialog::indexingCanceled(){ + mStartBtn->setEnabled(true); + mCancelBtn->setEnabled(false); + mCloseBtn->setEnabled(true); +} |