summaryrefslogtreecommitdiffstats
path: root/quanta/dialogs/settings/previewoptions.cpp
blob: c445c52d1807af0df49b42f327addbb06e8dea2f (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
                          previewoptions.cpp  -  description
                             -------------------
    begin                : Fri Aug 4 2000
    copyright            : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com>
                           (C) 2002, 2004 Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
#include "previewoptions.h"
#include "previewoptions.moc"
// qt includes
#include <qradiobutton.h>
#include <qcheckbox.h>
// kde includes
#include <klocale.h>
#include <kmessagebox.h>

PreviewOptions::PreviewOptions(QWidget *parent, const char *name)
  : PreviewOptionsS(parent,name)
{
}

PreviewOptions::~PreviewOptions(){
}

void PreviewOptions::setWindowLayout(const QString& layout )
{
  if ( layout == "Default") resetLayout->setChecked(true);
  else resetLayout->setChecked(false);
}

void PreviewOptions::setPosition(const QString& position )
{
  radioEditor->setChecked(true);
  if ( position == "Toolview"  ) radioToolview->setChecked(true);
}

QString PreviewOptions::position()
{
  QString position = "Editor";
  if ( radioToolview->isChecked() )
      position = "Toolview";
  return position;
}

void PreviewOptions::setDocPosition(const QString &position)
{
    radioNewDocTab->setChecked(true);
    if (position == "Toolview") radioSeparateDocView->setChecked(true);
}

QString PreviewOptions::docPosition()
{
   QString position = "Tab";
   if (radioSeparateDocView->isChecked()) position = "Toolview";
   return position;
}

QString PreviewOptions::layout()
{
  QString layout = "Custom";
  if ( resetLayout->isChecked() )
      layout = "Default";
  return layout;
}

QString PreviewOptions::closeButtons()
{
   QString closeButtonState = "ShowAlways";
   if (radioDelayedCloseButtons->isChecked())
       closeButtonState = "ShowDelayed";
   if (radioNoCloseButtons->isChecked())
       closeButtonState = "Disabled";
   return closeButtonState;
}

void PreviewOptions::setCloseButtons(const QString &state)
{
   if (state == "ShowAlways")  radioShowCloseButtons->setChecked(true);
   if (state == "ShowDelayed")  radioDelayedCloseButtons->setChecked(true);
   if (state == "Disabled")  radioNoCloseButtons->setChecked(true);
}

void PreviewOptions::setToolviewTabs(uint state)
{
   radioIcon->setChecked(true);
   if (state == 3) radioIconText->setChecked(true);
   if (state == 1) radioText->setChecked(true);
   m_toolviewTabs = state;
}

uint PreviewOptions::toolviewTabs()
{
  uint state = 0;
  if (radioIconText->isChecked()) state = 3;
  if (radioText->isChecked()) state = 1;
  return state;
}

void PreviewOptions::setHiddenFiles(bool show)
{
  showHidden->setChecked(show);
}

bool PreviewOptions::hiddenFiles()
{
  return showHidden->isChecked();
}


void PreviewOptions::setSaveTrees(bool show)
{
  saveLocalTrees->setChecked(show);
}

bool PreviewOptions::saveTrees()
{
  return saveLocalTrees->isChecked();
}