summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Keller <rainer.keller@theqtcompany.com>2015-04-15 10:08:27 +0200
committerRainer Keller <rainer.keller@theqtcompany.com>2015-04-20 15:05:03 +0300
commitda66ed8ce7421506ddeb4e7feea13987c26620c7 (patch)
tree5510857b5591f9f1f902ca91e14fba34662baf71
parent8d960279e3398375f2b9cea242289be562332b9a (diff)
b2qt-flashing-wizard: Hints for users to find error messages more easily
If the image creation fails the details widget is opened and scrolled to bottom automatically. Also the progressbar is disabled to indicate a stop. Change-Id: I74573a2b19d915ac90a12645e3e806a979f74baf Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
-rw-r--r--src/b2qt-flashing-wizard/progress_page.cpp43
-rw-r--r--src/b2qt-flashing-wizard/progress_page.h4
2 files changed, 35 insertions, 12 deletions
diff --git a/src/b2qt-flashing-wizard/progress_page.cpp b/src/b2qt-flashing-wizard/progress_page.cpp
index 567d986..d518b44 100644
--- a/src/b2qt-flashing-wizard/progress_page.cpp
+++ b/src/b2qt-flashing-wizard/progress_page.cpp
@@ -26,6 +26,7 @@
#include <QLayout>
#include <QProgressBar>
#include <QPushButton>
+#include <QScrollBar>
#include <QTextEdit>
#include <QTimer>
@@ -37,13 +38,14 @@ ProgressPage::ProgressPage(QWidget *parent)
, mTextEdit(new QTextEdit(this))
, mToggleDetailsButton(new QPushButton(this))
, mCopyToClipboardButton(new QPushButton(this))
+ , mProgressBar(0)
{
setTitle(tr("Disk Creation"));
setSubTitle(tr("Writing the hardware platform image to the disk"));
setLayout(new QVBoxLayout(this));
- QProgressBar *progressBar = new QProgressBar(this);
- progressBar->setRange(0, 0);
- layout()->addWidget(progressBar);
+ mProgressBar = new QProgressBar(this);
+ mProgressBar->setRange(0, 0);
+ layout()->addWidget(mProgressBar);
mProgress->setWordWrap(true);
mProgress->setText(tr("Preparing the disk device..."));
layout()->addWidget(mProgress);
@@ -91,6 +93,14 @@ void ProgressPage::failed(const QString &message)
{
mFinished = false;
emit completeChanged();
+ showDetails();
+ mProgressBar->setEnabled(false);
+ mProgressBar->setRange(0, 100);
+ mProgressBar->setValue(100);
+ mProgressBar->setFormat("");
+
+ // Scroll to bottom
+ mTextEdit->verticalScrollBar()->setValue(mTextEdit->verticalScrollBar()->maximum());
mProgress->setText(message);
}
@@ -110,17 +120,26 @@ void ProgressPage::addDetails(QByteArray newData)
mTextEdit->append(QString::fromLocal8Bit(newData));
}
+void ProgressPage::showDetails()
+{
+ mTextEdit->show();
+ mCopyToClipboardButton->show();
+ mToggleDetailsButton->setText(tr("Hide details"));
+}
+
+void ProgressPage::hideDetails()
+{
+ mTextEdit->hide();
+ mCopyToClipboardButton->hide();
+ mToggleDetailsButton->setText(tr("Show details"));
+}
+
void ProgressPage::toggleDetails()
{
- if (mTextEdit->isHidden()) {
- mTextEdit->show();
- mCopyToClipboardButton->show();
- mToggleDetailsButton->setText(tr("Hide details"));
- } else {
- mTextEdit->hide();
- mCopyToClipboardButton->hide();
- mToggleDetailsButton->setText(tr("Show details"));
- }
+ if (mTextEdit->isHidden())
+ showDetails();
+ else
+ hideDetails();
}
void ProgressPage::copyDetailsToClipboard()
diff --git a/src/b2qt-flashing-wizard/progress_page.h b/src/b2qt-flashing-wizard/progress_page.h
index f99f11b..c2e4c4c 100644
--- a/src/b2qt-flashing-wizard/progress_page.h
+++ b/src/b2qt-flashing-wizard/progress_page.h
@@ -25,6 +25,7 @@ class QLabel;
class Actor;
class QTextEdit;
class QPushButton;
+class QProgressBar;
class ProgressPage : public QWizardPage
{
@@ -41,6 +42,8 @@ public slots:
void finished();
void failed(const QString &step);
void addDetails(QByteArray newData);
+ void showDetails();
+ void hideDetails();
void toggleDetails();
void copyDetailsToClipboard();
@@ -51,6 +54,7 @@ private:
QTextEdit *mTextEdit;
QPushButton *mToggleDetailsButton;
QPushButton *mCopyToClipboardButton;
+ QProgressBar *mProgressBar;
};
#endif // PROGRESS_PAGE_H