diff --git a/src/Skin.cpp b/src/Skin.cpp index db2ff05..bf68dd2 100644 --- a/src/Skin.cpp +++ b/src/Skin.cpp @@ -17,6 +17,7 @@ #include #include +#include Skin *Skin::singleton = NULL; @@ -33,6 +34,9 @@ Skin::Skin () { setSizes (); setPositions (); + + QSettings settings; + setSkin (settings.value("skin/path", ":CleanAMP/").toString ()); } diff --git a/src/application.cpp b/src/application.cpp index ba89c73..fc7a3a8 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -18,6 +18,8 @@ #include "application.h" #include "mainwindow.h" +#include "equalizerwindow.h" +#include "playlistwindow.h" #include "Skin.h" #ifdef HAVE_SERVERBROWSER @@ -29,6 +31,10 @@ Application::Application (int &argc, char **argv) : QApplication (argc, argv) { + setOrganizationName("xmms2"); + setOrganizationDomain("xmms.org"); + setApplicationName("Promoe"); + //TODO: Change to XClient sometime later XMMSHandler &client = XMMSHandler::getInstance (); @@ -37,6 +43,27 @@ Application::Application (int &argc, char **argv) : QApplication (argc, argv) connect (&client, SIGNAL(disconnected(XClient *)), this, SLOT(handleDisconnected ())); + QSettings settings; + + MainWindow *mw = new MainWindow (NULL); + + /* + * Now that everything is initialized + * open the skin and send the + * SkinChanged signal that will cause + * all widgets to get their pixmaps + * TODO: Now the Skin class loads the skin itself. This call is necessarry until + * all widgets that receive the skinChanged signal fetch their pixmaps themself + * on startup + */ + Skin::getInstance()->setSkin (settings.value("skin/path").toString ()); + + mw->show (); + // The Playlist- and EqualizerWindow has to become visible after the mainwindow + // because metacity (gnome-windowmanager) can't handle them correctly otherwise + mw->getEQ ()->setVisible (settings.value ("equalizer/visible", false).toBool ()); + mw->getPL ()->setVisible (settings.value ("playlist/visible", false).toBool ()); + } void @@ -69,9 +96,6 @@ main (int argc, char **argv) { Application app(argc, argv); - QCoreApplication::setOrganizationName("xmms2"); - QCoreApplication::setOrganizationDomain("xmms.org"); - QCoreApplication::setApplicationName("Promoe"); QSettings settings; @@ -82,21 +106,6 @@ main (int argc, char **argv) */ #endif - MainWindow *mw = new MainWindow (NULL); - - /* - * Now that everything is initialized - * open the skin and send the - * SkinChanged signal that will cause - * all widgets to get their pixmaps - */ - if (!settings.contains ("skin/path")) { - settings.setValue ("skin/path", ":CleanAMP/"); - } - - Skin::getInstance()->setSkin (settings.value("skin/path").toString ()); - - mw->show (); #ifdef HAVE_SERVERBROWSER ServerBrowserWindow *browser = new ServerBrowserWindow (mw); diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 04eea0a..a86376e 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -38,7 +38,7 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent) QSettings s; setWindowFlags(Qt::FramelessWindowHint); - setGeometry(100, 100, 275, 116); + setMaximumSize (275, 116); #ifndef _WIN32 setWindowIcon (QIcon (":icon.png")); #endif @@ -48,6 +48,10 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent) else setShaded (!isShaded ()); + if (!s.contains ("mainwindow/pos")) + s.setValue ("mainwindow/pos", QPoint (100, 100)); + move (s.value("mainwindow/pos").toPoint ()); + /* * initialize EqualizerWindow */ @@ -57,7 +61,6 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent) pos ().y ()+size ().height ())); } m_equalizer->move (s.value ("equalizer/pos").toPoint ()); - m_equalizer->setVisible (s.value ("equalizer/visible", false).toBool ()); /* * initialtize PlaylistWindow @@ -70,7 +73,6 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent) m_playlistwin->move (s.value ("playlist/pos").toPoint ()); // FIXME: this should be done in PlaylistWindow. // But promoe segfaults if done so - m_playlistwin->setVisible (s.value("playlist/visible", false).toBool ()); /* * The MainDisplay is the mainwindow non-shaded mode @@ -93,10 +95,6 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent) switchDisplay (); - if (!s.contains ("mainwindow/pos")) - s.setValue ("mainwindow/pos", QPoint (100, 100)); - - move (s.value("mainwindow/pos").toPoint ()); attachWidgets (); } diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h index e3f3a42..5045d3f 100644 --- a/src/mainwindow/mainwindow.h +++ b/src/mainwindow/mainwindow.h @@ -44,7 +44,7 @@ class MainWindow : public BaseWindow void moveEvent (QMoveEvent *event); bool isTimemodeReverse(void) { QSettings s; return s.value("MainWindow/timemodereverse").toBool(); } - void setTimemodeReverse(bool b) { QSettings s; return s.setValue("MainWindow/timemodereverse",b); } + void setTimemodeReverse(bool b) { QSettings s; s.setValue("MainWindow/timemodereverse",b); } void attachWidgets ();