1 // Copyright 2005 "Gilles Degottex"
3 // This file is part of "Music"
5 // "Music" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
10 // "Music" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <qwidgetaction.h>
29 list<View*> View::s_views;
30 AutoQSettings* View::s_settings = NULL;
34 assert(s_settings!=NULL);
36 for(list<View*>::iterator it=s_views.begin(); it!=s_views.end(); ++it)
38 s_settings->beginGroup((*it)->getName());
39 s_settings->setValue("show", (*it)->setting_show->isChecked());
41 s_settings->endGroup();
46 assert(s_settings!=NULL);
48 for(list<View*>::iterator it=s_views.begin(); it!=s_views.end(); ++it)
50 s_settings->beginGroup((*it)->getName());
51 (*it)->setting_show->setChecked(s_settings->value("show", (*it)->setting_show->isChecked()).toBool());
53 s_settings->endGroup();
56 void View::clearAllSettings()
58 assert(s_settings!=NULL);
60 for(list<View*>::iterator it=s_views.begin(); it!=s_views.end(); ++it)
62 s_settings->beginGroup((*it)->getName());
63 s_settings->remove("show");
64 (*it)->clearSettings();
65 s_settings->endGroup();
69 // ------------------------- instances ---------------------------
71 View::View(const QString& name, QWidget* parent)
74 , m_popup_menu(parent)
77 QWidgetAction* caption = new QWidgetAction(&m_popup_menu);
78 caption->setDefaultWidget(new Title(QString("<b>%1</b>").arg(QObject::tr(m_name.toAscii().constData())), &m_popup_menu));
79 m_popup_menu.addAction(caption);
81 m_popup_menu.addSeparator();
83 setting_show = new QAction(m_name, parent);
84 setting_show->setCheckable(true);
85 parent->connect(setting_show, SIGNAL(toggled(bool)), parent, SLOT(setShown(bool)));
86 setting_show->setToolTip(QObject::tr("Show \"%1\" view").arg(m_name));
88 parent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
90 s_views.push_back(this);
93 void View::mouseReleaseEvent(QMouseEvent* e)
95 if(e->button()==Qt::RightButton)
96 m_popup_menu.exec(e->globalPos());
99 // ----------------------- LabeledSpinBox ------------------------
101 //LabeledSpinBox::LabeledSpinBox(int min, int max, int step, QWidget* parent)