cleanups in SettingsWindow, and rename to SettingsDialog

This commit is contained in:
Thomas Frauendorfer 2008-01-24 23:10:08 +01:00
parent ad7cf39499
commit 5e65a6d329
6 changed files with 53 additions and 35 deletions

View file

@ -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 ();

View file

@ -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 ();
}

View file

@ -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"

View file

@ -1,29 +1,36 @@
#include "MainWindow.h"
#include "SettingsWindow.h"
#include "settingsdialog.h"
#include <QCheckBox>
#include <QSettings>
SettingsWindow::SettingsWindow (QWidget *parent) : QMainWindow (parent)
#include <QLabel>
#include <QCheckBox>
#include <QSpinBox>
#include <QComboBox>
#include <QDialogButtonBox>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
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);

View file

@ -1,15 +1,13 @@
#ifndef __SETTINGSWINDOW_H__
#define __SETTINGSWINDOW_H__
#include <QMainWindow>
#include <QTabWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QSpinBox>
#include <QLabel>
#include <QComboBox>
#include <QWidget>
#include <QDialog>
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);

View file

@ -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 \