File indexing completed on 2024-05-12 05:53:56

0001 /*
0002  * Copyright (c) 2018 Sune Vuorela <sune@vuorela.dk>
0003  *
0004  * Permission is hereby granted, free of charge, to any person
0005  * obtaining a copy of this software and associated documentation
0006  * files (the "Software"), to deal in the Software without
0007  * restriction, including without limitation the rights to use,
0008  * copy, modify, merge, publish, distribute, sublicense, and/or sell
0009  * copies of the Software, and to permit persons to whom the
0010  * Software is furnished to do so, subject to the following
0011  * conditions:
0012  *
0013  * The above copyright notice and this permission notice shall be
0014  * included in all copies or substantial portions of the Software.
0015  *
0016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0017  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0018  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0019  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
0020  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0021  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0022  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0023  * OTHER DEALINGS IN THE SOFTWARE.
0024  */
0025 
0026 #pragma once
0027 #include <QMainWindow>
0028 #include <memory>
0029 
0030 class ActiveDocument;
0031 class FsPane;
0032 class MainPane;
0033 class Scanner;
0034 
0035 /**
0036  *Main window
0037  */
0038 class MainWindow : public QMainWindow
0039 {
0040     Q_OBJECT
0041 public:
0042     MainWindow(QWidget* parent = nullptr);
0043     ~MainWindow();
0044 Q_SIGNALS:
0045     /** private signal to help whenever pane clearing (Usually following open folder) is needed*/
0046     void clear(QPrivateSignal = QPrivateSignal{});
0047 private Q_SLOTS:
0048     /** When open folder is invoked*/
0049     void openFolder();
0050     /** When edit recipe is invoked */
0051     void editActiveRecipe();
0052     /** creates a recipe and edits */
0053     void newRecipe();
0054     /** writes message to the status bar (for a short interval)*/
0055     void notifyStatusBar(const QString& message);
0056     /** opens random recipe*/
0057     void showRandomRecipe();
0058 private:
0059     /** Sets the current folder (and notifies whoever needs it) */
0060     void setCurrentFolder(const QString& folder);
0061     std::unique_ptr<ActiveDocument> m_activeDocument;
0062     FsPane* m_fsPane;
0063     MainPane* m_mainPane;
0064     std::unique_ptr<Scanner> m_scanner;
0065     QString m_currentFolder;
0066 };