summaryrefslogtreecommitdiffstats
path: root/copydialog.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-10-13 03:18:29 +0200
committerArno <arno@disconnect.de>2018-10-13 03:18:29 +0200
commit423670fc310b8c853c471a3c272db13e38edd8db (patch)
treecd64ff3558a09070c16849cbaac6d37246d4560d /copydialog.cpp
parent6ccb253ceb2f893fc1ba917a6db1792fcfeca8db (diff)
downloadBeetPlayer-423670fc310b8c853c471a3c272db13e38edd8db.tar.gz
BeetPlayer-423670fc310b8c853c471a3c272db13e38edd8db.tar.bz2
BeetPlayer-423670fc310b8c853c471a3c272db13e38edd8db.zip
Implement layout for CopyDialog
Does nothing yet except close. This was harder than it should be: To keep a GridLayout expanding its cells vertically, you have to set the Alignment in the *parent* Layout. Took me a while to figure out...
Diffstat (limited to 'copydialog.cpp')
-rw-r--r--copydialog.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/copydialog.cpp b/copydialog.cpp
new file mode 100644
index 0000000..f6da343
--- /dev/null
+++ b/copydialog.cpp
@@ -0,0 +1,53 @@
+#include <QGridLayout>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QLabel>
+
+#include "copydialog.h"
+
+CopyDialog::CopyDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) {
+ setAttribute(Qt::WA_DeleteOnClose);
+ setWindowTitle(tr("Copy files"));
+ QGridLayout *dirGrid = new QGridLayout;
+ QLabel *srcL = new QLabel(tr("Source"));
+ dirGrid->addWidget(srcL, 0, 0);
+ mSrcE = new QLineEdit;
+ mSrcE->setReadOnly(true);
+ dirGrid->addWidget(mSrcE, 0, 1);
+ QPushButton *srcB = new QPushButton(QIcon::fromTheme("folder"), tr("..."));
+ dirGrid->addWidget(srcB, 0, 2);
+ QLabel *dstL = new QLabel(tr("Destination"));
+ dirGrid->addWidget(dstL, 1, 0);
+ mDstE = new QLineEdit;
+ mDstE->setReadOnly(true);
+ dirGrid->addWidget(mDstE, 1, 1);
+ QPushButton *dstB = new QPushButton(QIcon::fromTheme("folder"), tr("..."));
+ dirGrid->addWidget(dstB, 1, 2);
+ QLabel *folderL = new QLabel(tr("Folder Name"));
+ dirGrid->addWidget(folderL, 2, 0);
+ mFolderE = new QLineEdit;
+ dirGrid->addWidget(mFolderE, 2, 1);
+ QPushButton *refreshB = new QPushButton(QIcon::fromTheme("view-refresh"), QString());
+ dirGrid->addWidget(refreshB, 2, 2);
+ QGroupBox *dirGB = new QGroupBox("Directories");
+ dirGB->setLayout(dirGrid);
+ QHBoxLayout *resultL = new QHBoxLayout;
+ mResultL = new QLabel;
+ resultL->addWidget(mResultL);
+ QGroupBox *resultGB = new QGroupBox(tr("Result"));
+ resultGB->setLayout(resultL);
+ QHBoxLayout *buttonL = new QHBoxLayout;
+ QPushButton *copyB = new QPushButton(tr("Copy!"));
+ buttonL->addStretch();
+ buttonL->addWidget(copyB);
+ QPushButton *closeB = new QPushButton(tr("Close"));
+ connect(closeB, &QPushButton::clicked, this, &CopyDialog::close);
+ buttonL->addWidget(closeB);
+ buttonL->addStretch();
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(dirGB, Qt::AlignTop);
+ mainLayout->addWidget(resultGB, Qt::AlignVCenter);
+ mainLayout->addLayout(buttonL, Qt::AlignBottom);
+ setLayout(mainLayout);
+}