mainWindow.h 3.25 KB
Newer Older
1
2
/***********************************************************************
* Copyright 2003-2004  Max Howell <max.howell@methylblue.com>
3
* Copyright 2008-2009  Martin Sandsmark <martin.sandsmark@kde.org>
Harald Sitter's avatar
Harald Sitter committed
4
* Copyright 2017  Harald Sitter <sitter@kde.org>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
*
* 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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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, see <http://www.gnu.org/licenses/>.
***********************************************************************/

23
24
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
25

Harald Sitter's avatar
Harald Sitter committed
26
27
28
29
30
31
32
33
34
35
#include <QUrl>

#include <KXmlGuiWindow>

class QLabel;

namespace RadialMap {
class Widget;
}
class Folder;
36
37

class KSqueezedTextLabel;
38
class KHistoryComboBox;
39
40
class KRecentFilesAction;

Harald Sitter's avatar
Harald Sitter committed
41
class ProgressBox;
42
43
44
45
class HistoryCollection;

namespace Filelight {

Harald Sitter's avatar
Harald Sitter committed
46
47
48
49
class ScanManager;
class SummaryWidget;

class MainWindow : public KXmlGuiWindow // Maybe use qmainwindow
50
{
51
    Q_OBJECT
52

53
public:
54
55
    MainWindow();

Harald Sitter's avatar
Harald Sitter committed
56
    void scan(const QUrl &u);
57

58
Q_SIGNALS:
Harald Sitter's avatar
Harald Sitter committed
59
60
    void started(); // FIXME: Could be replaced by direct func call once merged with mainwindow
    void completed();
Laurent Montel's avatar
Laurent Montel committed
61
62
    void canceled(const QString&);
    void setWindowCaption(const QString&);
Harald Sitter's avatar
Harald Sitter committed
63

64
private Q_SLOTS:
65
66
    void slotUp();
    void slotComboScan();
67
68
    void slotScanFolder();
    void slotScanHomeFolder();
69
    void slotSaveSvg();
70
    void slotScanRootFolder();
71
    bool slotScanUrl(const QUrl&);
72
    bool slotScanPath(const QString&);
73
74
75
76
77
78
79
80
81
82
83
    void slotAbortScan();

    void configToolbars();
    void configKeys();

    void scanStarted();
    void scanFailed();
    void scanCompleted();

    void urlAboutToChange();

Harald Sitter's avatar
Harald Sitter committed
84
85
86
87
88
89
90
91
92
    bool openUrl(const QUrl&);
    void configFilelight();
    void rescan();

    void postInit();
    void folderScanCompleted(Folder*);
    void mapChanged(const Folder*);
    void updateURL(const QUrl &);

93
protected:
94
95
96
    void saveProperties(KConfigGroup&) override;
    void readProperties(const KConfigGroup&) override;
    void closeEvent(QCloseEvent *event) override;
97

Harald Sitter's avatar
Harald Sitter committed
98
private:
99
    void setupActions();
Harald Sitter's avatar
Harald Sitter committed
100
101
102
103
104
    bool closeUrl();
    QString prettyUrl() const;
    void showSummary();
    bool start(const QUrl&);

105
106
107
108
109
    KSqueezedTextLabel *m_status[2];
    KHistoryComboBox   *m_combo;
    HistoryCollection  *m_histories;
    KRecentFilesAction *m_recentScans;

Harald Sitter's avatar
Harald Sitter committed
110
111
112
113
114
115
116
117
118
119
    QLayout            *m_layout;
    SummaryWidget      *m_summary;
    RadialMap::Widget  *m_map;
    ProgressBox        *m_stateWidget;
    ScanManager        *m_manager;
    QLabel             *m_numberOfFiles;

    bool m_started;


120
    // KPart Compat helper
Harald Sitter's avatar
Harald Sitter committed
121
122
123
124
125
public:
    QUrl url() const;
private:
    void setUrl(const QUrl &url);
    QUrl m_url;
126
127
128
129
130
};

} // namespace Filelight

#endif