diff --git a/src/modules/timedate/LocaleGlobal.cpp b/src/modules/timedate/LocaleGlobal.cpp index 8cd31537379946ed8202a8978aadf2e63c6c04ca..ef44e65cd84111084daf2abc706a791aea98bfaa 100644 --- a/src/modules/timedate/LocaleGlobal.cpp +++ b/src/modules/timedate/LocaleGlobal.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac + * Kacper Piwiński * * Originally from the Manjaro Installation Framework * by Roland Singer @@ -25,7 +26,8 @@ QHash > > LocaleGlobal::locales; QHash > LocaleGlobal::locations; -void LocaleGlobal::init() +void +LocaleGlobal::init() { // TODO: Error handling initLocales(); @@ -47,7 +49,8 @@ LocaleGlobal::getLocations() } -void LocaleGlobal::initLocales() +void +LocaleGlobal::initLocales() { locales.clear(); @@ -70,7 +73,11 @@ void LocaleGlobal::initLocales() while ( !in.atEnd() ) { QString line = in.readLine().trimmed(); - QStringList split = line.split( commentChar, QString::KeepEmptyParts ).first().split( QRegExp( " (?=[^\"]*(\"[^\"]*\"[^\"]*)*$)" ), QString::SkipEmptyParts ); + + QStringList split = line + .split( commentChar, QString::KeepEmptyParts ) + .first() + .split( QRegExp( " (?=[^\"]*(\"[^\"]*\"[^\"]*)*$)" ), QString::SkipEmptyParts ); if ( split.size() < 2 ) continue; @@ -96,7 +103,8 @@ void LocaleGlobal::initLocales() } -void LocaleGlobal::initLocations() +void +LocaleGlobal::initLocations() { locations.clear(); QFile file( TZ_DATA_FILE ); @@ -131,7 +139,8 @@ void LocaleGlobal::initLocations() } -double LocaleGlobal::getRightGeoLocation( QString str ) +double +LocaleGlobal::getRightGeoLocation( QString str ) { double sign = 1, num = 0.00; diff --git a/src/modules/timedate/TimeDateCommon.cpp b/src/modules/timedate/TimeDateCommon.cpp index 478cbbe695ff89c2a83becd2c4a2e715804f0041..c1408ac348361fda6bccbf4842e8215c8f6f6a64 100644 --- a/src/modules/timedate/TimeDateCommon.cpp +++ b/src/modules/timedate/TimeDateCommon.cpp @@ -2,6 +2,7 @@ * This file is part of Manjaro Settings Manager. * * Ramon Buldó + * Kacper Piwiński * * Manjaro Settings Manager is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +18,12 @@ * along with Manjaro Settings Manager. If not, see . */ - #include "TimeDateCommon.h" #include "TimeZoneDialog.h" #include #include - QString TimeDateCommon::getName() { @@ -91,15 +90,23 @@ void TimeDateCommon::updateUi( Ui::PageTimeDate* ui, TimeDateService* timeDateService, bool isTimeEdited, bool isDateEdited, QString currentTimeZone ) { + ui->isNtpEnabledCheckBox->blockSignals( true ); if ( timeDateService->canNtp() ) + { ui->isNtpEnabledCheckBox->setChecked( timeDateService->isNtpEnabled() ); + ui->timeEdit->setEnabled( !ui->isNtpEnabledCheckBox->isChecked() ); + ui->dateEdit->setEnabled( !ui->isNtpEnabledCheckBox->isChecked() ); + } else { ui->isNtpEnabledCheckBox->setChecked( false ); ui->isNtpEnabledCheckBox->setEnabled( false ); } + ui->isNtpEnabledCheckBox->blockSignals( false ); + ui->isRtcLocalCheckBox->blockSignals( true ); ui->isRtcLocalCheckBox->setChecked( timeDateService->isRtcInLocalTimeZone() ); + ui->isRtcLocalCheckBox->blockSignals( false ); QTimeZone timeZone = QTimeZone( currentTimeZone.toLatin1() ); if ( timeZone.isValid() ) diff --git a/src/modules/timedate/TimeDateKcm.cpp b/src/modules/timedate/TimeDateKcm.cpp index ebd8d4f2364691f0bae9f61c9ae4716ebd339a5e..e01509b9e8d383499d96a8bca4a70f8bd7d577cf 100644 --- a/src/modules/timedate/TimeDateKcm.cpp +++ b/src/modules/timedate/TimeDateKcm.cpp @@ -1,6 +1,7 @@ /* * Manjaro Settings Manager * Ramon Buldó + * Kacper Piwiński * * Copyright (C) 2007 Free Software Foundation, Inc. * @@ -43,7 +44,8 @@ TimeDateKcm::TimeDateKcm( QWidget* parent, const QVariantList& args ) : hBoxLayout->addWidget( m_timeDateModule ); - connect( m_timeDateModule, &TimeDateModule::changed, [this] () + connect( m_timeDateModule, &TimeDateModule::changed, + [this] () { emit changed(); } ); @@ -52,20 +54,26 @@ TimeDateKcm::TimeDateKcm( QWidget* parent, const QVariantList& args ) : TimeDateKcm::~TimeDateKcm() { - + delete m_timeDateModule; } -void TimeDateKcm::load() + +void +TimeDateKcm::load() { m_timeDateModule->load(); } -void TimeDateKcm::save() + +void +TimeDateKcm::save() { m_timeDateModule->save(); } -void TimeDateKcm::defaults() + +void +TimeDateKcm::defaults() { m_timeDateModule->defaults(); } diff --git a/src/modules/timedate/TimeDateModule.cpp b/src/modules/timedate/TimeDateModule.cpp index b2d81ef5371957eff00c1182c83e22ef9249198c..70635be1bd4be3906c51fe67bdcb62550c007f3c 100644 --- a/src/modules/timedate/TimeDateModule.cpp +++ b/src/modules/timedate/TimeDateModule.cpp @@ -2,6 +2,7 @@ * This file is part of Manjaro Settings Manager. * * Ramon Buldó + * Kacper Piwiński * * Manjaro Settings Manager is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,19 +62,22 @@ TimeDateModule::TimeDateModule( QWidget* parent, const QVariantList& args ) : ui->setupUi( this ); connect( m_timeFieldsTimer, &QTimer::timeout, - [=] ( ) + [this] () { TimeDateCommon::updateTimeFields( ui, m_timeDateService, m_isTimeEdited, m_isDateEdited ); } ); + connect( ui->isNtpEnabledCheckBox, &QCheckBox::toggled, - [=] ( bool checked ) + [this] ( bool checked ) { ui->timeEdit->setEnabled( !checked ); ui->dateEdit->setEnabled( !checked ); + emit changed(); } ); - connect( ui->timeZonePushButton, &QPushButton::clicked, [=] ( bool checked ) + + connect( ui->timeZonePushButton, &QPushButton::clicked, + [this] () { - Q_UNUSED( checked ) QString newTimeZone = TimeDateCommon::showTimeZoneSelector( m_timeZone ); if ( !newTimeZone.isEmpty() ) { @@ -82,18 +86,21 @@ TimeDateModule::TimeDateModule( QWidget* parent, const QVariantList& args ) : emit changed(); } } ); + connect( ui->timeEdit, &QTimeEdit::timeChanged, [this] () { m_isTimeEdited = true; emit changed(); } ); + connect( ui->dateEdit, &QTimeEdit::dateChanged, [this] () { m_isDateEdited = true; emit changed(); } ); + connect( ui->isRtcLocalCheckBox, &QCheckBox::toggled, [this] () { @@ -106,6 +113,7 @@ TimeDateModule::~TimeDateModule() { delete ui; delete m_timeDateService; + delete m_timeFieldsTimer; } @@ -134,5 +142,4 @@ TimeDateModule::defaults() load(); } - #include "TimeDateModule.moc" diff --git a/src/modules/timedate/TimeDatePage.cpp b/src/modules/timedate/TimeDatePage.cpp index a03cdd25e11369dd997786b6895b01271fd7c990..8cc3dbb9c9ec98db790f8af0d9b8ee51c4aaa85e 100644 --- a/src/modules/timedate/TimeDatePage.cpp +++ b/src/modules/timedate/TimeDatePage.cpp @@ -2,6 +2,7 @@ * This file is part of Manjaro Settings Manager. * * Ramon Buldó + * Kacper Piwiński * * Manjaro Settings Manager is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +30,6 @@ #include #include - TimeDatePage::TimeDatePage( QWidget* parent ) : PageWidget( parent ), ui( new Ui::PageTimeDate ), @@ -43,20 +43,22 @@ TimeDatePage::TimeDatePage( QWidget* parent ) : setName( TimeDateCommon::getName() ); connect( m_timeFieldsTimer, &QTimer::timeout, - [=] ( ) + [this] () { TimeDateCommon::updateTimeFields( ui, m_timeDateService, m_isTimeEdited, m_isDateEdited ); } ); + connect( ui->isNtpEnabledCheckBox, &QCheckBox::toggled, - [=] ( bool checked ) + [this] ( bool checked ) { ui->timeEdit->setEnabled( !checked ); ui->dateEdit->setEnabled( !checked ); + this -> setApplyEnabled( this, true ); } ); + connect( ui->timeZonePushButton, &QPushButton::clicked, - [=] ( bool checked ) + [this] () { - Q_UNUSED( checked ) QString newTimeZone = TimeDateCommon::showTimeZoneSelector( m_timeZone ); if ( !newTimeZone.isEmpty() ) { @@ -72,12 +74,14 @@ TimeDatePage::TimeDatePage( QWidget* parent ) : m_isTimeEdited = true; this -> setApplyEnabled( this, true ); } ); + connect( ui->dateEdit, &QTimeEdit::dateChanged, [this] () { m_isDateEdited = true; this -> setApplyEnabled( this, true ); } ); + connect( ui->isRtcLocalCheckBox, &QCheckBox::toggled, [this] () { @@ -90,6 +94,7 @@ TimeDatePage::~TimeDatePage() { delete ui; delete m_timeDateService; + delete m_timeFieldsTimer; } diff --git a/src/modules/timedate/TimeDatePage.h b/src/modules/timedate/TimeDatePage.h index d3ecf78b0ec61384073c004631f1da8f81ee54bf..14b1f17a58095f3543da04e29887de457f03823c 100644 --- a/src/modules/timedate/TimeDatePage.h +++ b/src/modules/timedate/TimeDatePage.h @@ -45,7 +45,6 @@ private: Ui::PageTimeDate* ui; TimeDateService* m_timeDateService; QTimer* m_timeFieldsTimer; - TimeZoneWidget m_timeZoneWidget; bool m_isTimeEdited; bool m_isDateEdited; QString m_timeZone; diff --git a/src/modules/timedate/TimeDateService.cpp b/src/modules/timedate/TimeDateService.cpp index 6fdc62d4c8fb4a496f30b818eef123339fcb8e49..e336d787980409555458660b3a33016e5ef68749 100644 --- a/src/modules/timedate/TimeDateService.cpp +++ b/src/modules/timedate/TimeDateService.cpp @@ -2,6 +2,7 @@ * This file is part of Manjaro Settings Manager. * * Ramon Buldó + * Kacper Piwiński * * Manjaro Settings Manager is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +32,7 @@ TimeDateService::TimeDateService( QObject* parent ) : 0 ); } + TimeDateService::~TimeDateService() { delete m_dbusInterface; diff --git a/src/modules/timedate/TimeZoneDialog.cpp b/src/modules/timedate/TimeZoneDialog.cpp index 49c9f26b45eca7f994bb9d92d153dcd88196532f..6e3797e933734e25003d2dfdd3b5a33dac9437fa 100644 --- a/src/modules/timedate/TimeZoneDialog.cpp +++ b/src/modules/timedate/TimeZoneDialog.cpp @@ -2,6 +2,7 @@ * This file is part of Manjaro Settings Manager. * * Ramon Buldó + * Kacper Piwiński * * Manjaro Settings Manager is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/timedate/TimeZoneWidget.cpp b/src/modules/timedate/TimeZoneWidget.cpp index e6b49dc11411f354c7a9287567a7002a46186f03..c6d22f0144683cfa920bfb7c05a761c1a2df6a0a 100644 --- a/src/modules/timedate/TimeZoneWidget.cpp +++ b/src/modules/timedate/TimeZoneWidget.cpp @@ -2,6 +2,7 @@ * This file is part of Manjaro Settings Manager. * * Ramon Buldó + * Kacper Piwiński * * Manjaro Settings Manager is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by