Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
src
vidalia
VidaliaTab.cpp
Go to the documentation of this file.
1
#include "
VidaliaTab.h
"
2
#include "
Vidalia.h
"
3
4
VidaliaTab::VidaliaTab
(
const
QString &title,
const
QString &name, QWidget *parent)
5
: QWidget(parent), _title(title)
6
{
7
_settings
= NULL;
8
if
(!name.isEmpty())
9
_settings
=
new
VSettings
(name);
10
}
11
12
VidaliaTab::~VidaliaTab
()
13
{
14
if
(
_settings
)
15
delete
_settings
;
16
}
17
18
/** Gets the saved value of a property associated with this window object.
19
* If no value was saved, the default value is returned. */
20
QVariant
21
VidaliaTab::getSetting
(QString setting,
QVariant
defaultValue)
22
{
23
return
_settings
->
value
(setting, defaultValue);
24
}
25
26
/** Saves a value associated with a property name for this window object. */
27
void
28
VidaliaTab::saveSetting
(QString prop,
QVariant
value)
29
{
30
_settings
->
setValue
(prop, value);
31
}
32
33
/** Associates a shortcut key sequence with a slot. */
34
void
35
VidaliaTab::setShortcut
(
const
QString &shortcut,
const
char
*slot)
36
{
37
vApp
->createShortcut(QKeySequence(shortcut),
this
,
this
, slot);
38
}
39
40
/** Reimplement the windows' changeEvent() method to check if the event
41
* is a QEvent::LanguageChange event. If so, call retranslateUi(), which
42
* subclasses of VidaliaWindow can reimplement to update their UI. */
43
void
44
VidaliaTab::changeEvent
(QEvent *e)
45
{
46
if
(e->type() == QEvent::LanguageChange) {
47
retranslateUi
();
48
e->accept();
49
return
;
50
}
51
QWidget::changeEvent(e);
52
}
53
54
/** Called when the user wants to change the currently visible language.
55
* Subclasses can reimplement this to update their UI. */
56
void
57
VidaliaTab::retranslateUi
()
58
{
59
/* The default retranslateUi() implementation does nothing */
60
}
61
62
void
63
VidaliaTab::setOnTop
(
bool
top)
64
{
65
_onTop
= top;
66
}
67
68
void
69
VidaliaTab::closeEvent
(QCloseEvent *event)
70
{
71
event
->ignore();
72
emit
closeTab
();
73
}
74
Generated on Mon Jan 14 2013 08:44:27 for Vidalia by
1.8.3