[gui][load] Fix high cpu load / optimizing

This commit is contained in:
hawkeyexp 2018-07-01 18:29:53 +02:00
parent 01fbd163f0
commit a2fb124df6

View File

@ -27,6 +27,8 @@
#include <QTextStream> #include <QTextStream>
#include <QFontDatabase> #include <QFontDatabase>
#include <QFont> #include <QFont>
#include <thread>
#include <chrono>
namespace f1x namespace f1x
{ {
@ -378,6 +380,10 @@ void f1x::openauto::autoapp::ui::MainWindow::cameraControlShow()
ui_->pushButtonSave->show(); ui_->pushButtonSave->show();
this->dashcamBGState = true; this->dashcamBGState = true;
ui_->pushButtonCameraHide->show(); ui_->pushButtonCameraHide->show();
if (this->brightnessSliderVisible) {
ui_->horizontalSliderBrightness->hide();
this->brightnessSliderVisible = false;
}
} }
} }
@ -409,6 +415,10 @@ void f1x::openauto::autoapp::ui::MainWindow::toggleExit()
void f1x::openauto::autoapp::ui::MainWindow::showRearCamBG() void f1x::openauto::autoapp::ui::MainWindow::showRearCamBG()
{ {
ui_->pushButtonRearcamBack->show(); ui_->pushButtonRearcamBack->show();
if (this->brightnessSliderVisible) {
ui_->horizontalSliderBrightness->hide();
this->brightnessSliderVisible = false;
}
} }
void f1x::openauto::autoapp::ui::MainWindow::hideRearCamBG() void f1x::openauto::autoapp::ui::MainWindow::hideRearCamBG()
@ -422,6 +432,10 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
QString time_text=time.toString("hh : mm : ss"); QString time_text=time.toString("hh : mm : ss");
ui_->Digital_clock->setText(time_text); ui_->Digital_clock->setText(time_text);
using namespace std::this_thread; // sleep_for
using namespace std::chrono; // milliseconds
sleep_for(milliseconds(125));
/**if (configuration_->showClock()) { /**if (configuration_->showClock()) {
if (ui_->Digital_clock->isVisible() == true) { if (ui_->Digital_clock->isVisible() == true) {
ui_->Digital_clock->hide(); ui_->Digital_clock->hide();