From 5dd4fe05df7619fb68356613b698fb373f4fccee Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 4 Jul 2010 10:13:17 +0200 Subject: Fix MovieInfoPage The first page of NewMovieWizard gave me quite a headache. It crashed with a segmentation fault because of exposing mDvdNo via registerField() without actually assigning a QCheckBox to it. The backtrace isn't very helpful in such a case. I also fixed some bugs on the way: 1. use SmTreeItem::setData in SmTreeModel::addRow instead of deleting the old item and creating a new one. This way I don't need to take care of the parent. 2. get data of old item in SmTreeModel::reparent before calling removeRows. This call deletes the item. 3. Fix column alignments in WizardTreeModel for size column --- newmoviewizard.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'newmoviewizard.h') diff --git a/newmoviewizard.h b/newmoviewizard.h index a92d91d..e28a3a9 100644 --- a/newmoviewizard.h +++ b/newmoviewizard.h @@ -21,11 +21,13 @@ class QLineEdit; class QSpinBox; class QPushButton; class QComboBox; +class QCheckBox; class NewMovieWizard : public QWizard { Q_OBJECT public: explicit NewMovieWizard(QWidget *parent = 0); + void accept(); }; @@ -33,11 +35,14 @@ class MovieInfoPage : public QWizardPage { Q_OBJECT public: explicit MovieInfoPage(QWidget *parent = 0); + WizardTreeModel *model() { return mFileModel; } private slots: void addFiles(); void removeFile(); + void onDvd(int); void typeChanged(QString); + void setNextDvdNo(); private: QTreeView *mFileView; @@ -49,6 +54,8 @@ class MovieInfoPage : public QWizardPage { QPushButton *mAddFile; QPushButton *mRemoveFile; QComboBox *mFileType; + QCheckBox *mOnDvd; + QPushButton *mNextDvdNo; WizardTreeModel *mFileModel; SmTreeItem *mMoviesItem; SmTreeItem *mCoversItem; @@ -58,7 +65,7 @@ class WizardTreeModel : public SmTreeModel { Q_OBJECT public: enum CustomRoles { FileNameRole = Qt::UserRole + 1, FileSizeRole = Qt::UserRole + 2, FileTypeRole = Qt::UserRole + 3, FullPathRole = Qt::UserRole + 4 }; - enum Fields { FileName = 0, FileSize = 1, FileType = 3, FullPath = 4 }; + enum Fields { FileName = 0, FileSize = 1, FileType = 2, FullPath = 3 }; enum Types { Movie = 1, FrontCover = 2, BackCover = 3, GeneralCover = 4 }; explicit WizardTreeModel(QStringList &headers, QObject *parent = 0); virtual ~WizardTreeModel() {} -- cgit v1.2.3-70-g09d2