Skip to content

Commit

Permalink
GUI: Remove class members that aren't needed
Browse files Browse the repository at this point in the history
  • Loading branch information
fdde authored and DrMcCoy committed Dec 29, 2017
1 parent 8e5ce93 commit ddcac11
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 83 deletions.
15 changes: 7 additions & 8 deletions src/gui/panelpreviewempty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@ W_OBJECT_IMPL(PanelPreviewEmpty)

PanelPreviewEmpty::PanelPreviewEmpty(QWidget *parent)
: QFrame(parent) {
_layoutHorizontal = new QHBoxLayout(this);
_layoutHorizontal->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layoutTop = new QHBoxLayout(this);
layoutTop->setContentsMargins(0, 0, 0, 0);

_label = new QLabel(tr("[Nothing to preview.]"), this);
_label->setObjectName(QStringLiteral("_label"));
_label->setEnabled(false);
_label->setAlignment(Qt::AlignCenter);
QLabel *label = new QLabel(tr("[No preview.]"), this);
label->setEnabled(false);
label->setAlignment(Qt::AlignCenter);

_layoutHorizontal->addWidget(_label);
layoutTop->addWidget(label);

this->setLayout(_layoutHorizontal);
this->setLayout(layoutTop);
}

} // End of namespace GUI
4 changes: 0 additions & 4 deletions src/gui/panelpreviewempty.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ namespace GUI {
class PanelPreviewEmpty : public QFrame {
W_OBJECT(PanelPreviewEmpty)

private:
QHBoxLayout *_layoutHorizontal;
QLabel *_label;

public:
PanelPreviewEmpty(QWidget *parent = 0);
};
Expand Down
38 changes: 18 additions & 20 deletions src/gui/panelpreviewimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ PanelPreviewImage::PanelPreviewImage(QWidget *parent)

_mode = Qt::SmoothTransformation;

_layoutGrid = new QGridLayout(this);
_layoutVertical = new QVBoxLayout();
_layoutHorizontal = new QHBoxLayout();
QGridLayout *layoutTop = new QGridLayout(this);
QVBoxLayout *layoutLeft = new QVBoxLayout();

_buttonZoomIn = new QPushButton(tr("Zoom in"), this);
_buttonZoomOut = new QPushButton(tr("Zoom out"), this);
Expand All @@ -53,7 +52,7 @@ PanelPreviewImage::PanelPreviewImage(QWidget *parent)
_buttonShrinkFitWidth = new QPushButton(tr("Shrink fit width"), this);

_labelDimensions = new QLabel(this);
_labelBrightness = new QLabel(this);
QLabel *labelBrightness = new QLabel(tr("Background brightness"), this);
_labelZoomPercent = new QLabel(this);
_labelImage = new QLabel(this);

Expand All @@ -63,26 +62,25 @@ PanelPreviewImage::PanelPreviewImage(QWidget *parent)

_checkNearest = new QCheckBox("Nearest", this);

_layoutVertical->addWidget(_labelZoomPercent);
_layoutVertical->addWidget(_buttonZoomIn);
_layoutVertical->addWidget(_buttonZoomOut);
_layoutVertical->addWidget(_buttonZoomOriginal);
_layoutVertical->addWidget(_buttonFit);
_layoutVertical->addWidget(_buttonFitWidth);
_layoutVertical->addWidget(_buttonShrinkFit);
_layoutVertical->addWidget(_buttonShrinkFitWidth);
_layoutVertical->addWidget(_checkNearest);
_layoutVertical->insertStretch(-1, 1); // get rid of spacing between buttons
layoutLeft->addWidget(_labelZoomPercent);
layoutLeft->addWidget(_buttonZoomIn);
layoutLeft->addWidget(_buttonZoomOut);
layoutLeft->addWidget(_buttonZoomOriginal);
layoutLeft->addWidget(_buttonFit);
layoutLeft->addWidget(_buttonFitWidth);
layoutLeft->addWidget(_buttonShrinkFit);
layoutLeft->addWidget(_buttonShrinkFitWidth);
layoutLeft->addWidget(_checkNearest);
layoutLeft->insertStretch(-1, 1); // get rid of spacing between buttons
_labelZoomPercent->setAlignment(Qt::AlignCenter);

_layoutGrid->addWidget(_labelDimensions, 0, 0);
_layoutGrid->addWidget(_labelBrightness, 1, 0);
_layoutGrid->addWidget(_sliderBrightness, 1, 1);
_layoutGrid->addLayout(_layoutVertical, 2, 0);
_layoutGrid->addWidget(_scrollAreaImage, 2, 1);
layoutTop->addWidget(_labelDimensions, 0, 0);
layoutTop->addWidget(labelBrightness, 1, 0);
layoutTop->addWidget(_sliderBrightness, 1, 1);
layoutTop->addLayout(layoutLeft, 2, 0);
layoutTop->addWidget(_scrollAreaImage, 2, 1);

_labelDimensions->setText(tr("(WxH)"));
_labelBrightness->setText(tr("Background brightness"));
_labelZoomPercent->setText(tr("100%"));

_labelImage->setBackgroundRole(QPalette::Base);
Expand Down
5 changes: 0 additions & 5 deletions src/gui/panelpreviewimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ class PanelPreviewImage : public QFrame {
W_OBJECT(PanelPreviewImage)

private:
QGridLayout *_layoutGrid;
QVBoxLayout *_layoutVertical;
QHBoxLayout *_layoutHorizontal;

QPushButton *_buttonZoomIn;
QPushButton *_buttonZoomOut;
QPushButton *_buttonZoomOriginal;
Expand All @@ -62,7 +58,6 @@ class PanelPreviewImage : public QFrame {
QPushButton *_buttonShrinkFitWidth;

QLabel *_labelDimensions;
QLabel *_labelBrightness;
QLabel *_labelZoomPercent;
QLabel *_labelImage; // this label is used to display the image

Expand Down
34 changes: 17 additions & 17 deletions src/gui/panelpreviewsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ W_OBJECT_IMPL(PanelPreviewSound)

PanelPreviewSound::PanelPreviewSound(QWidget *parent)
: QFrame(parent) {
_layoutGrid = new QGridLayout(this);
_layoutHorizontal = new QHBoxLayout();
_layoutHorizontal_2 = new QHBoxLayout();
_layoutVertical = new QVBoxLayout();
QGridLayout *layoutTop = new QGridLayout(this);
QHBoxLayout *layoutLabels = new QHBoxLayout();
QHBoxLayout *layoutButtons = new QHBoxLayout();
QVBoxLayout *layoutVolume = new QVBoxLayout();

_timer = new QTimer(this);

Expand All @@ -56,23 +56,23 @@ PanelPreviewSound::PanelPreviewSound(QWidget *parent)

_sliderPosition->setOrientation(Qt::Horizontal);

_layoutHorizontal->addWidget(_labelPosition);
_layoutHorizontal->addWidget(_labelPercent);
_layoutHorizontal->addWidget(_labelDuration);
layoutLabels->addWidget(_labelPosition);
layoutLabels->addWidget(_labelPercent);
layoutLabels->addWidget(_labelDuration);

_layoutHorizontal_2->addWidget(_buttonPlay);
_layoutHorizontal_2->addWidget(_buttonPause);
_layoutHorizontal_2->addWidget(_buttonStop);
layoutButtons->addWidget(_buttonPlay);
layoutButtons->addWidget(_buttonPause);
layoutButtons->addWidget(_buttonStop);

_layoutVertical->addWidget(_labelVolume);
_layoutVertical->addWidget(_sliderVolume);
layoutVolume->addWidget(_labelVolume);
layoutVolume->addWidget(_sliderVolume);

_layoutGrid->addWidget(_sliderPosition, 0, 0);
_layoutGrid->addLayout(_layoutHorizontal, 1, 0);
_layoutGrid->addLayout(_layoutVertical, 0, 1);
_layoutGrid->addLayout(_layoutHorizontal_2, 2, 0);
layoutTop->addWidget(_sliderPosition, 0, 0);
layoutTop->addLayout(layoutLabels, 1, 0);
layoutTop->addLayout(layoutVolume, 0, 1);
layoutTop->addLayout(layoutButtons, 2, 0);

_layoutGrid->setSizeConstraint(QLayout::SetFixedSize);
layoutTop->setSizeConstraint(QLayout::SetFixedSize);

_sliderVolume->setMaximum(100);

Expand Down
5 changes: 0 additions & 5 deletions src/gui/panelpreviewsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ class PanelPreviewSound : public QFrame {
W_OBJECT(PanelPreviewSound)

private:
QGridLayout *_layoutGrid;
QHBoxLayout *_layoutHorizontal;
QHBoxLayout *_layoutHorizontal_2;
QVBoxLayout *_layoutVertical;

QSlider *_sliderPosition;
QSlider *_sliderVolume;

Expand Down
6 changes: 3 additions & 3 deletions src/gui/panelpreviewtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ W_OBJECT_IMPL(PanelPreviewText)

PanelPreviewText::PanelPreviewText(QWidget *parent)
: QFrame(parent) {
_layoutHorizontal = new QHBoxLayout(this);
QHBoxLayout *layoutTop = new QHBoxLayout(this);

_textEdit = new QTextEdit();

_textEdit->setFrameShape(QFrame::NoFrame);

_layoutHorizontal->addWidget(_textEdit);
_layoutHorizontal->setContentsMargins(0, 0, 0, 0);
layoutTop->addWidget(_textEdit);
layoutTop->setContentsMargins(0, 0, 0, 0);
}

void PanelPreviewText::setText(const QString &text) {
Expand Down
1 change: 0 additions & 1 deletion src/gui/panelpreviewtext.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class PanelPreviewText : public QFrame {
W_OBJECT(PanelPreviewText)

private:
QHBoxLayout *_layoutHorizontal;
QTextEdit *_textEdit;

const ResourceTreeItem *_currentItem;
Expand Down
32 changes: 16 additions & 16 deletions src/gui/panelresourceinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ W_OBJECT_IMPL(PanelResourceInfo)

PanelResourceInfo::PanelResourceInfo(QWidget *parent)
: QFrame(parent) {
_layoutVertical = new QVBoxLayout(this);
_layoutVertical_2 = new QVBoxLayout();
_layoutHorizontal = new QHBoxLayout();
QVBoxLayout *layoutTop = new QVBoxLayout(this);
QVBoxLayout *layoutLabels = new QVBoxLayout();
QHBoxLayout *layoutButtons = new QHBoxLayout();

_buttonExportRaw = new QPushButton(tr("Save"), this);
_buttonExportBMUMP3 = new QPushButton(tr("Export as MP3"), this);
Expand All @@ -54,23 +54,23 @@ PanelResourceInfo::PanelResourceInfo(QWidget *parent)
_labelFileType = new QLabel(tr("File type:"), this);
_labelResType = new QLabel(tr("Resource type:"), this);

_layoutVertical_2->addWidget(_labelName);
_layoutVertical_2->addWidget(_labelSize);
_layoutVertical_2->addWidget(_labelFileType);
_layoutVertical_2->addWidget(_labelResType);
layoutLabels->addWidget(_labelName);
layoutLabels->addWidget(_labelSize);
layoutLabels->addWidget(_labelFileType);
layoutLabels->addWidget(_labelResType);

_layoutHorizontal->addWidget(_buttonExportRaw);
_layoutHorizontal->addWidget(_buttonExportBMUMP3);
_layoutHorizontal->addWidget(_buttonExportTGA);
_layoutHorizontal->addWidget(_buttonExportWAV);
_layoutHorizontal->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
layoutButtons->addWidget(_buttonExportRaw);
layoutButtons->addWidget(_buttonExportBMUMP3);
layoutButtons->addWidget(_buttonExportTGA);
layoutButtons->addWidget(_buttonExportWAV);
layoutButtons->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));

_layoutHorizontal->setSizeConstraint(QLayout::SetMinimumSize);
layoutButtons->setSizeConstraint(QLayout::SetMinimumSize);

_layoutVertical->addLayout(_layoutVertical_2);
_layoutVertical->addLayout(_layoutHorizontal);
layoutTop->addLayout(layoutLabels);
layoutTop->addLayout(layoutButtons);

_layoutVertical->setContentsMargins(0, 0, 0, 0);
layoutTop->setContentsMargins(0, 0, 0, 0);

_buttonExportRaw->setVisible(false);
_buttonExportBMUMP3->setVisible(false);
Expand Down
4 changes: 0 additions & 4 deletions src/gui/panelresourceinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class PanelResourceInfo : public QFrame {
W_OBJECT(PanelResourceInfo)

private:
QVBoxLayout *_layoutVertical;
QHBoxLayout *_layoutHorizontal;
QVBoxLayout *_layoutVertical_2;

QPushButton *_buttonExportRaw;
QPushButton *_buttonExportBMUMP3;
QPushButton *_buttonExportTGA;
Expand Down

0 comments on commit ddcac11

Please sign in to comment.