/** * @file FileFinder/GUI/gui.h * @brief GUI for the FileFinder application * @author Enar Vaikene * * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __FILEFINDER_GUI_GUI_H # define __FILEFINDER_GUI_GUI_H #include "version.h" #include #include #include #include #include #include class QWidget; class QCheckBox; class QComboBox; class QPushButton; class QListWidget; class QAction; class QFileSystemModel; namespace eVaf { namespace SdiWindow { struct iSdiWindow; } // namespace eVaf::SdiWindow namespace FileFinder { class iFileFinder; namespace GUI { namespace Internal { /** * Main widget for the FileFinder window */ class MainWidget : public Gui::Panel { Q_OBJECT public: MainWidget(QWidget * parent = nullptr) : Gui::Panel(parent) {} virtual void keyPressEvent(QKeyEvent * e); signals: /** * Request to close the windows/application */ void quit(); }; } // namespace eVaf::FileFinder::GUI::Internal /** * Graphical User Interface for the FileFinder application. * * This module adds a GUI window to the FileFinder application using the SdiWindow module. */ class Module : public Plugins::iPlugin { Q_OBJECT Q_INTERFACES(eVaf::Plugins::iPlugin) Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR) public: Module(); virtual ~Module(); virtual bool init(QString const & args); virtual void done(); virtual bool isReady() const { return mReady; } private slots: void browseDirectory(); void find(); void found(QString const & file, QString const & dir); void finished(bool); void currentRowChanged(int currentRow); void openFile(QModelIndex const & index = QModelIndex()); void openDirectory(); void copyName(); void copyAllNames(); private: // Members /// Max number of items in each field that we save static int const MaxHistoryItems; /// Flag indicating that the module is ready bool mReady; /// The iFileFinder interface eVaf::FileFinder::iFileFinder * mFinder; /// Actions QAction * mOpenFileAction; QAction * mOpenDirectoryAction; QAction * mCopyNameAction; QAction * mCopyAllNamesAction; /// Widgets on the screen Internal::MainWidget * wMain; QComboBox * wDirectory; QPushButton * wBrowse; QCheckBox * wRecursive; QComboBox * wIncludeNames; QComboBox * wExcludeNames; QComboBox * wIncludeContent; QComboBox * wExcludeContent; QListWidget * wResults; QPushButton * wFind; /// File system auto-completion model for the directory field QFileSystemModel * mDirModel; private: // Methods void createWidgets(); void createActions(); void saveHistory(); void loadHistory(); }; } // namespace eVaf::FileFinder::GUI } // namespace eVaf::FileFinder } // namespace eVaf #endif // gui.h