aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-10-23 19:08:10 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-10-23 19:09:34 +0200
commitd2833de42430b7771eb572d71ba81eec1079f91f (patch)
tree32e638b4c8a09f0fb9e117d1c9bda95c708a6e9d
parentc8a25189bcb1381eddf46b9a9743ba48e929439e (diff)
qt: remove monitoreddatamapper
We haven't used the viewModified signal in ages, so we can use a normal QDataWidgetMapper.
-rw-r--r--src/Makefile.qt.include3
-rw-r--r--src/qt/monitoreddatamapper.cpp39
-rw-r--r--src/qt/monitoreddatamapper.h34
-rw-r--r--src/qt/optionsdialog.cpp4
-rw-r--r--src/qt/optionsdialog.h4
5 files changed, 4 insertions, 80 deletions
diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
index f8f4439159..8fb4af81ac 100644
--- a/src/Makefile.qt.include
+++ b/src/Makefile.qt.include
@@ -110,7 +110,6 @@ QT_MOC_CPP = \
qt/moc_intro.cpp \
qt/moc_macdockiconhandler.cpp \
qt/moc_macnotificationhandler.cpp \
- qt/moc_monitoreddatamapper.cpp \
qt/moc_notificator.cpp \
qt/moc_openuridialog.cpp \
qt/moc_optionsdialog.cpp \
@@ -177,7 +176,6 @@ BITCOIN_QT_H = \
qt/intro.h \
qt/macdockiconhandler.h \
qt/macnotificationhandler.h \
- qt/monitoreddatamapper.h \
qt/networkstyle.h \
qt/notificator.h \
qt/openuridialog.h \
@@ -269,7 +267,6 @@ BITCOIN_QT_CPP = \
qt/csvmodelwriter.cpp \
qt/guiutil.cpp \
qt/intro.cpp \
- qt/monitoreddatamapper.cpp \
qt/networkstyle.cpp \
qt/notificator.cpp \
qt/optionsdialog.cpp \
diff --git a/src/qt/monitoreddatamapper.cpp b/src/qt/monitoreddatamapper.cpp
deleted file mode 100644
index 5931c53872..0000000000
--- a/src/qt/monitoreddatamapper.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2011-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include "monitoreddatamapper.h"
-
-#include <QMetaObject>
-#include <QMetaProperty>
-#include <QWidget>
-
-MonitoredDataMapper::MonitoredDataMapper(QObject *parent) :
- QDataWidgetMapper(parent)
-{
-}
-
-void MonitoredDataMapper::addMapping(QWidget *widget, int section)
-{
- QDataWidgetMapper::addMapping(widget, section);
- addChangeMonitor(widget);
-}
-
-void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteArray &propertyName)
-{
- QDataWidgetMapper::addMapping(widget, section, propertyName);
- addChangeMonitor(widget);
-}
-
-void MonitoredDataMapper::addChangeMonitor(QWidget *widget)
-{
- // Watch user property of widget for changes, and connect
- // the signal to our viewModified signal.
- QMetaProperty prop = widget->metaObject()->userProperty();
- int signal = prop.notifySignalIndex();
- int method = this->metaObject()->indexOfMethod("viewModified()");
- if(signal != -1 && method != -1)
- {
- QMetaObject::connect(widget, signal, this, method);
- }
-}
diff --git a/src/qt/monitoreddatamapper.h b/src/qt/monitoreddatamapper.h
deleted file mode 100644
index b3237d3e09..0000000000
--- a/src/qt/monitoreddatamapper.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2011-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef MONITOREDDATAMAPPER_H
-#define MONITOREDDATAMAPPER_H
-
-#include <QDataWidgetMapper>
-
-QT_BEGIN_NAMESPACE
-class QWidget;
-QT_END_NAMESPACE
-
-/** Data to Widget mapper that watches for edits and notifies listeners when a field is edited.
- This can be used, for example, to enable a commit/apply button in a configuration dialog.
- */
-class MonitoredDataMapper : public QDataWidgetMapper
-{
- Q_OBJECT
-
-public:
- explicit MonitoredDataMapper(QObject *parent=0);
-
- void addMapping(QWidget *widget, int section);
- void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
-
-private:
- void addChangeMonitor(QWidget *widget);
-
-signals:
- void viewModified();
-};
-
-#endif // MONITOREDDATAMAPPER_H
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 279467129f..67be174d55 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -11,7 +11,6 @@
#include "bitcoinunits.h"
#include "guiutil.h"
-#include "monitoreddatamapper.h"
#include "optionsmodel.h"
#include "main.h" // for MAX_SCRIPTCHECK_THREADS
@@ -24,6 +23,7 @@
#include <boost/thread.hpp>
+#include <QDataWidgetMapper>
#include <QDir>
#include <QIntValidator>
#include <QLocale>
@@ -105,7 +105,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
#endif
/* Widget-to-option mapper */
- mapper = new MonitoredDataMapper(this);
+ mapper = new QDataWidgetMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setOrientation(Qt::Vertical);
diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h
index 6b62069660..39c53f4391 100644
--- a/src/qt/optionsdialog.h
+++ b/src/qt/optionsdialog.h
@@ -7,7 +7,7 @@
#include <QDialog>
-class MonitoredDataMapper;
+class QDataWidgetMapper;
class OptionsModel;
class QValidatedLineEdit;
@@ -52,7 +52,7 @@ signals:
private:
Ui::OptionsDialog *ui;
OptionsModel *model;
- MonitoredDataMapper *mapper;
+ QDataWidgetMapper *mapper;
bool fProxyIpValid;
};