Crossfire Server, Trunk  R20513
CRESettingsDialog.cpp
Go to the documentation of this file.
1 #include "CRESettingsDialog.h"
2 #include "CRESettings.h"
3 #include <QtGui>
4 
6 {
7  setWindowTitle(tr("CRE settings"));
8 
9  QGridLayout* layout = new QGridLayout();
10 
11  int line = 0;
12 
13  layout->addWidget(new QLabel(tr("Map cache directory:"), this), line, 0);
14  myMapCache = new QLineEdit(this);
15  myMapCache->setText(settings->mapCacheDirectory());
16  if (myMapCache->text().isEmpty())
17  myMapCache->setText(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
18  layout->addWidget(myMapCache, line, 1);
19 
20  line++;
21 
22  QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel, Qt::Horizontal, this);
23  connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
24  connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
25  layout->addWidget(buttons, line, 0, 1, 2);
26 
27  setLayout(layout);
28 }
29 
31 {
32  return myMapCache->text();
33 }
CRESettingsDialog(CRESettings *settings)
QLineEdit * myMapCache
QString mapCacheDirectory() const
Definition: CRESettings.cpp:43
struct Settings settings
Server settings.
Definition: init.c:40
QString mapCache() const
Definition: main.c:88