From 5c3386dbde6e82390c0ad4337c0fb3f5852b060d Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 15 Dec 2012 23:23:22 +0100 Subject: [PATCH] Switched the method of how the Designer UI file is used in the CueSheetImport class to "The Single Inheritance Approach" (with "Using a Pointer Member Variable"). This is the method which Qt recommends for large projects. --- src/Config.h | 2 +- src/Dialog_CueImport.cpp | 37 ++++++++++++++++++++++--------------- src/Dialog_CueImport.h | 14 ++++++++++---- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/Config.h b/src/Config.h index 3ee4a7e2..fcbc5038 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 7 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 6 -#define VER_LAMEXP_BUILD 1218 +#define VER_LAMEXP_BUILD 1219 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_CueImport.cpp b/src/Dialog_CueImport.cpp index 4f29c70c..5cd461e8 100644 --- a/src/Dialog_CueImport.cpp +++ b/src/Dialog_CueImport.cpp @@ -21,6 +21,10 @@ #include "Dialog_CueImport.h" +//UIC includes +#include "../tmp/UIC_CueSheetImport.h" + +//LameXP includes #include "Global.h" #include "Model_CueSheet.h" #include "Model_AudioFile.h" @@ -30,6 +34,7 @@ #include "Thread_CueSplitter.h" #include "LockedFile.h" +//Qt includes #include #include #include @@ -49,11 +54,12 @@ CueImportDialog::CueImportDialog(QWidget *parent, FileListModel *fileList, const QString &cueFile) : QDialog(parent), + ui(new Ui::CueSheetImport), m_cueFileName(cueFile), m_fileList(fileList) { //Init the dialog, from the .ui file - setupUi(this); + ui->setupUi(this); //Fix size setMinimumSize(this->size()); @@ -64,25 +70,26 @@ CueImportDialog::CueImportDialog(QWidget *parent, FileListModel *fileList, const connect(m_model, SIGNAL(modelReset()), this, SLOT(modelChanged())); //Setup table view - treeView->setModel(m_model); - treeView->header()->setStretchLastSection(false); - treeView->header()->setResizeMode(QHeaderView::ResizeToContents); - treeView->header()->setResizeMode(1, QHeaderView::Stretch); - treeView->header()->setMovable(false); - treeView->setItemsExpandable(false); + ui->treeView->setModel(m_model); + ui->treeView->header()->setStretchLastSection(false); + ui->treeView->header()->setResizeMode(QHeaderView::ResizeToContents); + ui->treeView->header()->setResizeMode(1, QHeaderView::Stretch); + ui->treeView->header()->setMovable(false); + ui->treeView->setItemsExpandable(false); //Enable up/down button - connect(imprtButton, SIGNAL(clicked()), this, SLOT(importButtonClicked())); - connect(browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); - connect(loadOtherButton, SIGNAL(clicked()), this, SLOT(loadOtherButtonClicked())); + connect(ui->imprtButton, SIGNAL(clicked()), this, SLOT(importButtonClicked())); + connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); + connect(ui->loadOtherButton, SIGNAL(clicked()), this, SLOT(loadOtherButtonClicked())); //Translate - labelHeaderText->setText(QString("%1
%2").arg(tr("Import Cue Sheet"), tr("The following Cue Sheet will be split and imported into LameXP."))); + ui->labelHeaderText->setText(QString("%1
%2").arg(tr("Import Cue Sheet"), tr("The following Cue Sheet will be split and imported into LameXP."))); } CueImportDialog::~CueImportDialog(void) { LAMEXP_DELETE(m_model); + LAMEXP_DELETE(ui); } //////////////////////////////////////////////////////////// @@ -222,10 +229,10 @@ int CueImportDialog::exec(void) void CueImportDialog::modelChanged(void) { - treeView->expandAll(); - editOutputDir->setText(QDir::toNativeSeparators(m_outputDir)); - labelArtist->setText(m_model->getAlbumPerformer().isEmpty() ? tr("Unknown Artist") : m_model->getAlbumPerformer()); - labelAlbum->setText(m_model->getAlbumTitle().isEmpty() ? tr("Unknown Album") : m_model->getAlbumTitle()); + ui->treeView->expandAll(); + ui->editOutputDir->setText(QDir::toNativeSeparators(m_outputDir)); + ui->labelArtist->setText(m_model->getAlbumPerformer().isEmpty() ? tr("Unknown Artist") : m_model->getAlbumPerformer()); + ui->labelAlbum->setText(m_model->getAlbumTitle().isEmpty() ? tr("Unknown Album") : m_model->getAlbumTitle()); } void CueImportDialog::browseButtonClicked(void) diff --git a/src/Dialog_CueImport.h b/src/Dialog_CueImport.h index a63e0326..59939f16 100644 --- a/src/Dialog_CueImport.h +++ b/src/Dialog_CueImport.h @@ -22,15 +22,19 @@ #pragma once #include -#include "../tmp/UIC_CueSheetImport.h" - -#include "Model_AudioFile.h" class CueSheetModel; class LockedFile; +class AudioFileModel; class FileListModel; -class CueImportDialog : public QDialog, private Ui::CueSheetImport +//UIC forward declartion +namespace Ui { + class CueSheetImport; +} + +//CueImportDialog class +class CueImportDialog : public QDialog { Q_OBJECT @@ -51,6 +55,8 @@ private slots: void analyzedFile(const AudioFileModel &file); private: + Ui::CueSheetImport *ui; //for Qt UIC + void importCueSheet(void); bool analyzeFiles(QStringList &files); void splitFiles(void);