From 3cac01583bd3e1f558122e11734a015b5f605406 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Thu, 6 Aug 2020 22:54:21 +0200 Subject: [PATCH] Add username password dialog --- src/CMakeLists.txt | 3 + src/dialogs/userpassdialog.cpp | 31 ++++++++++ src/dialogs/userpassdialog.h | 45 ++++++++++++++ src/dialogs/userpassdialog.ui | 105 +++++++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 src/dialogs/userpassdialog.cpp create mode 100644 src/dialogs/userpassdialog.h create mode 100644 src/dialogs/userpassdialog.ui diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9451c4b4..21a696510 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -168,6 +168,7 @@ set(SOURCES dialogs/edittagdialog.cpp dialogs/trackselectiondialog.cpp dialogs/addstreamdialog.cpp + dialogs/userpassdialog.cpp widgets/autoexpandingtreeview.cpp widgets/busyindicator.cpp @@ -364,6 +365,7 @@ set(HEADERS dialogs/edittagdialog.h dialogs/trackselectiondialog.h dialogs/addstreamdialog.h + dialogs/userpassdialog.h widgets/autoexpandingtreeview.h widgets/busyindicator.h @@ -465,6 +467,7 @@ set(UI dialogs/edittagdialog.ui dialogs/trackselectiondialog.ui dialogs/addstreamdialog.ui + dialogs/userpassdialog.ui widgets/trackslider.ui widgets/osdpretty.ui diff --git a/src/dialogs/userpassdialog.cpp b/src/dialogs/userpassdialog.cpp new file mode 100644 index 000000000..8f94821c9 --- /dev/null +++ b/src/dialogs/userpassdialog.cpp @@ -0,0 +1,31 @@ +/* + * Strawberry Music Player + * Copyright 2020, Jonas Kvinge + * + * Strawberry is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Strawberry is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Strawberry. If not, see . + * + */ + +#include + +#include "userpassdialog.h" +#include "ui_userpassdialog.h" + +UserPassDialog::UserPassDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_UserPassDialog) { + + ui_->setupUi(this); + +} + +UserPassDialog::~UserPassDialog() { delete ui_; } diff --git a/src/dialogs/userpassdialog.h b/src/dialogs/userpassdialog.h new file mode 100644 index 000000000..b528881b0 --- /dev/null +++ b/src/dialogs/userpassdialog.h @@ -0,0 +1,45 @@ +/* + * Strawberry Music Player + * Copyright 2020, Jonas Kvinge + * + * Strawberry is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Strawberry is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Strawberry. If not, see . + * + */ + +#ifndef USERPASSDIALOG_H +#define USERPASSDIALOG_H + +#include "config.h" + +#include +#include +#include + +#include "ui_userpassdialog.h" + +class UserPassDialog : public QDialog { + Q_OBJECT + + public: + explicit UserPassDialog(QWidget *parent = nullptr); + ~UserPassDialog() override; + + QString username() const { return ui_->username->text(); } + QString password() const { return ui_->password->text(); } + + private: + Ui_UserPassDialog *ui_; +}; + +#endif // USERPASSDIALOG_H diff --git a/src/dialogs/userpassdialog.ui b/src/dialogs/userpassdialog.ui new file mode 100644 index 000000000..62113a279 --- /dev/null +++ b/src/dialogs/userpassdialog.ui @@ -0,0 +1,105 @@ + + + UserPassDialog + + + + 0 + 0 + 400 + 161 + + + + Enter username and password + + + + + + + + Username + + + + + + + Password + + + + + + + + + + QLineEdit::Password + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + UserPassDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + UserPassDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +