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 list<View*> View::s_views;
28 QSettings* View::s_settings = NULL;
32 assert(s_settings!=NULL);
34 for(list<View*>::iterator it=s_views.begin(); it!=s_views.end(); ++it)
36 s_settings->beginGroup((*it)->getName());
37 s_settings->writeEntry("show", (*it)->setting_show->isOn());
39 s_settings->endGroup();
44 assert(s_settings!=NULL);
46 for(list<View*>::iterator it=s_views.begin(); it!=s_views.end(); ++it)
48 s_settings->beginGroup((*it)->getName());
49 (*it)->setting_show->setOn(s_settings->readBoolEntry("show", (*it)->setting_show->isOn()));
51 s_settings->endGroup();
54 void View::clearAllSettings()
56 assert(s_settings!=NULL);
58 for(list<View*>::iterator it=s_views.begin(); it!=s_views.end(); ++it)
60 s_settings->beginGroup((*it)->getName());
61 s_settings->removeEntry("show");
62 (*it)->clearSettings();
63 s_settings->endGroup();
67 // ------------------------- instances ---------------------------
69 View::View(const QString& name, QWidget* parent)
72 , m_popup_menu(parent)
75 m_popup_menu.insertItem(new Title("<b>"+QWidget::tr(m_name)+"</b>", &m_popup_menu));
76 m_popup_menu.insertSeparator();
78 setting_show = new QAction(parent);
79 setting_show->setMenuText(QWidget::tr("Show ")+getName()+QWidget::tr(" view"));
80 setting_show->setToggleAction(true);
81 parent->connect(setting_show, SIGNAL(toggled(bool)), parent, SLOT(setShown(bool)));
82 setting_show->setToolTip(QWidget::tr(m_name));
84 parent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
86 s_views.push_back(this);
89 void View::mouseReleaseEvent(QMouseEvent* e)
91 if(e->button()==Qt::RightButton)
92 m_popup_menu.exec(e->globalPos());
95 // ----------------------- LabeledSpinBox ------------------------
97 //LabeledSpinBox::LabeledSpinBox(int min, int max, int step, QWidget* parent)