Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[timed] Drop all Qt4 specific code
Qt4 builds have not really been supported for ages, but timed code base
is still littered with Qt4 vs Qt5 preprocessor differentiation. Also,
some of these blocks have nothing to do with qt version, but assume
differences elsewhere in the os based on qt version e.g. whether statefs
or context framework should be targeted.

Remove all code qt4 compatibility code.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Nov 21, 2019
1 parent 72988f9 commit a14c42e
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 126 deletions.
4 changes: 0 additions & 4 deletions src/lib/event
@@ -1,6 +1,2 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-qt5/event-declarations.h>
#else
#include <timed/event-declarations.h>
#endif
4 changes: 0 additions & 4 deletions src/lib/hidden/exception
@@ -1,6 +1,2 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-qt5/exception.h>
#else
#include <timed/exception.h>
#endif
5 changes: 0 additions & 5 deletions src/lib/interface
@@ -1,7 +1,2 @@

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-qt5/interface.h>
#else
#include <timed/interface.h>
#endif
5 changes: 0 additions & 5 deletions src/lib/wallclock
@@ -1,7 +1,2 @@

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-qt5/wall-declarations.h>
#else
#include <timed/wall-declarations.h>
#endif
6 changes: 0 additions & 6 deletions src/server/backup.cpp
Expand Up @@ -25,15 +25,9 @@
***************************************************************************/

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata>
#include <iodata-qt5/validator>
#include <iodata-qt5/storage>
#else
#include <iodata/iodata>
#include <iodata/validator>
#include <iodata/storage>
#endif

#include "queue.type.h"
#include "settings.type.h"
Expand Down
4 changes: 0 additions & 4 deletions src/server/credentials.h
Expand Up @@ -36,11 +36,7 @@ using namespace std ;
#include <QDBusMessage>
#include <QDBusConnection>

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata>
#else
#include <iodata/iodata>
#endif

uint32_t get_name_owner_from_dbus_sync(const QDBusConnection &bus, const QString &name) ;

Expand Down
4 changes: 0 additions & 4 deletions src/server/event.h
Expand Up @@ -34,11 +34,7 @@ using namespace std ;

#include <QDBusPendingCallWatcher>

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata>
#else
#include <iodata/iodata>
#endif

#include "../lib/event-declarations.h"
#include "../lib/event-pimple.h"
Expand Down
4 changes: 0 additions & 4 deletions src/server/settings.h
Expand Up @@ -27,11 +27,7 @@
#include <string>

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata>
#else
#include <iodata/iodata>
#endif

#include "../lib/nanotime.h"
#include "../lib/wall-declarations.h"
Expand Down
38 changes: 0 additions & 38 deletions src/server/timed.cpp
Expand Up @@ -37,11 +37,7 @@
#include <QDateTime>
#include <QDir>

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <statefs/qt/util.hpp>
#else
#include <ContextProvider>
#endif

#include "../voland/interface.h"

Expand Down Expand Up @@ -141,15 +137,8 @@ Timed::Timed(int ac, char **av)
, sent_signature()
, tz_oracle(nullptr)
, ntp_controller(nullptr)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
, alarm_present(nullptr)
, alarm_trigger(nullptr)
#else
, time_operational_p(nullptr)
, alarm_present(nullptr)
, alarm_trigger(nullptr)
, context_service(nullptr)
#endif
, backup_object(nullptr)
, notificator(nullptr)
, halted() // XXX: remove it, as we don't want to halt anymore
Expand Down Expand Up @@ -554,20 +543,8 @@ void Timed::start_voland_watcher()

void Timed::init_context_objects()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
alarm_present = new statefs::qt::InOutWriter("Alarm.Present");
alarm_trigger = new statefs::qt::InOutWriter("Alarm.Trigger");
#else
context_service = new ContextProvider::Service(Maemo::Timed::bus()) ;
context_service -> setAsDefault() ;

log_debug("(new ContextProvider::Service(Maemo::Timed::bus()))->setAsDefault()") ;
alarm_trigger = new ContextProvider::Property("Alarm.Trigger");
alarm_present = new ContextProvider::Property("Alarm.Present");
ContextProvider::Property("/com/nokia/time/time_zone/oracle") ;
time_operational_p = new ContextProvider::Property("/com/nokia/time/system_time/operational") ;
time_operational_p->setValue(am->is_epoch_open()) ;
#endif
}

void Timed::init_backup_object()
Expand Down Expand Up @@ -750,10 +727,6 @@ void Timed::stop_context()
{
delete alarm_present;
delete alarm_trigger;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
delete context_service ;
delete time_operational_p ;
#endif
}
void Timed::stop_dbus()
{
Expand Down Expand Up @@ -1116,9 +1089,6 @@ void Timed::update_oracle_context(bool s)
void Timed::open_epoch()
{
am->open_epoch() ;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
time_operational_p->setValue(true) ;
#endif
}

#if HAVE_DSME
Expand Down Expand Up @@ -1235,11 +1205,7 @@ void Timed::init_first_boot_hwclock_time_adjustment_check() {

void Timed::set_alarm_present(bool present)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
alarm_present->set(QVariant(present));
#else
alarm_present->setValue(present);
#endif
}

void Timed::set_alarm_trigger(const QMap<QString, QVariant> &triggers)
Expand All @@ -1256,7 +1222,6 @@ void Timed::set_alarm_trigger(const QMap<QString, QVariant> &triggers)
triggerMap.insert(cookie, seconds_after_epoch);
}
emit alarm_triggers_changed(triggerMap);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// statefs supports only boolean and string types, marshall the QMap to a string
QString contextProperty = "";
QMapIterator<QString, QVariant> i(triggers);
Expand All @@ -1267,9 +1232,6 @@ void Timed::set_alarm_trigger(const QMap<QString, QVariant> &triggers)
contextProperty += QString("%1:%2").arg(i.key()).arg(i.value().toUInt());
}
alarm_trigger->set(contextProperty);
#else
alarm_trigger->setValue(QVariant::fromValue(triggers));
#endif
}

bool Timed::notify(QObject *obj, QEvent *ev)
Expand Down
22 changes: 0 additions & 22 deletions src/server/timed.h
Expand Up @@ -31,17 +31,8 @@
#include <QDBusConnectionInterface>
#include <QDBusServiceWatcher>

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <ContextProvider>
#endif

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/validator>
#include <iodata-qt5/storage>
#else
#include <iodata/validator>
#include <iodata/storage>
#endif

#include "wrappers.h"
#include "settings.h"
Expand All @@ -52,13 +43,11 @@
#include "dsme-mode.h"
#endif

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
namespace statefs {
namespace qt {
class InOutWriter;
}
}
#endif

class simple_timer;
class pinguin_t;
Expand All @@ -72,11 +61,7 @@ class csd_t;
struct Timed : public QCoreApplication
{
public:
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
inline const char *configuration_path() { return "/etc/timed-qt5.rc" ; }
#else
inline const char *configuration_path() { return "/etc/timed.rc" ; }
#endif
// inline const char *configuration_type() { return "/usr/share/timed/typeinfo/config.type" ; }

inline const char *customization_path() { return "/usr/share/timed/customization.data" ; } // TODO: make it configurable
Expand Down Expand Up @@ -219,15 +204,8 @@ public Q_SLOTS:
tz_oracle_t *tz_oracle ;
NtpController *ntp_controller;

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
statefs::qt::InOutWriter *alarm_present;
statefs::qt::InOutWriter *alarm_trigger;
#else
ContextProvider::Property *time_operational_p ;
ContextProvider::Property *alarm_present;
ContextProvider::Property *alarm_trigger;
ContextProvider::Service *context_service ;
#endif

QObject *backup_object ;
public:
Expand Down
6 changes: 1 addition & 5 deletions src/server/timeutil.h
Expand Up @@ -28,11 +28,7 @@
#include <string>
using namespace std ;

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <iodata-qt5/iodata>
#else
# include <iodata/iodata>
#endif
#include <iodata-qt5/iodata>

struct recurrence_pattern_t ;

Expand Down
5 changes: 0 additions & 5 deletions src/server/tzdata.cpp
Expand Up @@ -23,13 +23,8 @@
***************************************************************************/

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/validator>
#include <iodata-qt5/storage>
#else
#include <iodata/validator>
#include <iodata/storage>
#endif

#include <string>
#include <sstream>
Expand Down
4 changes: 0 additions & 4 deletions src/voland/interface
@@ -1,6 +1,2 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-voland-qt5/interface.h>
#else
#include <timed-voland/interface.h>
#endif
4 changes: 0 additions & 4 deletions src/voland/interface.h
Expand Up @@ -33,11 +33,7 @@
#include <QDBusConnection>

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-qt5/qmacro.h>
#else
#include <timed/qmacro.h>
#endif

#include "reminder.h"

Expand Down
4 changes: 0 additions & 4 deletions src/voland/reminder
@@ -1,6 +1,2 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-voland-qt5/reminder.h>
#else
#include <timed-voland/reminder.h>
#endif
4 changes: 0 additions & 4 deletions src/voland/reminder.h
Expand Up @@ -28,11 +28,7 @@
#include <QDBusMetaType>

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-qt5/qmacro.h>
#else
#include <timed/qmacro.h>
#endif

namespace Maemo { namespace Timed { namespace Voland { class Reminder ; } } }

Expand Down
4 changes: 0 additions & 4 deletions src/voland/ta_interface
@@ -1,6 +1,2 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <timed-voland-qt5/interface.h>
#else
#include <timed-voland/interface.h>
#endif

0 comments on commit a14c42e

Please sign in to comment.