From: Mikko Keinänen Date: Wed, 22 Dec 2010 23:17:27 +0000 (+0200) Subject: Emitting a dataChanged signal from setData after succesful update and connecting... X-Git-Url: http://vcs.maemo.org/git/?p=emufront;a=commitdiff_plain;h=b98fce7167dd8e35d165e28d3a1bdec16a5470a3 Emitting a dataChanged signal from setData after succesful update and connecting the signal in EmuFrontEditView. --- diff --git a/src/models/emufrontfileobjectmodel.cpp b/src/models/emufrontfileobjectmodel.cpp index 0720a4b..fd89a1b 100644 --- a/src/models/emufrontfileobjectmodel.cpp +++ b/src/models/emufrontfileobjectmodel.cpp @@ -54,6 +54,7 @@ bool EmuFrontFileObjectModel::setData(const QModelIndex &index, const QVariant & } refresh(); + if (ok) emit dataChanged(); return ok; } diff --git a/src/models/emufrontfileobjectmodel.h b/src/models/emufrontfileobjectmodel.h index f2cbc4e..3595d76 100644 --- a/src/models/emufrontfileobjectmodel.h +++ b/src/models/emufrontfileobjectmodel.h @@ -44,6 +44,9 @@ public: EmuFrontFileObject_FileUpdateTime }; +signals: + void dataChanged(); + protected: virtual void refresh(); virtual QString constructSelect(QString where = "") const; diff --git a/src/models/externalexecutablemodel.cpp b/src/models/externalexecutablemodel.cpp index a6a786c..dc57af3 100644 --- a/src/models/externalexecutablemodel.cpp +++ b/src/models/externalexecutablemodel.cpp @@ -103,6 +103,7 @@ bool ExternalExecutableModel::setData(const QModelIndex &index, const QVariant & ok = false; } refresh(); + if (ok) emit dataChanged(); return ok; } diff --git a/src/models/externalexecutablemodel.h b/src/models/externalexecutablemodel.h index b4d0efe..2e33343 100644 --- a/src/models/externalexecutablemodel.h +++ b/src/models/externalexecutablemodel.h @@ -48,6 +48,9 @@ public: }; virtual void refresh(); +signals: + void dataChanged(); + protected: virtual QString constructSelect(QString where = "") const; virtual bool setSetup(int isd, int setupId); diff --git a/src/models/filepathmodel.cpp b/src/models/filepathmodel.cpp index bd59729..0622a5c 100644 --- a/src/models/filepathmodel.cpp +++ b/src/models/filepathmodel.cpp @@ -96,6 +96,7 @@ bool FilePathModel::setData(const QModelIndex &index, const QVariant &value, int ok = false; qDebug() << "File path model, this shouldn't be happening!"; } + if (ok) emit dataChanged(); refresh(); return ok; } diff --git a/src/models/filepathmodel.h b/src/models/filepathmodel.h index 712ba35..3aa4fb9 100644 --- a/src/models/filepathmodel.h +++ b/src/models/filepathmodel.h @@ -44,6 +44,10 @@ public: FilePathObject* getFilePathObject(const QModelIndex &index); virtual bool setScanned(int id); +signals: + void dataChanged(); + + protected: virtual void refresh(); virtual QString constructSelect(QString where = "") const; diff --git a/src/models/setupmodel.cpp b/src/models/setupmodel.cpp index 6c52270..9a871d6 100644 --- a/src/models/setupmodel.cpp +++ b/src/models/setupmodel.cpp @@ -105,6 +105,7 @@ bool SetupModel::setData(const QModelIndex &index, const QVariant &value, int /* ok = false; qDebug() << "Setup model, this shouldn't be happening!"; }; + if (ok) emit dataChanged(); refresh(); return ok; } diff --git a/src/models/setupmodel.h b/src/models/setupmodel.h index 3c64344..04c9ee0 100644 --- a/src/models/setupmodel.h +++ b/src/models/setupmodel.h @@ -41,6 +41,9 @@ public: static const QString FILE_TYPE_EXTENSION_SEPARATOR; virtual void refresh(); +signals: + void dataChanged(); + protected: virtual QString constructSelect(QString where = "") const; virtual bool setPlatform(int id, int platformId); diff --git a/src/views/emufronteditview.cpp b/src/views/emufronteditview.cpp index 3d7b713..8d8c29a 100644 --- a/src/views/emufronteditview.cpp +++ b/src/views/emufronteditview.cpp @@ -65,6 +65,7 @@ void EmuFrontEditView::connectSignals() connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(objectList, SIGNAL(clicked(const QModelIndex &)), this, SLOT(listObjectClicked(const QModelIndex &))); + connect(model, SIGNAL(dataChanged()), this, SLOT(onDataChanged())); connect(editButton, SIGNAL(clicked()), this, SLOT(editButtonClicked())); connect(addButton, SIGNAL(clicked()), this, SLOT(addButtonClicked())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteButtonClicked())); @@ -133,4 +134,7 @@ bool EmuFrontEditView::confirm(QString &msg) return true; } - +void EmuFrontEditView::onDataChanged() +{ + qDebug() << "Data changed"; +} diff --git a/src/views/emufronteditview.h b/src/views/emufronteditview.h index b03b466..eb1e590 100644 --- a/src/views/emufronteditview.h +++ b/src/views/emufronteditview.h @@ -38,6 +38,7 @@ private slots: void addButtonClicked(); void deleteButtonClicked(); void listObjectClicked(const QModelIndex &); + void onDataChanged(); protected: EmuFrontQueryModel *model;