X-Git-Url: http://git.johnwright.org/?p=fmit.git;a=blobdiff_plain;f=src%2Fmodules%2FView.cpp;fp=src%2Fmodules%2FView.cpp;h=6c1252eb9955077bef88612ad5b8fcefc6fb0ac3;hp=9d944e939d1f789bb5c697d027a62eff0ede62a4;hb=a8fb82288feb6b258f2c04312f0c36ba8d79b494;hpb=adfba0402927438a1869f1e716bcf0e25574ce1e diff --git a/src/modules/View.cpp b/src/modules/View.cpp index 9d944e9..6c1252e 100644 --- a/src/modules/View.cpp +++ b/src/modules/View.cpp @@ -23,9 +23,11 @@ #include using namespace std; #include +#include +#include list View::s_views; -QSettings* View::s_settings = NULL; +AutoQSettings* View::s_settings = NULL; void View::saveAll() { @@ -34,7 +36,7 @@ void View::saveAll() for(list::iterator it=s_views.begin(); it!=s_views.end(); ++it) { s_settings->beginGroup((*it)->getName()); - s_settings->writeEntry("show", (*it)->setting_show->isOn()); + s_settings->setValue("show", (*it)->setting_show->isChecked()); (*it)->save(); s_settings->endGroup(); } @@ -46,7 +48,7 @@ void View::loadAll() for(list::iterator it=s_views.begin(); it!=s_views.end(); ++it) { s_settings->beginGroup((*it)->getName()); - (*it)->setting_show->setOn(s_settings->readBoolEntry("show", (*it)->setting_show->isOn())); + (*it)->setting_show->setChecked(s_settings->value("show", (*it)->setting_show->isChecked()).toBool()); (*it)->load(); s_settings->endGroup(); } @@ -58,7 +60,7 @@ void View::clearAllSettings() for(list::iterator it=s_views.begin(); it!=s_views.end(); ++it) { s_settings->beginGroup((*it)->getName()); - s_settings->removeEntry("show"); + s_settings->remove("show"); (*it)->clearSettings(); s_settings->endGroup(); } @@ -72,14 +74,16 @@ View::View(const QString& name, QWidget* parent) , m_popup_menu(parent) { // settings - m_popup_menu.insertItem(new Title(""+QWidget::tr(m_name)+"", &m_popup_menu)); - m_popup_menu.insertSeparator(); + QWidgetAction* caption = new QWidgetAction(&m_popup_menu); + caption->setDefaultWidget(new Title(QString("%1").arg(QObject::tr(m_name.toAscii().constData())), &m_popup_menu)); + m_popup_menu.addAction(caption); - setting_show = new QAction(parent); - setting_show->setMenuText(QWidget::tr("Show ")+getName()+QWidget::tr(" view")); - setting_show->setToggleAction(true); + m_popup_menu.addSeparator(); + + setting_show = new QAction(m_name, parent); + setting_show->setCheckable(true); parent->connect(setting_show, SIGNAL(toggled(bool)), parent, SLOT(setShown(bool))); - setting_show->setToolTip(QWidget::tr(m_name)); + setting_show->setToolTip(QObject::tr("Show \"%1\" view").arg(m_name)); parent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));