32 #define IMAGE_GENERAL ":/images/32x32/preferences-system.png"
33 #define IMAGE_NETWORK ":/images/32x32/preferences-system-network.png"
34 #define IMAGE_SERVER ":/images/32x32/preferences-system-network-sharing.png"
35 #define IMAGE_APPEARANCE ":/images/32x32/preferences-desktop-locale.png"
36 #define IMAGE_ADVANCED ":/images/32x32/applications-system.png"
37 #define IMAGE_HELP ":/images/32x32/system-help.png"
38 #define IMAGE_SERVICE ":/images/32x32/services.png"
50 QPushButton *button =
ui.buttonBox->button(QDialogButtonBox::Ok);
53 this, button, SLOT(click()));
55 button =
ui.buttonBox->button(QDialogButtonBox::Cancel);
62 connect(
ui.buttonBox, SIGNAL(accepted()),
this, SLOT(
saveChanges()));
63 connect(
ui.buttonBox, SIGNAL(rejected()),
this, SLOT(close()));
71 QActionGroup *grp =
new QActionGroup(
this);
73 ui.stackPages->add(generalPage,
75 tr(
"General"),
"General", grp));
81 tr(
"Network"),
"Network", grp));
85 tr(
"Sharing"),
"Sharing", grp));
89 tr(
"Services"),
"Services", grp));
93 tr(
"Appearance"),
"Appearance", grp));
97 tr(
"Advanced"),
"Advanced", grp));
103 this, SLOT(
help(QString)));
107 ui.toolBar->addActions(grp->actions());
108 ui.toolBar->addSeparator();
109 connect(grp, SIGNAL(triggered(QAction *)),
110 ui.stackPages, SLOT(showPage(QAction *)));
113 QAction *helpAct =
new QAction(QIcon(
IMAGE_HELP), tr(
"Help"),
ui.toolBar);
114 helpAct->setData(
"Help");
118 grp->actions()[0]->setChecked(
true);
120 #if defined(Q_WS_WIN)
121 helpAct->setShortcut(QString(
"F1"));
123 helpAct->setShortcut(QString(
"Ctrl+?"));
130 const QString &data, QActionGroup *group)
132 QAction *action =
new QAction(img, text, group);
133 action->setData(data);
134 action->setCheckable(
true);
143 ui.toolBar->addAction(action);
144 connect(action, SIGNAL(triggered()),
this, slot);
156 ui.stackPages->setCurrentIndex((
int)page);
163 ui.retranslateUi(
this);
167 foreach (QAction *action,
ui.toolBar->actions()) {
168 action->setText(tr(qPrintable(action->data().toString()),
"ConfigDialog"));
170 ui.buttonBox->setStandardButtons(
ui.buttonBox->standardButtons());
192 if (!page->
save(errmsg)) {
194 ui.stackPages->setCurrentPage(page);
198 tr(
"Error Saving Settings"),
199 p(tr(
"Vidalia was unable to save your %1 settings.")
200 .arg(tr(qPrintable(page->
title()),
"ConfigDialog"))) +
p(errmsg),
219 bool appliedChanges =
false;
224 if (!page->
apply(errmsg)) {
227 tr(
"Error Applying Settings"),
228 p(tr(
"Vidalia was unable to apply your %1 settings "
229 "to Tor.").arg(page->
title()))
236 ui.stackPages->setCurrentPage(page);
244 appliedChanges =
true;
269 Page currentPage =
static_cast<Page>(
ui.stackPages->currentIndex());
271 switch (currentPage) {
273 help(
"config.network");
break;
275 help(
"server");
break;
277 help(
"config.appearance");
break;
279 help(
"config.advanced");
break;
281 help(
"config.services");
break;
283 help(
"config.general");
break;