Download: made status text scrollable

Previous commits turned the status/"Instructions" label into a log. This
allows to show a lot more information that simplify troubleshooting
download issues.

To make it behave a bit more as expected, this change turns the label
into a readonly QTextEdit.
This commit is contained in:
Rainer Clasen
2011-07-24 17:10:54 +02:00
parent 50fef04b75
commit 07e1007957
2 changed files with 11 additions and 11 deletions

View File

@@ -39,10 +39,9 @@ DownloadRideDialog::DownloadRideDialog(MainWindow *mainWindow,
portCombo = new QComboBox(this);
statusLabel = new QLabel(this);
statusLabel->setIndent(10);
statusLabel->setTextFormat(Qt::PlainText);
// XXX: make statusLabel scrollable
statusLabel = new QTextEdit(this);
statusLabel->setReadOnly(true);
statusLabel->setAcceptRichText(false);
// would prefer a progress bar, but some devices (eg. PTap) don't give
// a hint about the total work, so this isn't possible.
@@ -98,7 +97,7 @@ DownloadRideDialog::setReadyInstruct()
progressLabel->setText("");
if (portCombo->count() == 0) {
statusLabel->setText(tr("No devices found. Make sure the device\n"
statusLabel->setPlainText(tr("No devices found. Make sure the device\n"
"unit is plugged into the computer,\n"
"then click \"Rescan\" to check again."));
updateAction( actionMissing );
@@ -107,9 +106,9 @@ DownloadRideDialog::setReadyInstruct()
DevicesPtr devtype = Devices::getType(deviceCombo->currentText());
QString inst = devtype->downloadInstructions();
if (inst.size() == 0)
statusLabel->setText("Click Download to begin downloading.");
statusLabel->setPlainText("Click Download to begin downloading.");
else
statusLabel->setText(inst + ", \nthen click Download.");
statusLabel->setPlainText(inst + ", \nthen click Download.");
updateAction( actionIdle );
}
@@ -198,7 +197,7 @@ DownloadRideDialog::updateAction( downloadAction newAction )
void
DownloadRideDialog::updateStatus(const QString &statusText)
{
statusLabel->setText(statusLabel->text() + "\n" + statusText);
statusLabel->append(statusText);
QCoreApplication::processEvents();
}
@@ -225,7 +224,7 @@ DownloadRideDialog::downloadClicked()
updateAction( actionDownload );
updateProgress( "" );
statusLabel->setText( "" );
statusLabel->setPlainText( "" );
CommPortPtr dev;
for (int i = 0; i < devList.size(); ++i) {
@@ -353,7 +352,7 @@ DownloadRideDialog::eraseClicked()
{
updateAction( actionCleaning );
statusLabel->setText( "" );
statusLabel->setPlainText( "" );
updateProgress( "" );
CommPortPtr dev;

View File

@@ -54,7 +54,8 @@ class DownloadRideDialog : public QDialog
QPushButton *downloadButton, *eraseRideButton, *rescanButton,
*cancelButton, *closeButton;
QComboBox *portCombo, *deviceCombo;
QLabel *statusLabel, *progressLabel;
QTextEdit *statusLabel;
QLabel *progressLabel;
QVector<CommPortPtr> devList;
bool cancelled;