Skip to content

Commit f2946c2

Browse files
committed
Tweaks on widget sizes and UI
* changed layout of preferences * removed geometry attributes from ui
1 parent 436c141 commit f2946c2

24 files changed

Lines changed: 1817 additions & 1761 deletions

rc/lang/de_DE.qm

811 Bytes
Binary file not shown.

rc/lang/de_DE.ts

Lines changed: 889 additions & 828 deletions
Large diffs are not rendered by default.

src/aboutdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define VERS_MAJOR 3
88
#define VERS_MINOR 4
9-
#define VERS_PATCH -1 // negative patch number designates a development version
9+
#define VERS_PATCH 0 // negative patch number designates a development version
1010

1111
// returns +1 if newer, -1 if older and 0 if equal
1212
inline int cmpVers(int major, int minor, int patch)

src/biomecolordialog.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ BiomeColorDialog::BiomeColorDialog(QWidget *parent, QString initrc, int mc, int
3232

3333
QPushButton *button;
3434
ui->gridLayout->setSpacing(2);
35-
QIcon alignicon = getColorIcon(QColor(0,0,0,0));
3635

3736
separator = new QLabel(tr("Currently inactive biomes:"), this);
3837
separator->setVisible(false);
3938

40-
button = new QPushButton(QIcon(alignicon), tr("All to default"), this);
39+
button = new QPushButton(getColorIcon(QColor(255,255,255,128)), tr("All to default"), this);
4140
connect(button, &QPushButton::clicked, this, &BiomeColorDialog::onAllToDefault);
4241
ui->gridLayout->addWidget(button, 0, 1);
4342

44-
button = new QPushButton(QIcon(alignicon), tr("All to dimmed"), this);
43+
button = new QPushButton(getColorIcon(QColor(0,0,0,128)), tr("All to dimmed"), this);
4544
connect(button, &QPushButton::clicked, this, &BiomeColorDialog::onAllToDimmed);
4645
ui->gridLayout->addWidget(button, 0, 2);
4746

src/biomecolordialog.ui

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
<ui version="4.0">
33
<class>BiomeColorDialog</class>
44
<widget class="QDialog" name="BiomeColorDialog">
5-
<property name="geometry">
6-
<rect>
7-
<x>0</x>
8-
<y>0</y>
9-
<width>580</width>
10-
<height>600</height>
11-
</rect>
12-
</property>
135
<property name="windowTitle">
146
<string>Biome Color Editor</string>
157
</property>
@@ -55,18 +47,13 @@
5547
</item>
5648
<item row="1" column="0" colspan="3">
5749
<widget class="QScrollArea" name="scrollArea">
50+
<property name="verticalScrollBarPolicy">
51+
<enum>Qt::ScrollBarAlwaysOn</enum>
52+
</property>
5853
<property name="widgetResizable">
5954
<bool>true</bool>
6055
</property>
6156
<widget class="QWidget" name="scrollAreaWidgetContents">
62-
<property name="geometry">
63-
<rect>
64-
<x>0</x>
65-
<y>0</y>
66-
<width>562</width>
67-
<height>521</height>
68-
</rect>
69-
</property>
7057
<property name="styleSheet">
7158
<string notr="true">text-align: left; padding: 2px;</string>
7259
</property>

src/conditiondialog.cpp

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@
2020
#include <QInputDialog>
2121
#include <QFontMetricsF>
2222

23-
#define SETUP_TEMPCAT_SPINBOX(B) do {\
24-
tempsboxes[B] = new SpinExclude();\
25-
QLabel *l = new QLabel(#B);\
26-
ui->gridLayoutTemps->addWidget(tempsboxes[B], (B) % Special, (B) / Special * 2 + 0);\
27-
ui->gridLayoutTemps->addWidget(l, (B) % Special, (B) / Special * 2 + 1);\
28-
if (mc > MC_1_6 && mc <= MC_1_17) \
29-
l->setToolTip(getTip(mc, L_SPECIAL_1024, 0, (B) % Special + ((B)>=Special?256:0) ));\
30-
} while (0)
3123

3224
static QString getTip(int mc, int layer, uint32_t flags, int id)
3325
{
@@ -70,12 +62,17 @@ ConditionDialog::ConditionDialog(FormConditions *parent, Config *config, int mcv
7062
ui->textEditLua->setTabStopDistance(QFontMetricsF(ui->textEditLua->font()).horizontalAdvance(" ") * 4);
7163
#endif
7264

65+
ui->lineSummary->setMinimumWidth(
66+
ui->lineSummary->minimumSizeHint().width() +
67+
QFontMetrics(ui->lineSummary->font()).horizontalAdvance('#') * 26
68+
);
69+
7370
// prevent bold font of group box title getting inherited
74-
QFont dfont = font();
75-
dfont.setBold(false);
76-
const QList<QWidget*> children = ui->groupBoxPosition->findChildren<QWidget*>(QString(), Qt::FindDirectChildrenOnly);
77-
for (QWidget *w : children)
78-
w->setFont(dfont);
71+
//QFont dfont = font();
72+
//dfont.setBold(false);
73+
//const QList<QWidget*> children = ui->groupBoxPosition->findChildren<QWidget*>(QString(), Qt::FindDirectChildrenOnly);
74+
//for (QWidget *w : children)
75+
// w->setFont(dfont);
7976

8077
int initindex = -1;
8178
const QVector<Condition> existing = parent->getConditions();
@@ -159,14 +156,14 @@ ConditionDialog::ConditionDialog(FormConditions *parent, Config *config, int mcv
159156

160157
memset(tempsboxes, 0, sizeof(tempsboxes));
161158

162-
SETUP_TEMPCAT_SPINBOX(Oceanic);
163-
SETUP_TEMPCAT_SPINBOX(Warm);
164-
SETUP_TEMPCAT_SPINBOX(Lush);
165-
SETUP_TEMPCAT_SPINBOX(Cold);
166-
SETUP_TEMPCAT_SPINBOX(Freezing);
167-
SETUP_TEMPCAT_SPINBOX(Special+Warm);
168-
SETUP_TEMPCAT_SPINBOX(Special+Lush);
169-
SETUP_TEMPCAT_SPINBOX(Special+Cold);
159+
addTempCat(Oceanic, tr("Oceanic"));
160+
addTempCat(Warm, tr("Warm"));
161+
addTempCat(Lush, tr("Lush"));
162+
addTempCat(Cold, tr("Cold"));
163+
addTempCat(Freezing, tr("Freezing"));
164+
addTempCat(Special+Warm, tr("Special Warm"));
165+
addTempCat(Special+Lush, tr("Special Lush"));
166+
addTempCat(Special+Cold, tr("Special Cold"));
170167

171168
for (const StartPiece *sp = g_start_pieces; sp->stype >= 0; sp++)
172169
{
@@ -463,6 +460,18 @@ ConditionDialog::~ConditionDialog()
463460
delete ui;
464461
}
465462

463+
void ConditionDialog::addTempCat(int temp, QString name)
464+
{
465+
tempsboxes[temp] = new SpinExclude();
466+
QLabel *l = new QLabel(name);
467+
int c = temp / Special;
468+
int r = temp % Special;
469+
ui->gridLayoutTemps->addWidget(tempsboxes[temp], r, c * 2 + 0);
470+
ui->gridLayoutTemps->addWidget(l, r, c * 2 + 1);
471+
if (mc > MC_1_6 && mc <= MC_1_17)
472+
l->setToolTip(getTip(mc, L_SPECIAL_1024, 0, r + (temp >= Special ? 256 : 0)));
473+
}
474+
466475
void ConditionDialog::updateMode()
467476
{
468477
int filterindex = ui->comboBoxType->currentData().toInt();

src/conditiondialog.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ class ComboBoxDelegate : public QStyledItemDelegate
6363
QComboBox *combo;
6464
};
6565

66+
// QLineEdit defaults to a style hint width 17 characters, which is too long for coordinates
67+
class CoordEdit : public QLineEdit
68+
{
69+
Q_OBJECT
70+
public:
71+
CoordEdit(QWidget *parent = nullptr) : QLineEdit(parent) {}
72+
73+
virtual QSize sizeHint() const override
74+
{
75+
QSize size = QLineEdit::minimumSizeHint();
76+
QFontMetrics fm(font());
77+
size.setWidth(size.width() + fm.horizontalAdvance("-30000000"));
78+
return size;
79+
}
80+
};
81+
6682
class SpinExclude : public QSpinBox
6783
{
6884
Q_OBJECT
@@ -162,7 +178,7 @@ class ConditionDialog : public QDialog
162178
explicit ConditionDialog(FormConditions *parent, Config *config, int mc, QListWidgetItem *item = 0, Condition *initcond = 0);
163179
virtual ~ConditionDialog();
164180

165-
void addVariant(QString name, int biome, int variant);
181+
void addTempCat(int temp, QString name);
166182
void updateMode();
167183
void updateBiomeSelection();
168184
int warnIfBad(Condition cond);

0 commit comments

Comments
 (0)