File indexing completed on 2024-04-21 03:51:00

0001 /*
0002     SPDX-FileCopyrightText: 2008-2010 Daniel Laidig <d.laidig@gmx.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef DASHBOARD_H
0007 #define DASHBOARD_H
0008 
0009 #include "statistics/statisticsmainwindow.h"
0010 #include "ui_dashboard.h"
0011 
0012 #include <KXmlGuiWindow>
0013 #include <QUrl>
0014 
0015 static const int N = 50;
0016 
0017 class ParleyMainWindow;
0018 
0019 namespace Practice
0020 {
0021 class ThemedBackgroundRenderer;
0022 class ImageWidget;
0023 }
0024 
0025 class CollectionWidget;
0026 class RemoveButton;
0027 
0028 class Dashboard : public KXmlGuiWindow
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit Dashboard(ParleyMainWindow *parent);
0033     ~Dashboard() override;
0034 
0035 public Q_SLOTS:
0036     void slotOpenUrl(const QUrl &url);
0037     void slotPracticeUrl(const QUrl &url);
0038     // void slotDoubleClicked(const QModelIndex& index);
0039     void slotDoubleClickOpen();
0040     // void updateRecentFilesModel();
0041     void populateGrid();
0042     void populateMap();
0043     void clearGrid();
0044     void slotPracticeButtonClicked(const QString &urlString);
0045     void slotRemoveButtonClicked(const QString &urlString);
0046     void statisticsHandler(const QUrl &url);
0047     void remove(QGridLayout *layout, int row, int column, bool deleteWidgets);
0048     void deleteChildWidgets(QLayoutItem *item);
0049 
0050 private Q_SLOTS:
0051     void setTheme();
0052     void updateWidgets();
0053     void backgroundChanged(const QPixmap &pixmap);
0054     void updateFontColors();
0055     void updateBackground();
0056 
0057 private:
0058     Ui::Dashboard m_ui;
0059     ParleyMainWindow *m_mainWindow;
0060     StatisticsMainWindow *m_statisticsWidget;
0061     Practice::ThemedBackgroundRenderer *m_themedBackgroundRenderer;
0062     Practice::ImageWidget *m_widget;
0063 
0064     QMap<QString, QString> m_recentFilesMap; // url, name
0065     QUrl m_openUrl;
0066     QGridLayout *m_subGridLayout;
0067     QGridLayout *m_completedGridLayout;
0068     QList<CollectionWidget *> m_collectionWidgets; // List of the widgets in the dashboard.
0069 
0070     // The parts of the collections
0071     QUrl m_urlArray[N];
0072 
0073     int m_count;
0074 };
0075 
0076 #endif