KisWelcomePageWidget.h 2.95 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/* This file is part of the KDE project
 * Copyright (C) 2018 Scott Petrovic <scottpetrovic@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef KISWELCOMEPAGEWIDGET_H
#define KISWELCOMEPAGEWIDGET_H

#include "kritaui_export.h"
24 25 26
#include "KisViewManager.h"
#include "KisMainWindow.h"

27 28
#include <QWidget>
#include "ui_KisWelcomePage.h"
29
#include <QStandardItemModel>
30

Yuri Chornoivan's avatar
Yuri Chornoivan committed
31
/// A widget for displaying if no documents are open. This will display in the MDI area
32 33 34 35 36 37 38
class KRITAUI_EXPORT KisWelcomePageWidget : public QWidget, public Ui::KisWelcomePage
{
    Q_OBJECT

    public:
    explicit KisWelcomePageWidget(QWidget *parent);
    ~KisWelcomePageWidget() override;
39

40
    void setMainWindow(KisMainWindow* m_mainWindow);
41

42
public Q_SLOTS:
43 44
    /// if a document is placed over this area, a dotted line will appear as an indicator
    /// that it is a droppable area. KisMainwindow is what triggers this
45
    void showDropAreaIndicator(bool show);
46

47
    void slotUpdateThemeColors();
48

49 50
    /// this could be called multiple times. If a recent document doesn't
    /// have a preview, an icon is used that needs to be updated
51 52
    void populateRecentDocuments();

53 54
    void slotUpdateVersionMessage();

55 56 57 58 59 60 61 62
protected:

    // QWidget overrides
    void dragEnterEvent(QDragEnterEvent * event) override;
    void dropEvent(QDropEvent * event) override;
    void dragMoveEvent(QDragMoveEvent * event) override;
    void dragLeaveEvent(QDragLeaveEvent * event) override;

63 64

private:
65 66 67 68
    KisMainWindow *m_mainWindow;
    QStandardItemModel m_recentFilesModel;

    QMap<QString, QIcon> m_thumbnailMap;
69

70 71 72 73 74 75 76 77

    /// help us see how many people are clicking startup screen links
    /// you can see the results in Matomo (stats.kde.org)
    /// this will be listed in the "Acquisition" section of Matomo
    /// just append some text to this to associate it with an event/page
    const QString analyticsString = "pk_campaign=startup-sceen&pk_kwd=";


78 79 80 81 82 83 84
    // keeping track of link colors with theme change
    QColor textColor;
    QColor backgroundColor;
    QColor blendedColor;
    QString blendedStyle;


85 86 87
private Q_SLOTS:
    void slotNewFileClicked();
    void slotOpenFileClicked();
88
    void slotClearRecentFiles();
89
    void recentDocumentClicked(QModelIndex index);
90 91 92
};

#endif // KISWELCOMEPAGEWIDGET_H