- replace Ui::QProjectMConfigDialog to ::QProjectMConfigDialog

- tested save and load behavior. partially implemented 



git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@772 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2008-01-25 07:13:08 +00:00
parent 38ef0b8cf7
commit 2c2b7f3d2f
5 changed files with 52 additions and 31 deletions

View File

@ -1,13 +1,17 @@
#include "QProjectMConfigDialog.hpp"
#include <QtDebug>
QProjectMConfigDialog::QProjectMConfigDialog(const std::string & configFile, projectM & projectM, QWidget * parent = 0, Qt::WindowFlags f = 0 ) : QDialog(parent, f), _configFile(configFile), _projectM(projectM) {
QProjectMConfigDialog::QProjectMConfigDialog(const std::string & configFile, projectM * projectM, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f), _configFile(configFile), _projectM(*projectM) {
qDebug() << "!!!";
_ui.setupUi(this);
connect(_ui.buttonBox, SIGNAL(accept()), this, SLOT(saveConfig()));
connect(_ui.buttonBox, SIGNAL(accepted()), this, SLOT(saveConfig()));
loadConfig();
}
void QProjectMConfigDialog::saveConfig() {
qDebug() << "SAVE config";
projectM::Settings settings = _projectM.settings();
@ -25,10 +29,34 @@ void QProjectMConfigDialog::saveConfig() {
settings.aspectCorrection = _ui.useAspectCorrectionCheckBox->checkState() == Qt::Checked;
settings.beatSensitivity = _ui.beatSensitivitySpinBox->value();
_projectM.writeConfig(_configFile, settings);
projectM::writeConfig(_configFile, settings);
qDebug() << "save end";
}
void QProjectMConfigDialog::loadConfig() {
qDebug() << "load config";
const projectM::Settings & settings = _projectM.settings();
//settings.meshX = _ui.meshSizeXComboBox->itemData(_ui.meshSizeXComboBox->currentIndex()).toInt();
//settings.meshY = _ui.meshSizeYComboBox->itemData(_ui.meshSizeYComboBox->currentIndex()).toInt();
_ui.titleFontPathLineEdit->setText(settings.titleFontURL.c_str());
_ui.menuFontPathLineEdit->setText(settings.menuFontURL.c_str());
_ui.startupPlaylistLineEdit->setText(settings.presetURL.c_str());
_ui.useAspectCorrectionCheckBox->setCheckState(settings.aspectCorrection ? Qt::Checked : Qt::Unchecked);
_ui.maxFPSSpinBox->setValue(settings.fps);
_ui.beatSensitivitySpinBox->setValue(settings.beatSensitivity);
_ui.windowHeightSpinBox->setValue(settings.windowHeight);
_ui.windowWidthSpinBox->setValue(settings.windowWidth);
//settings.textureSize = _ui.textureSizeComboBox->itemData(_ui.textureSizeComboBox->currentIndex()).toInt();
_ui.smoothPresetDurationSpinBox->setValue(settings.smoothPresetDuration);
_ui.presetDurationSpinBox->setValue(settings.presetDuration);
qDebug() << "load config END";
}

View File

@ -7,7 +7,7 @@ class QProjectMConfigDialog : public QDialog {
Q_OBJECT
public:
QProjectMConfigDialog(const std::string & configFile, projectM & projectM, QWidget * parent, Qt::WindowFlags f );
QProjectMConfigDialog(const std::string & configFile, projectM * projectM, QWidget * parent = 0, Qt::WindowFlags f = 0);
private:
void loadConfig();

View File

@ -488,22 +488,6 @@ p, li { white-space: pre-wrap; }
<string>Use Aspect Correction</string>
</property>
</widget>
<widget class="QSpinBox" name="beatSensitivitySpinBox" >
<property name="geometry" >
<rect>
<x>111</x>
<y>237</y>
<width>54</width>
<height>24</height>
</rect>
</property>
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Sets how long a preset should be played in seconds before projectM automatically switches to another in the playlist&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
<widget class="QLabel" name="label_12" >
<property name="geometry" >
<rect>
@ -583,6 +567,16 @@ p, li { white-space: pre-wrap; }
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changes the path projectM will use to search for opengl fonts&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="beatSensitivitySpinBox" >
<property name="geometry" >
<rect>
<x>110</x>
<y>240</y>
<width>62</width>
<height>24</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>

View File

@ -29,7 +29,7 @@
#include "QPlaylistModel.hpp"
#include "ui_QProjectM_MainWindow.h"
#include "ui_QProjectMConfigDialog.h"
#include "QProjectMConfigDialog.hpp"
#include "ConfigFile.h"
#include "QXmlPlaylistHandler.hpp"
@ -77,10 +77,9 @@ QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file )
ui = new Ui::QProjectM_MainWindow();
ui->setupUi ( this );
configUi = new Ui::QProjectMConfigDialog();
configDialog = new QDialog();
configUi->setupUi(configDialog);
m_QProjectMWidget = new QProjectMWidget ( config_file, this );
m_timer = new QTimer ( this );
@ -149,7 +148,6 @@ QProjectM_MainWindow::~QProjectM_MainWindow()
}
delete ( ui );
delete( configUi);
}
@ -210,7 +208,9 @@ void QProjectM_MainWindow::postProjectM_Initialize()
ui->tableView->setModel ( playlistModel );
refreshPlaylist();
configDialog = new QProjectMConfigDialog(m_QProjectMWidget->configFile(),
m_QProjectMWidget->getQProjectM(), this);
connect ( m_QProjectMWidget->getQProjectM(), SIGNAL ( presetSwitchedSignal ( bool,unsigned int ) ), this, SLOT ( updatePlaylistSelection ( bool,unsigned int ) ) );
connect ( ui->presetSearchBarLineEdit, SIGNAL ( textChanged ( const QString& ) ), this, SLOT ( updateFilteredPlaylist ( const QString& ) ) );

View File

@ -40,11 +40,11 @@ class QPresetFileDialog;
class QPlaylistFileDialog;
class QPlaylistModel;
class QModelIndex;
class QProjectMConfigDialog;
namespace Ui {
class QProjectM_MainWindow;
class QProjectMConfigDialog;
}
#include <iostream>
@ -271,9 +271,8 @@ private slots:
QString m_currentPlaylistFile;
QPlaylistModel * playlistModel;
Ui::QProjectM_MainWindow * ui;
Ui::QProjectMConfigDialog * configUi;
QDialog * configDialog;
Ui::QProjectM_MainWindow * ui;
QProjectMConfigDialog * configDialog;
QHash<QString, PlaylistItemVector*> historyHash;