Skip to content
This repository has been archived by the owner on Mar 19, 2020. It is now read-only.

Commit

Permalink
Store/load starview settings
Browse files Browse the repository at this point in the history
Signed-off-by: Anselmo L. S. Melo <anselmolsm@gmail.com>
  • Loading branch information
anselmolsm committed Jan 10, 2012
1 parent 3db625f commit 0881568
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/starview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Copyright (c) 2003 Frerich Raabe <raabe@kde.org>
Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2011 Hugo Parente Lima <hugo.pl@gmail.com>
Copyright (c) 2012 Anselmo L. S. Melo <anselmolsm@gmail.com>
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
Expand Down Expand Up @@ -37,6 +38,7 @@
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QDialogButtonBox>
#include <QSettings>
#include <QDebug>
#include <cmath>

Expand All @@ -55,7 +57,10 @@ StarViewConfigDialog::StarViewConfigDialog(QWidget *parent)
QBoxLayout *nodesLayout = new QHBoxLayout();
topLayout->addLayout(nodesLayout);

int nodesPerRing = 25;
QSettings settings;
const int nodesPerRing = settings.value("StarView/NodesPerRing", 25).toInt();
const QString archFilter = settings.value("StarView/ArchFilter", "").toString();
const bool supressDomainName = settings.value("StarView/SupressDomainName", false).toBool();

m_nodesPerRingSlider = new QSlider(Qt::Horizontal, this);
m_nodesPerRingSlider->setMinimum(1);
Expand All @@ -72,10 +77,12 @@ StarViewConfigDialog::StarViewConfigDialog(QWidget *parent)
label = new QLabel(tr("Architecture filter:"), this);
topLayout->addWidget(label);
m_archFilterEdit = new QLineEdit(this);
m_archFilterEdit->setText(archFilter);
topLayout->addWidget(m_archFilterEdit);
connect(m_archFilterEdit, SIGNAL(textChanged(const QString &)), SIGNAL(configChanged()));

m_suppressDomainName = new QCheckBox(tr("Suppress domain name"), this);
m_suppressDomainName->setChecked(supressDomainName);
topLayout->addWidget(m_suppressDomainName);
connect(m_suppressDomainName, SIGNAL(toggled(bool)), SLOT(slotSuppressDomainName(bool)));

Expand Down Expand Up @@ -104,6 +111,11 @@ QString StarViewConfigDialog::archFilter()
return m_archFilterEdit->text();
}

bool StarViewConfigDialog::suppressDomainName() const
{
return m_suppressDomainName;
}

void StarViewConfigDialog::slotSuppressDomainName(bool b)
{
suppressDomain = b;
Expand Down Expand Up @@ -499,6 +511,12 @@ void StarView::slotConfigChanged()
}

arrangeHostItems();

//write settings
QSettings settings;
settings.setValue("StarView/NodesPerRing", m_configDialog->nodesPerRing());
settings.setValue("StarView/ArchFilter", m_configDialog->archFilter());
settings.setValue("StarView/SupressDomainName", m_configDialog->suppressDomainName());
}

void StarView::arrangeHostItems()
Expand Down

0 comments on commit 0881568

Please sign in to comment.