Renamed destination to direction for clarity.
authorJamie Thompson <jamie@.(none)>
Thu, 25 Aug 2011 00:29:18 +0000 (01:29 +0100)
committerJamie Thompson <jamie@.(none)>
Thu, 25 Aug 2011 00:29:18 +0000 (01:29 +0100)
DBBackends/RtcomEventLogger.cpp
EventParsers/CSVSymbianEventLogParser.cpp
EventTypes/PhoneCall.cpp
EventTypes/PhoneCall.h
Settings.cpp
Settings.h
Windows/TypesWindow.cpp

index 8e54f38..077bdfe 100644 (file)
@@ -99,8 +99,8 @@ void RtcomEventLogger::ProcessService(EventProcessors::iEventProcessor &processo
 {
        RTComEl *el_nonconst(const_cast<RTComEl *>(&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)
        {
index d4eebdb..b24c894 100644 (file)
@@ -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")));
index bfed790..7997fc2 100644 (file)
@@ -61,7 +61,7 @@ PhoneCall::~PhoneCall()
 PhoneCall::PhoneCall(const Settings &settings, const RTComElEvent &event, const QList<RTComElAttachment*> 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 &timestamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments) :
+PhoneCall::PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime &timestamp, 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("<SelfHandle>"));
@@ -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";
index 0d440cd..f709713 100644 (file)
@@ -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 &timestamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments = AttachmentCollection());
+               PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime &timestamp, 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;
index 6032f4b..0adaf34 100644 (file)
@@ -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);
index 0819aa7..c8bad92 100644 (file)
@@ -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)
index 8a52d7a..b4b86e3 100644 (file)
@@ -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();