diff options
Diffstat (limited to 'src/plugins/General')
| -rw-r--r-- | src/plugins/General/library/library.pro | 9 | ||||
| -rw-r--r-- | src/plugins/General/library/libraryfactory.cpp | 14 | ||||
| -rw-r--r-- | src/plugins/General/library/libraryfactory.h | 13 | ||||
| -rw-r--r-- | src/plugins/General/library/librarywidget.cpp | 45 | ||||
| -rw-r--r-- | src/plugins/General/library/librarywidget.h | 41 | ||||
| -rw-r--r-- | src/plugins/General/library/librarywidget.ui | 40 | ||||
| -rw-r--r-- | src/plugins/General/library/settingsdialog.cpp | 20 | ||||
| -rw-r--r-- | src/plugins/General/library/settingsdialog.h | 20 |
8 files changed, 198 insertions, 4 deletions
diff --git a/src/plugins/General/library/library.pro b/src/plugins/General/library/library.pro index ef8527e79..6cb72f462 100644 --- a/src/plugins/General/library/library.pro +++ b/src/plugins/General/library/library.pro @@ -6,11 +6,13 @@ QT += sql concurrent HEADERS += libraryfactory.h \ library.h \ - settingsdialog.h + settingsdialog.h \ + librarywidget.h SOURCES += libraryfactory.cpp \ library.cpp \ - settingsdialog.cpp + settingsdialog.cpp \ + librarywidget.cpp #RESOURCES = translations/translations.qrc @@ -23,4 +25,5 @@ unix { } FORMS += \ - settingsdialog.ui + settingsdialog.ui \ + librarywidget.ui diff --git a/src/plugins/General/library/libraryfactory.cpp b/src/plugins/General/library/libraryfactory.cpp index 50894cabe..f581ca26b 100644 --- a/src/plugins/General/library/libraryfactory.cpp +++ b/src/plugins/General/library/libraryfactory.cpp @@ -23,7 +23,7 @@ #include <qmmp/qmmp.h> #include "library.h" #include "settingsdialog.h" -//#include "historysettingsdialog.h" +#include "librarywidget.h" #include "libraryfactory.h" GeneralProperties LibraryFactory::properties() const @@ -34,6 +34,8 @@ GeneralProperties LibraryFactory::properties() const properties.hasAbout = true; properties.hasSettings = true; properties.visibilityControl = false; + properties.widgets = { { LIBRARY_WIDGET, tr("Media Library"), Qt::RightDockWidgetArea, + Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea } }; return properties; } @@ -42,6 +44,16 @@ QObject *LibraryFactory::create(QObject *parent) return new Library(parent); } +QWidget *LibraryFactory::createWidget(int id, QWidget *parent) +{ + if(id == LIBRARY_WIDGET) + { + m_libraryWidget = new LibraryWidget(false, parent); + return m_libraryWidget; + } + return nullptr; +} + QDialog *LibraryFactory::createConfigDialog(QWidget *parent) { return new SettingsDialog(parent); diff --git a/src/plugins/General/library/libraryfactory.h b/src/plugins/General/library/libraryfactory.h index d9500bcbb..ce818b2a1 100644 --- a/src/plugins/General/library/libraryfactory.h +++ b/src/plugins/General/library/libraryfactory.h @@ -17,14 +17,18 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ + #ifndef LIBRARYFACTORY_H #define LIBRARYFACTORY_H #include <QObject> #include <QDialog> +#include <QPointer> #include <qmmpui/general.h> #include <qmmpui/generalfactory.h> +class LibraryWidget; + /** @author Ilya Kotov <forkotov02@ya.ru> */ @@ -36,9 +40,18 @@ Q_INTERFACES(GeneralFactory) public: GeneralProperties properties() const override; QObject *create(QObject *parent) override; + QWidget *createWidget(int id, QWidget *parent) override; QDialog *createConfigDialog(QWidget *parent) override; void showAbout(QWidget *parent) override; QString translation() const override; + +private: + enum WidgetType + { + LIBRARY_WIDGET = 0 + }; + + QPointer<LibraryWidget> m_libraryWidget; }; #endif // LIBRARYFACTORY_H diff --git a/src/plugins/General/library/librarywidget.cpp b/src/plugins/General/library/librarywidget.cpp new file mode 100644 index 000000000..7047c66e4 --- /dev/null +++ b/src/plugins/General/library/librarywidget.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2020 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "librarywidget.h" +#include "ui_librarywidget.h" + +LibraryWidget::LibraryWidget(bool dialog, QWidget *parent) : + QWidget(parent), + m_ui(new Ui::LibraryWidget) +{ + m_ui->setupUi(this); + + if(dialog) + { + setWindowFlags(Qt::Dialog); + setAttribute(Qt::WA_DeleteOnClose); + setAttribute(Qt::WA_QuitOnClose, false); + } + else + { + m_ui->buttonBox->hide(); + } +} + +LibraryWidget::~LibraryWidget() +{ + delete m_ui; +} diff --git a/src/plugins/General/library/librarywidget.h b/src/plugins/General/library/librarywidget.h new file mode 100644 index 000000000..aa26e5c22 --- /dev/null +++ b/src/plugins/General/library/librarywidget.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2020 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef LIBRARYWIDGET_H +#define LIBRARYWIDGET_H + +#include <QWidget> + +namespace Ui { +class LibraryWidget; +} + +class LibraryWidget : public QWidget +{ + Q_OBJECT +public: + explicit LibraryWidget(bool dialog, QWidget *parent = nullptr); + ~LibraryWidget(); + +private: + Ui::LibraryWidget *m_ui; +}; + +#endif // LIBRARYWIDGET_H diff --git a/src/plugins/General/library/librarywidget.ui b/src/plugins/General/library/librarywidget.ui new file mode 100644 index 000000000..c4b42f9b6 --- /dev/null +++ b/src/plugins/General/library/librarywidget.ui @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>LibraryWidget</class> + <widget class="QWidget" name="LibraryWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>423</width> + <height>394</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/General/library/settingsdialog.cpp b/src/plugins/General/library/settingsdialog.cpp index 275478bc7..7ebdb31b9 100644 --- a/src/plugins/General/library/settingsdialog.cpp +++ b/src/plugins/General/library/settingsdialog.cpp @@ -1,3 +1,23 @@ +/*************************************************************************** + * Copyright (C) 2020 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + #include <qmmp/qmmp.h> #include <qmmpui/filedialog.h> #include <QDir> diff --git a/src/plugins/General/library/settingsdialog.h b/src/plugins/General/library/settingsdialog.h index 06d1c7cd6..c467eaabe 100644 --- a/src/plugins/General/library/settingsdialog.h +++ b/src/plugins/General/library/settingsdialog.h @@ -1,3 +1,23 @@ +/*************************************************************************** + * Copyright (C) 2020 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + #ifndef SETTINGSDIALOG_H #define SETTINGSDIALOG_H |
