diff --git a/CMakeLists.txt b/CMakeLists.txt index 20bc761..5e444b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/) # Project Name MESSAGE( STATUS "Running ${CMAKE_COMMAND} v${CMAKE_VERSION}" ) PROJECT(DigitalRooster - VERSION 0.13.0 + VERSION 0.13.1 DESCRIPTION "A digital alarm clock and podcast player" LANGUAGES CXX C ) diff --git a/include/UpdateTask.hpp b/include/UpdateTask.hpp index d7ab730..08ee70f 100644 --- a/include/UpdateTask.hpp +++ b/include/UpdateTask.hpp @@ -13,7 +13,6 @@ #ifndef _UPDATETASK_HPP_ #define _UPDATETASK_HPP_ -#include #include #include @@ -21,6 +20,7 @@ #include #include +#include "httpclient.hpp" namespace DigitalRooster { class PodcastSource; diff --git a/include/mediaplayerproxy.hpp b/include/mediaplayerproxy.hpp index da7e45c..75cbd2f 100644 --- a/include/mediaplayerproxy.hpp +++ b/include/mediaplayerproxy.hpp @@ -48,13 +48,13 @@ class MediaPlayerProxy : public MediaPlayer { private: virtual bool is_seekable() const override; - virtual bool is_muted() const; + virtual bool is_muted() const override; virtual int do_get_volume() const override; virtual qint64 do_get_duration() const override; virtual qint64 do_get_position() const override; virtual QMediaPlayer::MediaStatus do_media_status() const override; virtual QMediaPlayer::State do_playback_state() const override; - virtual QMediaPlayer::Error do_error() const; + virtual QMediaPlayer::Error do_error() const override; virtual void do_set_media( std::shared_ptr media) override; virtual void do_set_playlist(QMediaPlaylist* playlist) override; diff --git a/include/podcast_serializer.hpp b/include/podcast_serializer.hpp index 831fe41..8aba3bd 100644 --- a/include/podcast_serializer.hpp +++ b/include/podcast_serializer.hpp @@ -15,7 +15,6 @@ #define _PODCASTSERIALIZER_HPP_ #include -#include #include #include #include diff --git a/libsrc/PodcastSource.cpp b/libsrc/PodcastSource.cpp index b70f3c5..3b5497d 100644 --- a/libsrc/PodcastSource.cpp +++ b/libsrc/PodcastSource.cpp @@ -5,10 +5,7 @@ */ #include -#include #include -#include -#include #include #include @@ -260,7 +257,8 @@ void PodcastSource::set_image_url(const QUrl& uri) { } /* if we don't have a local copy or the file name changed - download it*/ if (!QFile(image_file_path).exists() || - QUrl::fromLocalFile(image_file_path).fileName() != create_image_file_name(uri)){ + QUrl::fromLocalFile(image_file_path).fileName() != + create_image_file_name(uri)) { trigger_image_download(); } } diff --git a/libsrc/UpdateTask.cpp b/libsrc/UpdateTask.cpp index 921577c..7cc131d 100644 --- a/libsrc/UpdateTask.cpp +++ b/libsrc/UpdateTask.cpp @@ -5,13 +5,10 @@ */ #include -#include -#include -#include -#include #include "PodcastSource.hpp" #include "UpdateTask.hpp" +#include "rss2podcastsource.hpp" using namespace DigitalRooster; static Q_LOGGING_CATEGORY(CLASS_LC, "DigitalRooster.UpdateTask"); diff --git a/libsrc/alarm.cpp b/libsrc/alarm.cpp index 3edbc9c..402b94d 100644 --- a/libsrc/alarm.cpp +++ b/libsrc/alarm.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include "PlayableItem.hpp" #include "alarm.hpp" diff --git a/libsrc/alarmdispatcher.cpp b/libsrc/alarmdispatcher.cpp index e6db74c..b0181d7 100644 --- a/libsrc/alarmdispatcher.cpp +++ b/libsrc/alarmdispatcher.cpp @@ -4,17 +4,13 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include -#include -#include #include #include #include "IAlarmStore.hpp" #include "alarm.hpp" #include "alarmdispatcher.hpp" -#include "mediaplayerproxy.hpp" #include "timeprovider.hpp" using namespace DigitalRooster; diff --git a/libsrc/alarmmonitor.cpp b/libsrc/alarmmonitor.cpp index a1db5f5..548378e 100644 --- a/libsrc/alarmmonitor.cpp +++ b/libsrc/alarmmonitor.cpp @@ -6,7 +6,6 @@ #include -#include #include "alarm.hpp" #include "alarmmonitor.hpp" @@ -82,7 +81,7 @@ void AlarmMonitor::set_state(MonitorState next_state) { } /*****************************************************************************/ -void AlarmMonitor::alarm_triggered(const DigitalRooster::Alarm* alarm) { +void AlarmMonitor::alarm_triggered(const DigitalRooster::Alarm* alarm) { qCDebug(CLASS_LC) << Q_FUNC_INFO; set_state(ExpectingAlarm); mpp.set_media(alarm->get_media()); diff --git a/libsrc/brightnesscontrol.cpp b/libsrc/brightnesscontrol.cpp index 29c5d53..946bfed 100644 --- a/libsrc/brightnesscontrol.cpp +++ b/libsrc/brightnesscontrol.cpp @@ -4,20 +4,16 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include -#include #include -#include #include -#include #include -#include "util.hpp" #include "IBrightnessStore.hpp" #include "IHardware.hpp" #include "brightnesscontrol.hpp" +#include "util.hpp" using namespace DigitalRooster; diff --git a/libsrc/configuration_manager.cpp b/libsrc/configuration_manager.cpp index 9277d04..b373967 100644 --- a/libsrc/configuration_manager.cpp +++ b/libsrc/configuration_manager.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include "PlayableItem.hpp" diff --git a/libsrc/hardware_configuration.cpp b/libsrc/hardware_configuration.cpp index 00f6f37..0717edd 100644 --- a/libsrc/hardware_configuration.cpp +++ b/libsrc/hardware_configuration.cpp @@ -4,8 +4,6 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include -#include #include #include diff --git a/libsrc/hardwarecontrol_stub.cpp b/libsrc/hardwarecontrol_stub.cpp index 9e36436..e0771e0 100644 --- a/libsrc/hardwarecontrol_stub.cpp +++ b/libsrc/hardwarecontrol_stub.cpp @@ -15,7 +15,7 @@ using namespace Hal; static Q_LOGGING_CATEGORY(CLASS_LC, "DigitalRooster.HardwareControl"); // need for definition in cpp file -Hal::IHardware::~IHardware()= default; +Hal::IHardware::~IHardware() = default; /*****************************************************************************/ HardwareControlStub::~HardwareControlStub() { @@ -48,6 +48,6 @@ AlsValue HardwareControlStub::read_als_sensor() { /*****************************************************************************/ void HardwareControlStub::set_backlight(int brightness) { - qCInfo(CLASS_LC) << Q_FUNC_INFO; + qCInfo(CLASS_LC) << Q_FUNC_INFO; } /*****************************************************************************/ diff --git a/libsrc/httpclient.cpp b/libsrc/httpclient.cpp index 4c25ab3..6f028f1 100644 --- a/libsrc/httpclient.cpp +++ b/libsrc/httpclient.cpp @@ -4,9 +4,7 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include - #include #include "appconstants.hpp" diff --git a/libsrc/logger.cpp b/libsrc/logger.cpp index 8f1c39a..d686c40 100644 --- a/libsrc/logger.cpp +++ b/libsrc/logger.cpp @@ -5,10 +5,12 @@ */ #include +#include +#include -#include #include #include +#include #include #include "logger.hpp" @@ -57,9 +59,9 @@ void setup_logger_file(const QString& filename) { qDebug() << Q_FUNC_INFO; qDebug() << "Logging to " << filename; logfile = std::make_shared(filename); - if(! logfile->open(QIODevice::WriteOnly | QIODevice::Append| QIODevice::Text)){ - throw std::system_error( - make_error_code(std::errc::bad_file_descriptor), + if (!logfile->open( + QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { + throw std::system_error(make_error_code(std::errc::bad_file_descriptor), logfile->errorString().toStdString()); }; qInstallMessageHandler(messageHandler); @@ -77,4 +79,4 @@ void setup_logger_stdout() { /*****************************************************************************/ -} // namespace +} // namespace DigitalRooster diff --git a/libsrc/mediaplayer.cpp b/libsrc/mediaplayer.cpp index a8d4f62..c0e8d29 100644 --- a/libsrc/mediaplayer.cpp +++ b/libsrc/mediaplayer.cpp @@ -6,8 +6,8 @@ #include -#include "util.hpp" #include "mediaplayer.hpp" +#include "util.hpp" using namespace DigitalRooster; @@ -33,12 +33,12 @@ void MediaPlayer::set_muted(bool muted) { /*****************************************************************************/ void MediaPlayer::set_volume(int volume) { - qCDebug(CLASS_LC) << Q_FUNC_INFO << volume; - if (! value_in_0_100(volume)) { + qCDebug(CLASS_LC) << Q_FUNC_INFO << volume; + if (!value_in_0_100(volume)) { qCWarning(CLASS_LC) << "invalid volume (must be 0..100%)"; return; } - return do_set_volume(volume); + return do_set_volume(volume); } /*****************************************************************************/ diff --git a/libsrc/mediaplayerproxy.cpp b/libsrc/mediaplayerproxy.cpp index 7e45548..04dabfb 100644 --- a/libsrc/mediaplayerproxy.cpp +++ b/libsrc/mediaplayerproxy.cpp @@ -4,14 +4,13 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include "mediaplayerproxy.hpp" -#include "PlayableItem.hpp" -#include -#include #include +#include #include -#include +#include "PlayableItem.hpp" +#include "mediaplayerproxy.hpp" + using namespace DigitalRooster; static Q_LOGGING_CATEGORY(CLASS_LC, "DigitalRooster.MediaPlayerProxy"); @@ -123,7 +122,7 @@ void MediaPlayerProxy::do_seek(qint64 incr) { qCDebug(CLASS_LC) << Q_FUNC_INFO; if (seekable()) { set_position(get_position() + incr); - } + } }; /*****************************************************************************/ diff --git a/libsrc/playableitem.cpp b/libsrc/playableitem.cpp index e7b4ffb..1ad9b73 100644 --- a/libsrc/playableitem.cpp +++ b/libsrc/playableitem.cpp @@ -4,10 +4,8 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include -#include -#include +#include #include "PlayableItem.hpp" #include "appconstants.hpp" @@ -23,8 +21,7 @@ PlayableItem::PlayableItem(const QUuid& uid) /***********************************************************************/ -PlayableItem::PlayableItem( - QString name, QUrl url, const QUuid& uid) +PlayableItem::PlayableItem(QString name, QUrl url, const QUuid& uid) : id(uid) , display_name(std::move(name)) , media_url(std::move(url)){}; diff --git a/libsrc/podcast_serializer.cpp b/libsrc/podcast_serializer.cpp index a4ae813..dd6c267 100644 --- a/libsrc/podcast_serializer.cpp +++ b/libsrc/podcast_serializer.cpp @@ -7,8 +7,7 @@ #include #include #include -#include -#include +#include #include "PodcastSource.hpp" #include "appconstants.hpp" @@ -44,7 +43,7 @@ void PodcastSerializer::restore_info() { auto cache_file = cache_dir.filePath(ps->get_id_string()); try { read_from_file(ps, cache_file); - } catch (std::system_error& exc) { + } catch (std::system_error&) { qCWarning(CLASS_LC) << "Cache file not found" << cache_file; } catch (PodcastSourceJSonCorrupted& jsexc) { qCWarning(CLASS_LC) << "corrupted JSON in file" << cache_file @@ -215,7 +214,7 @@ void DigitalRooster::parse_podcast_source_from_json( } if (ps->get_last_updated().isValid() && ps->get_last_updated() > timestamp) { - qCDebug(CLASS_LC) << "podcast source is newer than stored information"; + qCDebug(CLASS_LC) << "PodcastSource newer than cache"; } else { // need to update podcast source data auto title = tl_obj[JSON_KEY_TITLE].toString(); diff --git a/libsrc/powercontrol.cpp b/libsrc/powercontrol.cpp index b5c74bd..13469cb 100644 --- a/libsrc/powercontrol.cpp +++ b/libsrc/powercontrol.cpp @@ -4,7 +4,6 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include #include "powercontrol.hpp" diff --git a/libsrc/sleeptimer.cpp b/libsrc/sleeptimer.cpp index 43966af..f407c26 100644 --- a/libsrc/sleeptimer.cpp +++ b/libsrc/sleeptimer.cpp @@ -4,12 +4,10 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include #include #include #include -#include #include "alarm.hpp" #include "sleeptimer.hpp" @@ -63,7 +61,7 @@ void SleepTimer::reset_timer() { } /*****************************************************************************/ -void SleepTimer::alarm_triggered(const DigitalRooster::Alarm* alarm) { +void SleepTimer::alarm_triggered(const DigitalRooster::Alarm* alarm) { qCDebug(CLASS_LC) << Q_FUNC_INFO; activity = SleepTimer::Alarm; sleep_timer.setInterval(alarm->get_timeout()); diff --git a/libsrc/util.cpp b/libsrc/util.cpp index 9721c31..782b55f 100644 --- a/libsrc/util.cpp +++ b/libsrc/util.cpp @@ -8,10 +8,10 @@ #include #include #include +#include #include #include - -#include +#include #include "appconstants.hpp" #include "logger.hpp" diff --git a/libsrc/volume_button.cpp b/libsrc/volume_button.cpp index 12b2ee7..167278f 100644 --- a/libsrc/volume_button.cpp +++ b/libsrc/volume_button.cpp @@ -6,7 +6,6 @@ #include -#include "configuration_manager.hpp" #include "volume_button.hpp" using namespace DigitalRooster; diff --git a/libsrc/weather.cpp b/libsrc/weather.cpp index e8bd8fa..a404285 100644 --- a/libsrc/weather.cpp +++ b/libsrc/weather.cpp @@ -4,15 +4,13 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include #include #include -#include -#include #include // std::system_error #include "IWeatherConfigStore.hpp" +#include "appconstants.hpp" #include "weather.hpp" using namespace DigitalRooster; @@ -174,8 +172,8 @@ QUrl DigitalRooster::create_forecast_url(const WeatherConfig& cfg) { } /*****************************************************************************/ -WeatherConfig::WeatherConfig(QString token, QString location, - std::chrono::seconds interval) +WeatherConfig::WeatherConfig( + QString token, QString location, std::chrono::seconds interval) : api_token(std::move(token)) , location_id(std::move(location)) , update_interval(interval) { diff --git a/qtgui/alarmlistmodel.cpp b/qtgui/alarmlistmodel.cpp index 87de769..751f65f 100644 --- a/qtgui/alarmlistmodel.cpp +++ b/qtgui/alarmlistmodel.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "alarm.hpp" #include "alarmlistmodel.hpp" @@ -126,7 +127,7 @@ int AlarmListModel::delete_alarm(qint64 row) { if (alarm) { cm.delete_alarm(alarm->get_id()); } - } catch (std::out_of_range& exc) { + } catch (std::out_of_range&) { qCWarning(CLASS_LC) << Q_FUNC_INFO << " Alarm not found! "; } endRemoveRows(); @@ -145,6 +146,7 @@ DigitalRooster::Alarm* AlarmListModel::create_alarm() { new_alarm->set_time(QTime::fromString("06:30", "hh:mm")); beginInsertRows(QModelIndex(), rowCount(), rowCount()); QQmlEngine::setObjectOwnership(new_alarm.get(), QQmlEngine::CppOwnership); + /* new_alarm is not only on the stack. Ownership shared with IAlarmStore*/ cm.add_alarm(new_alarm); endInsertRows(); return new_alarm.get(); diff --git a/qtgui/main.cpp b/qtgui/main.cpp index f827a4d..42d48e4 100644 --- a/qtgui/main.cpp +++ b/qtgui/main.cpp @@ -10,14 +10,12 @@ #endif #include -#include #include #include #include #include #include // STD C++ -#include #include // hardware interface @@ -181,8 +179,8 @@ int main(int argc, char* argv[]) { &Hal::IHardware::system_poweroff); /* AlarmDispatcher activates system */ - QObject::connect( - &alarmdispatcher, SIGNAL(alarm_triggered()), &power, SLOT(activate())); + QObject::connect(&alarmdispatcher, &AlarmDispatcher::alarm_triggered, + &power, &PowerControl::activate); /* Sleeptimer sends system to standby */ QObject::connect(&sleeptimer, &SleepTimer::sleep_timer_elapsed, &power, @@ -191,10 +189,8 @@ int main(int argc, char* argv[]) { QObject::connect(&playerproxy, &MediaPlayer::playback_state_changed, &sleeptimer, &SleepTimer::playback_state_changed); /* Sleeptimer also monitors alarms */ - QObject::connect(&alarmdispatcher, - SIGNAL(alarm_triggered(std::shared_ptr)), - &sleeptimer, - SLOT(alarm_triggered(std::shared_ptr))); + QObject::connect(&alarmdispatcher, &AlarmDispatcher::alarm_triggered, + &sleeptimer, &SleepTimer::alarm_triggered); /* Rotary encoder push button interface */ VolumeButton volbtn; diff --git a/test/restserver.cpp b/test/restserver.cpp index 9c1975c..7910971 100644 --- a/test/restserver.cpp +++ b/test/restserver.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include "RestApi.hpp" diff --git a/test/test_alarm.cpp b/test/test_alarm.cpp index 473bddf..2fd7633 100644 --- a/test/test_alarm.cpp +++ b/test/test_alarm.cpp @@ -6,7 +6,6 @@ #include -#include #include #include #include diff --git a/test/test_alarmdispatcher.cpp b/test/test_alarmdispatcher.cpp index f9d32a9..93db983 100644 --- a/test/test_alarmdispatcher.cpp +++ b/test/test_alarmdispatcher.cpp @@ -4,13 +4,11 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include #include #include #include -#include #include #include diff --git a/test/test_alarmmonitor.cpp b/test/test_alarmmonitor.cpp index a658085..a520919 100644 --- a/test/test_alarmmonitor.cpp +++ b/test/test_alarmmonitor.cpp @@ -19,7 +19,6 @@ #include "alarm.hpp" #include "alarmmonitor.hpp" -#include "cm_mock.hpp" #include "player_mock.hpp" using namespace DigitalRooster; diff --git a/test/test_hardware_config.cpp b/test/test_hardware_config.cpp index e53ce2f..1bdfd2b 100644 --- a/test/test_hardware_config.cpp +++ b/test/test_hardware_config.cpp @@ -4,11 +4,11 @@ * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -#include #include +#include -#include "gtest/gtest.h" #include "hardware_configuration.hpp" +#include "gtest/gtest.h" using namespace Hal; using namespace ::testing; @@ -16,7 +16,8 @@ using namespace ::testing; /*****************************************************************************/ TEST(HardwareConfig, envSetsPushButtonPath) { QString expected_path{"/dev/input/event27"}; - ASSERT_TRUE(qputenv(Hal::PUSH_BUTTON_PATH_ENV_VAR_NAME.toStdString().c_str(), + ASSERT_TRUE( + qputenv(Hal::PUSH_BUTTON_PATH_ENV_VAR_NAME.toStdString().c_str(), expected_path.toUtf8())); HardwareConfiguration hc; ASSERT_EQ(hc.get_push_button_event_path(), expected_path); @@ -26,7 +27,7 @@ TEST(HardwareConfig, envSetsPushButtonPath) { TEST(HardwareConfig, envSetsRotaryPath) { QString expected_path{"/dev/input/event37"}; ASSERT_TRUE(qputenv(Hal::ROTARY_PATH_ENV_VAR_NAME.toStdString().c_str(), - expected_path.toUtf8())); + expected_path.toUtf8())); HardwareConfiguration hc; ASSERT_EQ(hc.get_rotary_event_path(), expected_path); } diff --git a/test/test_mediaplayerproxy.cpp b/test/test_mediaplayerproxy.cpp index ffcd851..c5303f8 100644 --- a/test/test_mediaplayerproxy.cpp +++ b/test/test_mediaplayerproxy.cpp @@ -10,9 +10,8 @@ #include #include -#include - #include +#include #include "PlayableItem.hpp" #include "appconstants.hpp" diff --git a/test/test_podcast_reader.cpp b/test/test_podcast_reader.cpp index 35c5b96..bda2f76 100644 --- a/test/test_podcast_reader.cpp +++ b/test/test_podcast_reader.cpp @@ -5,12 +5,10 @@ */ #include -#include #include -#include -#include // std::system_error #include "appconstants.hpp" +#include "rss2podcastsource.hpp" using namespace DigitalRooster; diff --git a/test/test_podcastsource.cpp b/test/test_podcastsource.cpp index 37cfb7a..7c49df5 100644 --- a/test/test_podcastsource.cpp +++ b/test/test_podcastsource.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include // std::system_error diff --git a/test/test_settings.cpp b/test/test_settings.cpp index 28339b3..dc99184 100644 --- a/test/test_settings.cpp +++ b/test/test_settings.cpp @@ -11,15 +11,10 @@ #include "gtest/gtest.h" -#include -#include -#include - #include "PlayableItem.hpp" #include "PodcastSource.hpp" #include "alarm.hpp" #include "appconstants.hpp" -#include "config.h" #include "configuration_manager.hpp" using namespace DigitalRooster;