qt: remove monitoreddatamapper
We haven't used the viewModified signal in ages, so we can use a normal QDataWidgetMapper.
This commit is contained in:
parent
c8a25189bc
commit
d2833de424
5 changed files with 4 additions and 80 deletions
|
@ -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 \
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue