From c45d94e7c544cfa2e177d751914fe6830179ef62 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Sat, 7 Mar 2015 16:53:12 +0100 Subject: [PATCH] Replace ME_SENDER_STR static members with a macro in logger.h --- datafilesloader.cpp | 2 -- datafilesloader.h | 2 -- datamanager.cpp | 1 - datamanager.h | 1 - gui/graphview.cpp | 1 - gui/graphview.h | 1 - gui/graphviewcontextmenu.h | 2 -- integrationtablemodel.cpp | 2 -- integrationtablemodel.h | 2 -- integrator.cpp | 2 -- integrator.h | 2 -- logger.h | 3 +++ signalcontroller.cpp | 1 - signalcontroller.h | 2 -- signaldrawer.cpp | 1 - signaldrawer.h | 3 --- singlerundata.cpp | 2 -- singlerundata.h | 2 -- usersettings.cpp | 4 ++-- 19 files changed, 5 insertions(+), 31 deletions(-) diff --git a/datafilesloader.cpp b/datafilesloader.cpp index 0ae0181..f8d5d80 100644 --- a/datafilesloader.cpp +++ b/datafilesloader.cpp @@ -26,8 +26,6 @@ #include "gui/failedfilesdialog.h" #include -const QString DataFilesLoader::ME_SENDER_STR("DataFilesLoader"); - DataFilesLoader::DataFilesLoader(QObject *parent) : QObject(parent) { diff --git a/datafilesloader.h b/datafilesloader.h index 9f4852b..1bc4a71 100644 --- a/datafilesloader.h +++ b/datafilesloader.h @@ -45,8 +45,6 @@ public: private: QStringList m_supportedFileTypes; - static const QString ME_SENDER_STR; - signals: public slots: diff --git a/datamanager.cpp b/datamanager.cpp index 6209d8b..ccaa73b 100644 --- a/datamanager.cpp +++ b/datamanager.cpp @@ -27,7 +27,6 @@ #include -const QString DataManager::ME_SENDER_STR("DataManager"); const char DataManager::UNIT_DEGREES_CELSIUS_TEXT[] = {static_cast(0xB0), 0x43, 0x00}; const char DataManager::UNIT_KILOVOLTS_TEXT[] = {0x4B, 0x56, 0x00}; const char DataManager::UNIT_KILOVOLTS_ALT1_TEXT[] = {0x6B, 0x56, 0x00}; diff --git a/datamanager.h b/datamanager.h index 7587717..8361fcc 100644 --- a/datamanager.h +++ b/datamanager.h @@ -77,7 +77,6 @@ private: ExportRawDataDialog m_exportRawDataDialog; ExportGraphToImageDialog m_graphToImageExportDialog; - static const QString ME_SENDER_STR; static const char UNIT_DEGREES_CELSIUS_TEXT[]; static const char UNIT_KILOVOLTS_TEXT[]; static const char UNIT_KILOVOLTS_ALT1_TEXT[]; diff --git a/gui/graphview.cpp b/gui/graphview.cpp index 36b60e4..31bb2e0 100644 --- a/gui/graphview.cpp +++ b/gui/graphview.cpp @@ -29,7 +29,6 @@ #include const double GraphView::DEFAULT_Y_MARGIN = 0.05; -const QString GraphView::ME_SENDER_STR("GraphView"); GraphView::GraphView(std::shared_ptr controller, QWidget* parent) : QWidget(parent), SignalDrawer(controller, Constraints(SignalController::RELATIVE_MIN, RELATIVE_Y_MIN_WITH_MARGIN(), SignalController::RELATIVE_MAX, diff --git a/gui/graphview.h b/gui/graphview.h index 58179c8..b4795aa 100644 --- a/gui/graphview.h +++ b/gui/graphview.h @@ -111,7 +111,6 @@ private: int m_zoomRectLastYPix; static const double DEFAULT_Y_MARGIN; - static const QString ME_SENDER_STR; private slots: void onCtxMenuDeletePeak(const QPoint pixPos); diff --git a/gui/graphviewcontextmenu.h b/gui/graphviewcontextmenu.h index 3615a0c..ead5356 100644 --- a/gui/graphviewcontextmenu.h +++ b/gui/graphviewcontextmenu.h @@ -39,8 +39,6 @@ private: QPoint m_relPixPos; - static const QString ME_SENDER_STR; - private slots: void onDeletePeakTriggered(); void onZoomOutTriggered(); diff --git a/integrationtablemodel.cpp b/integrationtablemodel.cpp index f7166a9..3c04a52 100644 --- a/integrationtablemodel.cpp +++ b/integrationtablemodel.cpp @@ -24,8 +24,6 @@ #include "logger.h" #include -const QString IntegrationTableModel::ME_SENDER_STR("IntegrationTableModel"); - IntegrationTableModel::IntegrationTableModel(const std::shared_ptr integrator, QObject* parent) : QAbstractTableModel(parent), m_integrator(integrator) diff --git a/integrationtablemodel.h b/integrationtablemodel.h index 7a41b81..63a8ba5 100644 --- a/integrationtablemodel.h +++ b/integrationtablemodel.h @@ -41,8 +41,6 @@ public: private: const std::shared_ptr m_integrator; - static const QString ME_SENDER_STR; - public slots: void prepToAdd(const int idx); void prepToDelete(const int idx); diff --git a/integrator.cpp b/integrator.cpp index 7714fae..08fa60f 100644 --- a/integrator.cpp +++ b/integrator.cpp @@ -25,8 +25,6 @@ #include -const QString Integrator::ME_SENDER_STR("Integrator"); - Integrator::Integrator(std::shared_ptr signal, QObject* parent) : QObject(parent), m_peakCount(0), diff --git a/integrator.h b/integrator.h index 71e89a6..3bea748 100644 --- a/integrator.h +++ b/integrator.h @@ -66,8 +66,6 @@ private: PeakMap m_peakMap; std::shared_ptr m_signal; - static const QString ME_SENDER_STR; - signals: void addingPeak(const int idx); void deletingPeak(const int idx); diff --git a/logger.h b/logger.h index 2f308b8..f620e01 100644 --- a/logger.h +++ b/logger.h @@ -36,6 +36,9 @@ #define __QFUNC__ QString(__func__) + QString("()") +#define ME_SENDER_STR typeid(*this).name() +#define ME_SENDER_STR_S(ptr) typeid(*ptr).name() + class LocalLogger; typedef std::shared_ptr LocalLoggerPtr; diff --git a/signalcontroller.cpp b/signalcontroller.cpp index caeb12e..969fbdf 100644 --- a/signalcontroller.cpp +++ b/signalcontroller.cpp @@ -31,7 +31,6 @@ const double SignalController::RELATIVE_MAX = 1.0; const double SignalController::RELATIVE_MIN = 0.0; -const QString SignalController::ME_SENDER_STR("SignalController"); const QString SignalController::KEY_PEAKS("peaks"); diff --git a/signalcontroller.h b/signalcontroller.h index d8105c3..6db279a 100644 --- a/signalcontroller.h +++ b/signalcontroller.h @@ -148,8 +148,6 @@ private: void drawIntegratedPeak(const std::shared_ptr peak); PeakDrawData genPeakDrawData(const std::shared_ptr peak); - static const QString ME_SENDER_STR; - static const QString KEY_PEAKS; public slots: diff --git a/signaldrawer.cpp b/signaldrawer.cpp index b0262c9..7ace5d3 100644 --- a/signaldrawer.cpp +++ b/signaldrawer.cpp @@ -26,7 +26,6 @@ #include #include -const QString SignalDrawer::ME_SENDER_STR("SignalDrawer"); const int SignalDrawer::AXIS_LABEL_BORDER_OFFSET(2); const int SignalDrawer::AXIS_LABEL_SCALE_OFFSET(3); const int SignalDrawer::MAXIMAL_AXIS_BIGTICK_STEP(75); diff --git a/signaldrawer.h b/signaldrawer.h index 31ef120..5a2cd15 100644 --- a/signaldrawer.h +++ b/signaldrawer.h @@ -134,9 +134,6 @@ private: const QString m_xAxisLabelText; const QString m_yAxisLabelText; - - static const QString ME_SENDER_STR; - }; #endif // SIGNALDRAWER_H diff --git a/singlerundata.cpp b/singlerundata.cpp index 6b6887e..5d1d472 100644 --- a/singlerundata.cpp +++ b/singlerundata.cpp @@ -28,8 +28,6 @@ #include #include -const QString SingleRunData::ME_SENDER_STR("SingleRunData"); - SingleRunData::SingleRunData(const QString& methodName, const QString& operatorName, const QString& sampleInfo, const QDate date, const QTime time, SignalsMap& sigs, SignalControllersMap& ctrls, const QString& dirname, const QString& absPath, QObject *parent) : diff --git a/singlerundata.h b/singlerundata.h index b27cb4b..7b818cc 100644 --- a/singlerundata.h +++ b/singlerundata.h @@ -72,8 +72,6 @@ private: SignalsMap m_signals; const QTime m_time; - static const QString ME_SENDER_STR; - signals: public slots: diff --git a/usersettings.cpp b/usersettings.cpp index 7bc2f8c..509ce69 100644 --- a/usersettings.cpp +++ b/usersettings.cpp @@ -14,13 +14,13 @@ void UserSettings::dispose() QVariant UserSettings::get(const QString key) { if (s_me == nullptr) { - Logger::log(Logger::Level::ERROR, "UserSettings", __QFUNC__ + "UserSettings not initialized"); + Logger::log(Logger::Level::ERROR, ME_SENDER_STR_S(s_me), __QFUNC__ + "UserSettings not initialized"); return QVariant(); } std::lock_guard lk(s_me->m_lock); QVariant v = s_me->m_settings[key.toLower()]; - Logger::log(Logger::Level::DEBUG, "UserSettings ", __QFUNC__ + QString("Key: %1, Value: %2").arg(key).arg(v.toString())); + Logger::log(Logger::Level::DEBUG, ME_SENDER_STR_S(s_me), __QFUNC__ + QString("Key: %1, Value: %2").arg(key).arg(v.toString())); return v; } -- 2.43.5