2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
11 #include <QApplication>
12 #include <QHBoxLayout>
14 #include "mastersettings.h"
15 #include "pref_board.h"
16 #include "pref_movelist.h"
17 #include "pref_theme.h"
18 #include "pref_engines.h"
19 #include "pref_preferences.h"
22 class PrefWrapper
: public PrefBase
{
27 PrefWrapper(const QString currentVariant
, QWidget
*parent
= 0)
30 , m_variant(currentVariant
) { }
32 virtual void apply() {
37 virtual void showEvent(QShowEvent
*) {
41 m_inner
= new T(m_variant
, this);
42 QHBoxLayout
*l
= new QHBoxLayout(this);
43 l
->addWidget(m_inner
);
49 Preferences::Preferences(const QString
& currentVariant
, QWidget
*parent
)
53 setWindowIcon(KIcon("tagua"));
54 connect(buttonBox
->button(QDialogButtonBox::Apply
), SIGNAL(clicked()), this, SLOT(apply()));
60 b
= new PrefWrapper
<PrefBoard
>(currentVariant
, this);
61 connect(this, SIGNAL(applied()), b
, SLOT(apply()));
62 i
= pagePref
->addPage(b
, "Board");
63 i
->setHeader("Board preferences:");
64 i
->setIcon(KIcon("prefBoard"));
66 b
= new PrefWrapper
<PrefMoveList
>(currentVariant
, this);
67 connect(this, SIGNAL(applied()), b
, SLOT(apply()));
68 i
= pagePref
->addPage(b
, "Move list");
69 i
->setHeader("Move list preferences:");
70 i
->setIcon(KIcon("prefMoveList"));
72 b
= new PrefWrapper
<PrefTheme
>(currentVariant
, this);
73 connect(this, SIGNAL(applied()), b
, SLOT(apply()));
74 i
= pagePref
->addPage(b
, "Theme");
75 i
->setHeader("Pieces & squares theme:");
76 i
->setIcon(KIcon("prefTheme"));
79 b
= new PrefWrapper
<PrefEngines
>(currentVariant
, this);
80 connect(this, SIGNAL(applied()), b
, SLOT(apply()));
81 i
= pagePref
->addPage(b
, "Engines");
82 i
->setHeader("Engines:");
83 i
->setIcon(KIcon("brain"));
87 Preferences::~Preferences() {
90 void Preferences::apply() {