diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/monitoreddatamapper.cpp | 39 | ||||
-rw-r--r-- | src/qt/monitoreddatamapper.h | 34 | ||||
-rw-r--r-- | src/qt/optionsdialog.cpp | 4 | ||||
-rw-r--r-- | src/qt/optionsdialog.h | 4 |
4 files changed, 4 insertions, 77 deletions
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; }; |