From 5e65a6d3294170fd124077e67a4f57bd5ecd7448 Mon Sep 17 00:00:00 2001 From: Thomas Frauendorfer Date: Thu, 24 Jan 2008 23:10:08 +0100 Subject: [PATCH] cleanups in SettingsWindow, and rename to SettingsDialog --- src/BrowseModel.cpp | 3 +- src/TitleBar.cpp | 6 ++-- src/main.cpp | 19 ++++++----- ...{SettingsWindow.cpp => settingsdialog.cpp} | 34 +++++++++++++------ src/{SettingsWindow.h => settingsdialog.h} | 22 ++++++------ src/src.pri | 4 +-- 6 files changed, 53 insertions(+), 35 deletions(-) rename src/{SettingsWindow.cpp => settingsdialog.cpp} (93%) rename src/{SettingsWindow.h => settingsdialog.h} (79%) diff --git a/src/BrowseModel.cpp b/src/BrowseModel.cpp index 1e996ca..428a658 100644 --- a/src/BrowseModel.cpp +++ b/src/BrowseModel.cpp @@ -60,7 +60,8 @@ BrowseModel::list_root () } m_list.append (new BrowseModelItem ("file:///", "Files", true)); - m_list.append (new BrowseModelItem ("daap://", "DAAP", true)); + // FIXME: removed for now, crashes application +// m_list.append (new BrowseModelItem ("daap://", "DAAP", true)); emit dirChanged (""); reset (); diff --git a/src/TitleBar.cpp b/src/TitleBar.cpp index 2d3b3b3..7ed06d2 100644 --- a/src/TitleBar.cpp +++ b/src/TitleBar.cpp @@ -3,7 +3,7 @@ #include "Display.h" #include "SkinChooser.h" // #include "MedialibWindow.h" -#include "SettingsWindow.h" +#include "settingsdialog.h" #include "Button.h" #include "BrowseDialog.h" @@ -45,6 +45,7 @@ TitleBar::showMenu (void) a = new QAction (tr ("Medialib browser"), this); a->setShortcut (tr ("Alt+M")); connect (a, SIGNAL (triggered ()), this, SLOT (showMlib ())); + a->setEnabled(false); // FIXME: disabled for now, as Mlib-browser doesn't work qm.addAction (a); a = new QAction (tr ("Server-side browser"), this); a->setShortcut (tr ("Alt+S")); @@ -61,6 +62,7 @@ TitleBar::showMenu (void) qm.addAction (a); a = new QAction (tr ("Server settings"), this); a->setShortcut (tr ("Alt+S")); + a->setEnabled(false); // FIXME: disabled for now, not yet implemented qm.addAction (a); qm.addSeparator (); a = new QAction (tr ("Quit"), this); @@ -91,7 +93,7 @@ TitleBar::showServerB () void TitleBar::showSettings () { - SettingsWindow *sw = new SettingsWindow (window ()); + SettingsDialog *sw = new SettingsDialog (window ()); sw->show (); } diff --git a/src/main.cpp b/src/main.cpp index 42dd1a9..5d6e165 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,16 @@ /** - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * This file is a part of Prome, an XMMS2 Client. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Copyright (C) 2005-2007 XMMS2 Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ #include "MainWindow.h" diff --git a/src/SettingsWindow.cpp b/src/settingsdialog.cpp similarity index 93% rename from src/SettingsWindow.cpp rename to src/settingsdialog.cpp index a9e5c2d..ae6a041 100644 --- a/src/SettingsWindow.cpp +++ b/src/settingsdialog.cpp @@ -1,29 +1,36 @@ #include "MainWindow.h" -#include "SettingsWindow.h" +#include "settingsdialog.h" -#include #include -SettingsWindow::SettingsWindow (QWidget *parent) : QMainWindow (parent) +#include +#include +#include +#include +#include +#include +#include +#include + +SettingsDialog::SettingsDialog (QWidget *parent) : QDialog (parent) { #ifndef _WIN32 setWindowIcon (QIcon (":icon.png")); #endif setWindowTitle ("Promoe - Settings window"); - setWindowFlags (Qt::Dialog); +// setWindowFlags (Qt::Dialog); setWindowModality (Qt::ApplicationModal); setAttribute (Qt::WA_DeleteOnClose); resize (400, 500); - QWidget *dummy = new QWidget (this); - setCentralWidget (dummy); + QVBoxLayout *vbox = new QVBoxLayout (this);//dummy); + setLayout(vbox); - QVBoxLayout *vbox = new QVBoxLayout (dummy); - - QTabWidget *tab = new QTabWidget (dummy); + QTabWidget *tab = new QTabWidget (this);//dummy); vbox->addWidget (tab); +/* Use a QDialogButtonBox for this QWidget *dummy2 = new QWidget (dummy); QHBoxLayout *hbox = new QHBoxLayout (dummy2); vbox->addWidget (dummy2); @@ -38,6 +45,12 @@ SettingsWindow::SettingsWindow (QWidget *parent) : QMainWindow (parent) hbox->addWidget (new QWidget (dummy2), 1); hbox->addWidget (cancel); hbox->addWidget (ok); + */ + QDialogButtonBox *buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel); + connect (buttonbox, SIGNAL (accepted()), this, SLOT (okButton ())); + connect (buttonbox, SIGNAL (rejected()), this, SLOT (close ())); + vbox->addWidget (buttonbox); m_mainwindow = new SettingsTabMain (NULL); m_playlistwin = new SettingsTabPlaylist (NULL); @@ -53,7 +66,7 @@ SettingsWindow::SettingsWindow (QWidget *parent) : QMainWindow (parent) } void -SettingsWindow::okButton (void) +SettingsDialog::okButton (void) { m_mainwindow->saveSettings (); m_playlistwin->saveSettings (); @@ -320,6 +333,7 @@ SettingsTabMain::SettingsTabMain (QWidget *parent) : QWidget (parent) if (s.contains ("promoe/quitonclose")) s.setValue ("promoe/quitonclose", false); m_quitonclose->setCheckState (s.value ("promoe/quitonclose").toBool () ? Qt::Checked : Qt::Unchecked); + m_quitonclose->setEnabled (false); // FIXME: disabled for now, not working h->addWidget (m_quitonclose); c = new QWidget (dummy); diff --git a/src/SettingsWindow.h b/src/settingsdialog.h similarity index 79% rename from src/SettingsWindow.h rename to src/settingsdialog.h index 8a81d3b..864e8dd 100644 --- a/src/SettingsWindow.h +++ b/src/settingsdialog.h @@ -1,15 +1,13 @@ #ifndef __SETTINGSWINDOW_H__ #define __SETTINGSWINDOW_H__ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include + +class QCheckBox; +class QSpinBox; +class QComboBox; + class SettingsTabMedialib : public QWidget { Q_OBJECT @@ -57,11 +55,11 @@ class SettingsTabMain : public QWidget { QCheckBox *m_shadescroll; }; -class SettingsWindow : public QMainWindow { +class SettingsDialog : public QDialog { Q_OBJECT public: - SettingsWindow (QWidget *parent); - ~SettingsWindow () {} + SettingsDialog (QWidget *parent); + ~SettingsDialog () {} public slots: void okButton (void); diff --git a/src/src.pri b/src/src.pri index 9f80586..6215614 100644 --- a/src/src.pri +++ b/src/src.pri @@ -18,7 +18,7 @@ HEADERS += PixWidget.h \ PlayStatus.h \ ShadedDisplay.h \ SkinChooser.h \ - SettingsWindow.h \ + settingsdialog.h \ VolumeSlider.h \ ClutterBar.h \ FileDialog.h \ @@ -43,7 +43,7 @@ SOURCES += main.cpp \ PlayStatus.cpp \ ShadedDisplay.cpp \ SkinChooser.cpp \ - SettingsWindow.cpp \ + settingsdialog.cpp \ VolumeSlider.cpp \ ClutterBar.cpp \ FileDialog.cpp \