From 96df0c7b20a6f3e8c118d373f52193f71ab4b521 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 12 Jul 2013 10:39:31 +0200 Subject: Split MappingEditor into two classes Split MappingEditor into a Dialog and the actual MappingEditorWidget. Turns out that we need the Widget in NewMovieWizard, also. No need for code duplication. NB: Before this I tried to convert the WizardTreeModel to a QStandardItemModel, but it had severe performance problems. Most likely I would have ended up subclassing QStandardItemModel anyway, so leave it as it is. --- archiveview.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'archiveview.h') diff --git a/archiveview.h b/archiveview.h index 1359e88..36c3eb4 100644 --- a/archiveview.h +++ b/archiveview.h @@ -133,10 +133,13 @@ class FileTypeDelegate : public QStyledItemDelegate { QHash mFiletypeMap; }; -class MappingEditor : public QDialog { +/* separate widget since we need it in NewMovieWizard + * and editing genres, actors in the new ArchiveView */ + +class MappingEditorWidget : public QWidget { Q_OBJECT public: - explicit MappingEditor(const QString &caption, QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit MappingEditorWidget(const QString &caption, QWidget *parent = 0); void fillCompleter(const QStringList &completions); void setCurrentItems(const QStringList &items); QStringList items() const; @@ -151,13 +154,27 @@ class MappingEditor : public QDialog { SmTreeView *mView; QPushButton *mAdd; QPushButton *mRemove; - QPushButton *mAccept; - QPushButton *mCancel; QLineEdit *mEditor; QCompleter *mCompleter; QStringListModel *mCompleterModel; }; +/* dialog putting MappingEditorWidget and + * Cancel, Accept buttons together. Used when editing + * ArchiveView */ + +class MappingEditor : public QDialog { + Q_OBJECT + public: + explicit MappingEditor(const QString &caption, QWidget *parent = 0, Qt::WindowFlags f = 0); + MappingEditorWidget *widget() { return mWidget; } + + private: + QPushButton *mAccept; + QPushButton *mCancel; + MappingEditorWidget *mWidget; +}; + class MetadataEditor : public QDialog { Q_OBJECT public: -- cgit v1.2.3-70-g09d2