From 289fcb3a9f6489686e658ab0d35be7c1f492d1ac Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Thu, 25 Aug 2011 01:29:18 +0100 Subject: [PATCH] Renamed destination to direction for clarity. --- DBBackends/RtcomEventLogger.cpp | 4 ++-- EventParsers/CSVSymbianEventLogParser.cpp | 6 +++--- EventTypes/PhoneCall.cpp | 9 +++++---- EventTypes/PhoneCall.h | 15 ++++----------- Settings.cpp | 12 ++++++------ Settings.h | 12 ++++++------ Windows/TypesWindow.cpp | 16 ++++++++-------- 7 files changed, 34 insertions(+), 40 deletions(-) diff --git a/DBBackends/RtcomEventLogger.cpp b/DBBackends/RtcomEventLogger.cpp index 8e54f38..077bdfe 100644 --- a/DBBackends/RtcomEventLogger.cpp +++ b/DBBackends/RtcomEventLogger.cpp @@ -99,8 +99,8 @@ void RtcomEventLogger::ProcessService(EventProcessors::iEventProcessor &processo { RTComEl *el_nonconst(const_cast(&el)); - bool incoming = CurrentSettings().ShouldProcess( Settings::TYPE_RECIEVED, service); - bool outgoing = CurrentSettings().ShouldProcess( Settings::TYPE_SENT, service); + bool incoming = CurrentSettings().ShouldProcess( Settings::INCOMING, service); + bool outgoing = CurrentSettings().ShouldProcess( Settings::OUTGOING, service); if(incoming || outgoing) { diff --git a/EventParsers/CSVSymbianEventLogParser.cpp b/EventParsers/CSVSymbianEventLogParser.cpp index d4eebdb..b24c894 100644 --- a/EventParsers/CSVSymbianEventLogParser.cpp +++ b/EventParsers/CSVSymbianEventLogParser.cpp @@ -173,11 +173,11 @@ EventTypes::EventFromFileList CSVSymbianEventLogParser::ParseFile(QFile &eventFi qDebug() << "Parsing event from line #" << lineNumber << ". Values: " << lineValues; QDateTime eTime(QDateTime::fromString(lineValues.at(m_HeadingIndices.value("etime")), "dd/MM/yyyy hh:mm:ss")); - EventTypes::PhoneCall::eDestination direction(lineValues.at(m_HeadingIndices.value("direction")) == "0" - ? EventTypes::PhoneCall::INCOMING - : EventTypes::PhoneCall::OUTGOING); int duration(lineValues.at(m_HeadingIndices.value("duration")).toInt(&bOK)); if(!bOK) + Settings::eDirection direction(lineValues.at(m_HeadingIndices.value("direction")) == "0" + ? Settings::INCOMING + : Settings::OUTGOING); { qDebug() << QString("Unable to parse '%1' as a duration. Skipping record.") .arg(lineValues.at(m_HeadingIndices.value("duration"))); diff --git a/EventTypes/PhoneCall.cpp b/EventTypes/PhoneCall.cpp index bfed790..7997fc2 100644 --- a/EventTypes/PhoneCall.cpp +++ b/EventTypes/PhoneCall.cpp @@ -61,7 +61,7 @@ PhoneCall::~PhoneCall() PhoneCall::PhoneCall(const Settings &settings, const RTComElEvent &event, const QList attachments) : m_Settings(settings) { - setDestination(event.fld_outgoing ? OUTGOING : INCOMING); + setDestination(event.fld_outgoing ? Settings::OUTGOING : Settings::INCOMING); setTimestamp(QDateTime::fromTime_t(event.fld_start_time).toUTC()); setDurationInSeconds(QDateTime::fromTime_t(event.fld_start_time).toUTC().secsTo(QDateTime::fromTime_t(event.fld_end_time).toUTC())); setTel(event.fld_remote_uid); @@ -75,7 +75,7 @@ PhoneCall::PhoneCall(const Settings &settings, const RTComElEvent &event, const qDebug() << "Created new Phone Call from RtCom:\n" << *this; } -PhoneCall::PhoneCall(const Settings &settings, const eDestination destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments) : +PhoneCall::PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments) : m_Settings(settings), m_Destination(destination), m_Timestamp(timestamp), m_Tel(tel), m_DurationInSeconds(durationInSeconds), m_Attachments(attachments) { @@ -129,7 +129,7 @@ RTComElEvent * PhoneCall::toRTComEvent(const NumberToNameLookup &numberToNameLoo RTCOM_EL_EVENT_SET_FIELD (event, end_time, Timestamp().addSecs(DurationInSeconds()).toUTC().toTime_t()); RTCOM_EL_EVENT_SET_FIELD (event, storage_time, Timestamp().addSecs(DurationInSeconds()).toUTC().toTime_t()); //RTCOM_EL_EVENT_SET_FIELD (event, is_read, 0); - RTCOM_EL_EVENT_SET_FIELD (event, outgoing, Destination() == PhoneCall::OUTGOING ? 1 : 0); + RTCOM_EL_EVENT_SET_FIELD (event, outgoing, Destination() == Settings::OUTGOING ? 1 : 0); //if(local_uid) // Voicemail local_uid transform needed here RTCOM_EL_EVENT_SET_FIELD (event, local_uid, g_strdup("ring/tel/ring")); //RTCOM_EL_EVENT_SET_FIELD (&event, local_name, g_strdup("")); @@ -175,7 +175,8 @@ void PhoneCall::Export(const QString &baseDirectory) const QDebug operator<<(QDebug dbg, PhoneCall& event) { - dbg.nospace() << "\tDirection:\t\t" << (event.Destination() == PhoneCall::OUTGOING ? "Made" : "Recieved") << "\n"; + dbg.nospace() << "\tHash:\t\t" << event.HashCode() << "\n"; + dbg.nospace() << "\tDirection:\t\t" << (event.Destination() == Settings::OUTGOING ? "Made" : "Recieved") << "\n"; dbg.nospace() << "\tTimestamp:\t" << event.Timestamp().toUTC() << "\n"; dbg.nospace() << "\tDuration:\t\t" << event.DurationInSeconds() << " seconds\n"; dbg.nospace() << "\tRemote-Tel:\t" << event.Tel() << "\n"; diff --git a/EventTypes/PhoneCall.h b/EventTypes/PhoneCall.h index 0d440cd..f709713 100644 --- a/EventTypes/PhoneCall.h +++ b/EventTypes/PhoneCall.h @@ -35,23 +35,16 @@ namespace EventTypes class PhoneCall : public RtcomEvent { public: - enum eDestination - { - INCOMING, - OUTGOING - }; - - public: virtual const DBBackends::iDBBackend &DB() const; PhoneCall(const Settings &settings); - PhoneCall(const Settings &settings, const eDestination destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments = AttachmentCollection()); + PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments = AttachmentCollection()); ~PhoneCall(); virtual const uint HashCode() const; - const eDestination Destination() const { return m_Destination; } - void setDestination(const eDestination destination) { m_Destination = destination; } + const Settings::eDirection Destination() const { return m_Destination; } + void setDestination(const Settings::eDirection destination) { m_Destination = destination; } virtual const QDateTime Timestamp() const { return m_Timestamp; } void setTimestamp(const QDateTime timestamp) { m_Timestamp = timestamp; } @@ -75,7 +68,7 @@ namespace EventTypes private: const Settings &m_Settings; - eDestination m_Destination; + Settings::eDirection m_Destination; QDateTime m_Timestamp; QString m_Tel; int m_DurationInSeconds; diff --git a/Settings.cpp b/Settings.cpp index 6032f4b..0adaf34 100644 --- a/Settings.cpp +++ b/Settings.cpp @@ -30,14 +30,14 @@ Settings::Settings() setMode(MODE_EXPORT); // We don't process anything by default - setShouldProcess(TYPE_SENT, EventTypes::EVENT_TYPE_SMS, false); - setShouldProcess(TYPE_SENT, EventTypes::EVENT_TYPE_MMS, false); - setShouldProcess(TYPE_SENT, EventTypes::EVENT_TYPE_CHAT, false); + setShouldProcess(OUTGOING, EventTypes::EVENT_TYPE_SMS, false); + setShouldProcess(OUTGOING, EventTypes::EVENT_TYPE_MMS, false); + setShouldProcess(OUTGOING, EventTypes::EVENT_TYPE_CHAT, false); // We still don't process anything by default - setShouldProcess(TYPE_RECIEVED, EventTypes::EVENT_TYPE_SMS, false); - setShouldProcess(TYPE_RECIEVED, EventTypes::EVENT_TYPE_MMS, false); - setShouldProcess(TYPE_RECIEVED, EventTypes::EVENT_TYPE_CHAT, false); + setShouldProcess(INCOMING, EventTypes::EVENT_TYPE_SMS, false); + setShouldProcess(INCOMING, EventTypes::EVENT_TYPE_MMS, false); + setShouldProcess(INCOMING, EventTypes::EVENT_TYPE_CHAT, false); // Default to the UK :) setCountryCode(44); diff --git a/Settings.h b/Settings.h index 0819aa7..c8bad92 100644 --- a/Settings.h +++ b/Settings.h @@ -41,12 +41,12 @@ public: static const int kNumModes = MODE_EXPORT + 1; // Options for targets - sent or recieved - enum eTargets + enum eDirection { - TYPE_SENT, - TYPE_RECIEVED, + OUTGOING, + INCOMING, }; - static const int kNumTargets = TYPE_RECIEVED + 1; + static const int kNumTargets = INCOMING + 1; private: // The current UI mode of the application (Console/GUI) @@ -82,8 +82,8 @@ public: eMode const Mode() const { return m_Mode; } eMode const setMode(const eMode mode) { return m_Mode = mode; } - bool const ShouldProcess(const eTargets target, const EventTypes::eEventTypes eventType) const { return m_ShouldProcess[target][eventType]; } - bool const setShouldProcess(const eTargets target, const EventTypes::eEventTypes eventType, const bool shouldProcess = true){ return m_ShouldProcess[target][eventType] = shouldProcess; } + bool const ShouldProcess(const eDirection target, const EventTypes::eEventTypes eventType) const { return m_ShouldProcess[target][eventType]; } + bool const setShouldProcess(const eDirection target, const EventTypes::eEventTypes eventType, const bool shouldProcess = true){ return m_ShouldProcess[target][eventType] = shouldProcess; } bool const anyToProcess() { for(int targetIndex = 0; targetIndex < kNumTargets; ++targetIndex) diff --git a/Windows/TypesWindow.cpp b/Windows/TypesWindow.cpp index 8a52d7a..b4b86e3 100644 --- a/Windows/TypesWindow.cpp +++ b/Windows/TypesWindow.cpp @@ -236,14 +236,14 @@ void TypesWindow::OrientationChanged() void TypesWindow::Continue() { - CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_CALL, cbMadeCalls->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_SMS, cbSentSMS->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_MMS, cbSentMMS->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_CHAT, cbSentChat->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_CALL, cbRecvCalls->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_SMS, cbRecvSMS->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_MMS, cbRecvMMS->checkState() == Qt::Checked); - CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_CHAT, cbRecvChat->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_CALL, cbMadeCalls->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_SMS, cbSentSMS->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_MMS, cbSentMMS->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_CHAT, cbSentChat->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_CALL, cbRecvCalls->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_SMS, cbRecvSMS->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_MMS, cbRecvMMS->checkState() == Qt::Checked); + CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_CHAT, cbRecvChat->checkState() == Qt::Checked); if(CurrentSettings().anyToProcess()) Advance(); -- 1.7.9.5