Debian Codegraph @

src/gui/captureHandler/CaptureTabStateHandler.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 Damir Porobic <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef KSNIP_CAPTURETABSTATEHANDLER_H
21 #define KSNIP_CAPTURETABSTATEHANDLER_H
22
23 #include <QObject>
24 #include <QList>
25 #include <QSharedPointer>
26
27 #include "ICaptureTabStateHandler.h"
28 #include "CaptureTabState.h"
29 #include "src/common/dtos/SaveResultDto.h"
30 #include "src/common/dtos/RenameResultDto.h"
31 #include "src/common/helper/PathHelper.h"
32
33 class CaptureTabStateHandler : public ICaptureTabStateHandler
34 {
35 Q_OBJECT
36 public:
37 explicit CaptureTabStateHandler();
38 ~CaptureTabStateHandler() override = default;
39 void add(int index, const QString &filename, const QString &path, bool isSaved) override;
40 bool isSaved(int index) override;
41 bool isPathValid(int index) override;
42 QString path(int index) override;
43 QString filename(int index) override;
44 void setSaveState(int index, const SaveResultDto &saveResult) override;
45 void renameFile(int index, const RenameResultDto &renameResult) override;
46 int count() const override;
47 int currentTabIndex() const override;
48
49 public slots:
50 void tabMoved(int fromIndex, int toIndex) override;
51 void currentTabChanged(int index) override;
52 void tabRemoved(int index) override;
53 void currentTabContentChanged() override;
54
55 private:
56 int mCurrentTabIndex;
57 QList<QSharedPointer<CaptureTabState>> mCaptureTabStates;
58
59 void refreshTabInfo(int index);
60 QSharedPointer<CaptureTabState> getTabState(int index);
61 };
62
63 #endif //KSNIP_CAPTURETABSTATEHANDLER_H