Add ntp sync button / optimize timer remove sleep
This commit is contained in:
parent
3a7e7593ff
commit
1b743ef129
@ -58,6 +58,7 @@ private slots:
|
||||
void setTime();
|
||||
void onStartHotspot();
|
||||
void onStopHotspot();
|
||||
void syncNTPTime();
|
||||
|
||||
private slots:
|
||||
void show_tab1();
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <QFont>
|
||||
#include <QScreen>
|
||||
#include <QRect>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
namespace f1x
|
||||
@ -172,7 +170,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
||||
|
||||
QTimer *timer=new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()),this,SLOT(showTime()));
|
||||
timer->start();
|
||||
timer->start(1000);
|
||||
|
||||
// Build Version string for mainscreen
|
||||
// Get git version string
|
||||
@ -972,9 +970,6 @@ void f1x::openauto::autoapp::ui::MainWindow::setUnMute()
|
||||
|
||||
void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
||||
{
|
||||
using namespace std::this_thread; // sleep_for
|
||||
using namespace std::chrono; // milliseconds
|
||||
|
||||
QTime time=QTime::currentTime();
|
||||
QString time_text=time.toString("hh : mm : ss");
|
||||
if ((time.second() % 2) == 0) {
|
||||
@ -1190,5 +1185,4 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
||||
}
|
||||
ui_->Digital_clock->setText(time_text);
|
||||
ui_->bigClock->setText(time_text);
|
||||
sleep_for(milliseconds(10));
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
|
||||
connect(ui_->pushButtonHotspotStop, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot);
|
||||
connect(ui_->pushButtonHotspotStop , &QPushButton::clicked, this, &SettingsWindow::close);
|
||||
connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime);
|
||||
connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close);
|
||||
connect(ui_->pushButtonNTP , &QPushButton::clicked, this, &SettingsWindow::close);
|
||||
|
||||
// menu
|
||||
ui_->tab1->show();
|
||||
ui_->tab2->hide();
|
||||
@ -70,6 +73,14 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
|
||||
ui_->tab7->hide();
|
||||
ui_->tab8->hide();
|
||||
ui_->horizontalGroupBox->hide();
|
||||
|
||||
QFileInfo devModeFile("/tmp/dev_mode_enabled");
|
||||
QFileInfo DebugmodeFile("/tmp/usb_debug_mode");
|
||||
|
||||
if (!devModeFile.exists() && !DebugmodeFile.exists()) {
|
||||
ui_->pushButtonNTP->hide();
|
||||
}
|
||||
|
||||
connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1);
|
||||
connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2);
|
||||
connect(ui_->pushButtonTab3, &QPushButton::clicked, this, &SettingsWindow::show_tab3);
|
||||
@ -418,6 +429,11 @@ void SettingsWindow::setTime()
|
||||
system((std::string("/usr/local/bin/autoapp_helper settime#") + std::string(params) + std::string(" &") ).c_str());
|
||||
}
|
||||
|
||||
void SettingsWindow::syncNTPTime()
|
||||
{
|
||||
system("/usr/local/bin/crankshaft rtc sync &");
|
||||
}
|
||||
|
||||
void SettingsWindow::loadSystemValues()
|
||||
{
|
||||
// Generate param file
|
||||
|
@ -4791,19 +4791,6 @@ subcontrol-position: center left;
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonSetTime">
|
||||
<property name="sizePolicy">
|
||||
@ -4832,6 +4819,48 @@ subcontrol-position: center left;
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonNTP">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(114, 159, 207);
|
||||
color: rgb(85, 87, 83);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>NTP-Sync</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user