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.

This commit is contained in:
LoRd_MuldeR 2012-12-15 23:23:22 +01:00
parent a48dfadc98
commit 5c3386dbde
3 changed files with 33 additions and 20 deletions

View File

@ -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!)

View File

@ -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 <QFileInfo>
#include <QMessageBox>
#include <QTimer>
@ -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("<b>%1</b><br>%2").arg(tr("Import Cue Sheet"), tr("The following Cue Sheet will be split and imported into LameXP.")));
ui->labelHeaderText->setText(QString("<b>%1</b><br>%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)

View File

@ -22,15 +22,19 @@
#pragma once
#include <QDialog>
#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);