Crossfire Server, Trunk
CRESettingsDialog.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "CRESettingsDialog.h"
14 #include "CRESettings.h"
15 #include <QtWidgets>
16 
18 {
19  setWindowTitle(tr("CRE settings"));
20 
21  QGridLayout* layout = new QGridLayout();
22 
23  int line = 0;
24 
25  layout->addWidget(new QLabel(tr("Cache directory:"), this), line, 0);
26  myMapCache = new QLineEdit(this);
27  myMapCache->setText(settings->mapCacheDirectory());
28  if (myMapCache->text().isEmpty())
29  myMapCache->setText(QStandardPaths::standardLocations(QStandardPaths::DataLocation)[0]);
30  layout->addWidget(myMapCache, line, 1);
31 
32  line++;
33 
34  layout->addWidget(new QLabel(tr("This directory is used to store information between program runs.\nIt should be persistent (don't put in a temporary directory cleaned now and then),\nbut data can be recreated if needed."), this), line, 0, 1, 2);
35  line++;
36 
37  QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel, Qt::Horizontal, this);
38  connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
39  connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
40  layout->addWidget(buttons, line, 0, 1, 2);
41 
42  setLayout(layout);
43 }
44 
46 {
47  return myMapCache->text();
48 }
settings
struct Settings settings
Definition: init.cpp:139
layout
Definition: main.cpp:84
CRESettingsDialog::mapCache
QString mapCache() const
Definition: CRESettingsDialog.cpp:45
CRESettingsDialog::CRESettingsDialog
CRESettingsDialog(CRESettings *settings)
Definition: CRESettingsDialog.cpp:17
CRESettingsDialog::myMapCache
QLineEdit * myMapCache
Definition: CRESettingsDialog.h:30
is_valid_types_gen.line
line
Definition: is_valid_types_gen.py:34
CRESettings.h
CRESettings
Definition: CRESettings.h:21
CRESettingsDialog.h
connect
Definition: connect.py:1
altar_valkyrie.accept
def accept(description)
Definition: altar_valkyrie.py:22