mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-31 16:52:10 +01:00
OP-1628 Fixed button enablement glitch. Added style sheet to reboot page progress bar.
This commit is contained in:
parent
9614397694
commit
61b2b0f07a
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
|
AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
|
||||||
AbstractWizardPage(wizard, parent),
|
AbstractWizardPage(wizard, parent),
|
||||||
ui(new Ui::AutoUpdatePage)
|
ui(new Ui::AutoUpdatePage), m_isUpdating(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
@ -25,6 +25,11 @@ AutoUpdatePage::~AutoUpdatePage()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AutoUpdatePage::isComplete() const
|
||||||
|
{
|
||||||
|
return !m_isUpdating;
|
||||||
|
}
|
||||||
|
|
||||||
void AutoUpdatePage::enableButtons(bool enable = false)
|
void AutoUpdatePage::enableButtons(bool enable = false)
|
||||||
{
|
{
|
||||||
ui->startUpdate->setEnabled(enable);
|
ui->startUpdate->setEnabled(enable);
|
||||||
@ -42,6 +47,7 @@ void AutoUpdatePage::autoUpdate()
|
|||||||
Q_ASSERT(pm);
|
Q_ASSERT(pm);
|
||||||
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
|
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
|
||||||
Q_ASSERT(uploader);
|
Q_ASSERT(uploader);
|
||||||
|
m_isUpdating = true;
|
||||||
uploader->autoUpdate(ui->eraseSettings->isChecked());
|
uploader->autoUpdate(ui->eraseSettings->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,10 +89,12 @@ void AutoUpdatePage::updateStatus(uploader::ProgressStep status, QVariant value)
|
|||||||
ui->statusLabel->setText(tr("Booting the board%1. Please wait").arg(value.toString()));
|
ui->statusLabel->setText(tr("Booting the board%1. Please wait").arg(value.toString()));
|
||||||
break;
|
break;
|
||||||
case uploader::SUCCESS:
|
case uploader::SUCCESS:
|
||||||
|
m_isUpdating = false;
|
||||||
enableButtons(true);
|
enableButtons(true);
|
||||||
ui->statusLabel->setText(tr("Board updated, please press 'Next' to continue."));
|
ui->statusLabel->setText(tr("Board updated, please press 'Next' to continue."));
|
||||||
break;
|
break;
|
||||||
case uploader::FAILURE:
|
case uploader::FAILURE:
|
||||||
|
m_isUpdating = false;
|
||||||
enableButtons(true);
|
enableButtons(true);
|
||||||
QString msg = value.toString();
|
QString msg = value.toString();
|
||||||
if (msg.isEmpty()) {
|
if (msg.isEmpty()) {
|
||||||
|
@ -44,6 +44,7 @@ class AutoUpdatePage : public AbstractWizardPage {
|
|||||||
public:
|
public:
|
||||||
explicit AutoUpdatePage(SetupWizard *wizard, QWidget *parent = 0);
|
explicit AutoUpdatePage(SetupWizard *wizard, QWidget *parent = 0);
|
||||||
~AutoUpdatePage();
|
~AutoUpdatePage();
|
||||||
|
bool isComplete() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateStatus(uploader::ProgressStep, QVariant);
|
void updateStatus(uploader::ProgressStep, QVariant);
|
||||||
@ -56,6 +57,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AutoUpdatePage *ui;
|
Ui::AutoUpdatePage *ui;
|
||||||
|
bool m_isUpdating;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUTOUPDATEPAGE_H
|
#endif // AUTOUPDATEPAGE_H
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
RebootPage::RebootPage(SetupWizard *wizard, QWidget *parent) :
|
RebootPage::RebootPage(SetupWizard *wizard, QWidget *parent) :
|
||||||
AbstractWizardPage(wizard, parent),
|
AbstractWizardPage(wizard, parent),
|
||||||
ui(new Ui::RebootPage), m_toggl(false)
|
ui(new Ui::RebootPage), m_toggl(false), m_isRebooting(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->yellowLabel->setVisible(false);
|
ui->yellowLabel->setVisible(false);
|
||||||
@ -63,7 +63,7 @@ void RebootPage::initializePage()
|
|||||||
|
|
||||||
bool RebootPage::validatePage()
|
bool RebootPage::validatePage()
|
||||||
{
|
{
|
||||||
return true;
|
return !m_isRebooting;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RebootPage::toggleLabel()
|
void RebootPage::toggleLabel()
|
||||||
@ -89,6 +89,7 @@ void RebootPage::reboot()
|
|||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
connect(m_uploader, SIGNAL(progressUpdate(uploader::ProgressStep, QVariant)), this, SLOT(progressUpdate(uploader::ProgressStep, QVariant)));
|
connect(m_uploader, SIGNAL(progressUpdate(uploader::ProgressStep, QVariant)), this, SLOT(progressUpdate(uploader::ProgressStep, QVariant)));
|
||||||
ui->messageLabel->setText(tr("Reboot in progress..."));
|
ui->messageLabel->setText(tr("Reboot in progress..."));
|
||||||
|
m_isRebooting = true;
|
||||||
m_uploader->reboot();
|
m_uploader->reboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +105,15 @@ void RebootPage::progressUpdate(uploader::ProgressStep progress, QVariant messag
|
|||||||
} else {
|
} else {
|
||||||
ui->messageLabel->setText(tr("<font color='green'>Reboot complete!</font>"));
|
ui->messageLabel->setText(tr("<font color='green'>Reboot complete!</font>"));
|
||||||
}
|
}
|
||||||
|
m_isRebooting= false;
|
||||||
enableButtons(true);
|
enableButtons(true);
|
||||||
} else {
|
} else {
|
||||||
ui->rebootProgress->setValue(ui->rebootProgress->value() + 1);
|
ui->rebootProgress->setValue(ui->rebootProgress->value() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RebootPage::isComplete() const
|
||||||
|
{
|
||||||
|
return !m_isRebooting;
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
|
|
||||||
void initializePage();
|
void initializePage();
|
||||||
bool validatePage();
|
bool validatePage();
|
||||||
|
bool isComplete() const;
|
||||||
|
|
||||||
void enableButtons(bool enable);
|
void enableButtons(bool enable);
|
||||||
private:
|
private:
|
||||||
@ -53,6 +54,7 @@ private:
|
|||||||
QTimer m_timer;
|
QTimer m_timer;
|
||||||
bool m_toggl;
|
bool m_toggl;
|
||||||
UploaderGadgetFactory *m_uploader;
|
UploaderGadgetFactory *m_uploader;
|
||||||
|
bool m_isRebooting;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleLabel();
|
void toggleLabel();
|
||||||
|
@ -93,6 +93,18 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="rebootProgress">
|
<widget class="QProgressBar" name="rebootProgress">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QProgressBar {
|
||||||
|
border: 2px solid grey;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background-color: #3D6699;
|
||||||
|
width: 10px;
|
||||||
|
margin: 0.5px;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user