From a9fcbb48931bf889ac65eb820a185e5c269babab Mon Sep 17 00:00:00 2001 From: w1z7ard Date: Wed, 23 Jan 2008 05:31:02 +0000 Subject: [PATCH] some stub work on settings dialog git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@763 6778bc44-b910-0410-a7a0-be141de4315d --- src/qprojectM/src/QProjectM_MainWindow.cpp | 55 ++++++++++------------ src/qprojectM/src/QProjectM_MainWindow.hpp | 13 +++-- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/qprojectM/src/QProjectM_MainWindow.cpp b/src/qprojectM/src/QProjectM_MainWindow.cpp index 9f2e97a27..44e675def 100644 --- a/src/qprojectM/src/QProjectM_MainWindow.cpp +++ b/src/qprojectM/src/QProjectM_MainWindow.cpp @@ -102,32 +102,8 @@ QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file ) m_timer->start ( 0 ); - ConfigFile config ( config_file ); - - if ( config.read ( "Fullscreen", false ) ) - this->setWindowState ( this->windowState() | Qt::WindowFullScreen ); - else - this->setWindowState ( this->windowState() & ~Qt::WindowFullScreen ); - + readConfig(config_file); setCentralWidget ( m_QProjectMWidget ); - - -// ((QVBoxLayout*)ui->verticalLayout)->setAlignment(Qt::AlignCenter); - -//ui->verticalLayout->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); -//ui->verticalLayout->sizePolicy().setVerticalStretch(2); -//ui->presetPlayListDockWidget->widget()->layout()->setAlignment(Qt::AlignCenter); - - -// ((QLayout*)((QLayout*)ui->verticalLayout)->itemAt(1))->setSizeConstraint(QLayout::SetNoConstraint); -// ((QLayout*)((QLayout*)ui->verticalLayout)->itemAt(2))->setSizeConstraint(QLayout::SetNoConstraint); - - int wvw = config.read ( "Window Width", 512 ); - int wvh = config.read ( "Window Height", 512 ); - - // Suggest to the widget the projectM window size configuration settings - m_QProjectMWidget->setBaseSize ( wvw, wvh ); - createActions(); createMenus(); createToolBars(); @@ -138,6 +114,31 @@ QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file ) } + +/// @bug diffferent params necessary +void QProjectM_MainWindow::writeConfig() { + +} + +void QProjectM_MainWindow::readConfig(const std::string & configFile ) { + + + ConfigFile config ( configFile ); + + if ( config.read ( "Fullscreen", false ) ) + this->setWindowState ( this->windowState() | Qt::WindowFullScreen ); + else + this->setWindowState ( this->windowState() & ~Qt::WindowFullScreen ); + + int wvw = config.read ( "Window Width", 512 ); + int wvh = config.read ( "Window Height", 512 ); + + // Suggest to the widget the projectM window size configuration settings + m_QProjectMWidget->setBaseSize ( wvw, wvh ); +} + + + QProjectM_MainWindow::~QProjectM_MainWindow() { @@ -551,9 +552,6 @@ void QProjectM_MainWindow::readSettings() m_QPlaylistFileDialog->setDirectory ( settings.value ( "playlistPath", m_QPlaylistFileDialog->directory().absolutePath() ).toString() ); - m_QPresetFileDialog->setDirectory - ( settings.value ( "presetPath", m_QPresetFileDialog->directory().absolutePath() ).toString() ); - resize ( size ); move ( pos ); } @@ -564,7 +562,6 @@ void QProjectM_MainWindow::writeSettings() settings.setValue ( "pos", pos() ); settings.setValue ( "size", size() ); settings.setValue ( "playlistPath", m_QPlaylistFileDialog->directory().absolutePath() ); - settings.setValue ( "presetPath", m_QPresetFileDialog->directory().absolutePath() ); } diff --git a/src/qprojectM/src/QProjectM_MainWindow.hpp b/src/qprojectM/src/QProjectM_MainWindow.hpp index 4c4d84281..6fe1246cc 100644 --- a/src/qprojectM/src/QProjectM_MainWindow.hpp +++ b/src/qprojectM/src/QProjectM_MainWindow.hpp @@ -74,6 +74,10 @@ class QProjectMWidget : public QGLWidget : QGLWidget(parent), config_file(_config_file), m_projectM(0) {} ~QProjectMWidget() { if (m_projectM) delete(m_projectM); } + inline const std::string & configFile() { + return config_file; + } + QProjectM * getQProjectM() { return m_projectM; } public slots: @@ -230,7 +234,8 @@ public: void keyReleaseEvent ( QKeyEvent * e ); QProjectM * getQProjectM(); - + + void refreshPlaylist(); QProjectMWidget * getQProjectMWidget() { return m_QProjectMWidget; } @@ -255,8 +260,10 @@ private slots: void changeRating(const QModelIndex & index); void openSettingsDialog(); void updateFilteredPlaylist(const QString & text); - -private: + + private: + void readConfig(const std::string & configFile); + void writeConfig(); void copyPlaylist(); QHeaderView * hHeader;