1 /*
2     Scan Tailor - Interactive post-processing tool for scanned pages.
3     Copyright (C)  Joseph Artsimovich <joseph.artsimovich@gmail.com>
4 
5     This program is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef PAGE_SPLIT_SPLITMODEDIALOG_H_
20 #define PAGE_SPLIT_SPLITMODEDIALOG_H_
21 
22 #include <QButtonGroup>
23 #include <QDialog>
24 #include <set>
25 #include "LayoutType.h"
26 #include "PageId.h"
27 #include "PageLayout.h"
28 #include "PageSequence.h"
29 #include "intrusive_ptr.h"
30 #include "ui_PageSplitModeDialog.h"
31 
32 class ProjectPages;
33 class PageSelectionAccessor;
34 
35 namespace page_split {
36 class SplitModeDialog : public QDialog, private Ui::PageSplitModeDialog {
37   Q_OBJECT
38  public:
39   SplitModeDialog(QWidget* parent,
40                   const PageId& cur_page,
41                   const PageSelectionAccessor& page_selection_accessor,
42                   LayoutType layout_type,
43                   PageLayout::Type auto_detected_layout_type,
44                   bool auto_detected_layout_type_valid);
45 
46   ~SplitModeDialog() override;
47 
48  signals:
49 
50   void accepted(const std::set<PageId>& pages, LayoutType layout_type, bool apply_cut);
51 
52  private slots:
53 
54   void autoDetectionSelected();
55 
56   void manualModeSelected();
57 
58   void onSubmit();
59 
60  private:
61   LayoutType combinedLayoutType() const;
62 
63   static const char* iconFor(LayoutType layout_type);
64 
65   PageSequence m_pages;
66   std::set<PageId> m_selectedPages;
67   PageId m_curPage;
68   QButtonGroup* m_scopeGroup;
69   LayoutType m_layoutType;
70   PageLayout::Type m_autoDetectedLayoutType;
71   bool m_autoDetectedLayoutTypeValid;
72 };
73 }  // namespace page_split
74 #endif  // ifndef PAGE_SPLIT_SPLITMODEDIALOG_H_
75