[gui] Add clock
This commit is contained in:
parent
aa5851442c
commit
3f241ee283
@ -61,6 +61,7 @@ private slots:
|
||||
void on_pushButtonBrightness_clicked();
|
||||
void switchGuiToDay();
|
||||
void switchGuiToNight();
|
||||
void showTime();
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui_;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <QFileInfo>
|
||||
#include <QFile>
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace f1x
|
||||
{
|
||||
@ -43,6 +45,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
||||
QSlider:horizontal { background: url(:/slider.png); border: 1px solid #ffffff; border-radius: 2px; min-height: 32px;} \
|
||||
QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} \
|
||||
QSlider::handle:horizontal { background: white; height: 52px; width: 52px; margin: 0 0;} \
|
||||
QLabel { color: #ffffff; font-weight: bold;} \
|
||||
");
|
||||
|
||||
QFileInfo wallpaperDayFile("wallpaper.png");
|
||||
@ -93,6 +96,11 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
||||
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(:/connect.png) }") );
|
||||
}
|
||||
}
|
||||
|
||||
QTimer *timer=new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()),this,SLOT(showTime()));
|
||||
timer->start();
|
||||
|
||||
QFileInfo cursorButtonFile("/etc/button_cursor_visible");
|
||||
bool cursorButtonForce = cursorButtonFile.exists();
|
||||
|
||||
@ -124,6 +132,10 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
||||
}
|
||||
|
||||
ui_->horizontalSliderBrightness->hide();
|
||||
|
||||
if (!configuration->showClock()) {
|
||||
ui_->Digital_clock->hide();
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -183,3 +195,10 @@ void f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay()
|
||||
ui_->pushButtonNight->show();
|
||||
ui_->pushButtonDay->hide();
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
||||
{
|
||||
QTime time=QTime::currentTime();
|
||||
QString time_text=time.toString("hh : mm : ss");
|
||||
ui_->Digital_clock->setText(time_text);
|
||||
}
|
||||
|
@ -14,6 +14,16 @@
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QLabel" name="Digital_clock">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>670</x>
|
||||
<y>14</y>
|
||||
<width>120</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
|
Loading…
x
Reference in New Issue
Block a user