aboutsummaryrefslogtreecommitdiffstats
path: root/settingsdialog.cpp
blob: a43590488e2e19a15126e36e14531894b8316a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 *      settingsdialog.cpp
 *
 *      Copyright 2008 gpg4usb-team <gpg4usb@cpunk.de>
 *
 *      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
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

#include <QWidget>

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDebug>
#include <QLabel>
#include <QGridLayout>
#include <QGroupBox>
#include <QDialogButtonBox>
#include <QRadioButton>
#include <QButtonGroup>
#include <QSettings>
#include "settingsdialog.h"

SettingsDialog::SettingsDialog()
{
    setWindowTitle(tr("Settings"));
    resize(500, 200);
    setModal(true);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(applySettings()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    groupBox1 = new QGroupBox(tr("Options"));
    groupBox2 = new QGroupBox("Action");

	QRadioButton *iconTextButton = new QRadioButton(tr("just test"));
	QRadioButton *iconIconsButton =new QRadioButton(tr("just icons"));
	QRadioButton *iconAllButton = new QRadioButton(tr("text and icons"));
	
	QHBoxLayout *iconStyleBox = new QHBoxLayout();
	iconStyleBox->addWidget(iconTextButton);
	iconStyleBox->addWidget(iconIconsButton);
	iconStyleBox->addWidget(iconAllButton);
	group1 = new QButtonGroup();
	
	QRadioButton *iconSizeSmall = new QRadioButton(tr("small"));
	QRadioButton *iconSizeMedium =new QRadioButton(tr("medium"));
	QRadioButton *iconSizeLarge = new QRadioButton(tr("large"));
	group1->addButton(iconSizeSmall,1);
	group1->addButton(iconSizeMedium,2);
	group1->addButton(iconSizeLarge,3);


	QHBoxLayout *iconSizeBox = new QHBoxLayout();
	iconSizeBox->addWidget(iconSizeSmall);
	iconSizeBox->addWidget(iconSizeMedium);
	iconSizeBox->addWidget(iconSizeLarge);

	groupBox1->setLayout(iconStyleBox);
	groupBox2->setLayout(iconSizeBox);
	
	
    QVBoxLayout *vbox2 = new QVBoxLayout();
    vbox2->addWidget(groupBox1);
	vbox2->addWidget(groupBox2);
	vbox2->addWidget(buttonBox);
    setLayout(vbox2);
    exec();
}

void SettingsDialog::applySettings()
{
	     QSettings settings;
     //settings.setValue("geometry", saveGeometry());

	qDebug() << group1->checkedId();
	switch (group1->checkedId()){
	case 1: 
     settings.setValue("toolbar/iconsize", QSize(12, 12));
     break;
     
     case 2:settings.setValue("toolbar/iconsize", QSize(24, 24));
     break;
     case 3:settings.setValue("toolbar/iconsize", QSize(32, 32));
     break;
 }
}