C:/Projets/hexamonkey/gui/mainwindow.h
Go to the documentation of this file.
00001 //This file is part of the HexaMonkey project, a multimedia analyser
00002 //Copyright (C) 2013  Sevan Drapeau-Martin, Nicolas Fleury
00003 
00004 //This program is free software; you can redistribute it and/or
00005 //modify it under the terms of the GNU General Public License
00006 //as published by the Free Software Foundation; either version 2
00007 //of the License, or (at your option) any later version.
00008 
00009 //This program is distributed in the hope that it will be useful,
00010 //but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //GNU General Public License for more details.
00013 
00014 //You should have received a copy of the GNU General Public License
00015 //along with this program; if not, write to the Free Software
00016 //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017 
00018 #ifndef MAINWINDOW_H
00019 #define MAINWINDOW_H
00020 
00021 #include <QMainWindow>
00022 #include <QFileDialog>
00023 #include <QDockWidget>
00024 #include <QMenuBar>
00025 #include <QAction>
00026 #include "core/formatdetector/formatdetector.h"
00027 
00028 #include "gui/log/logwidget.h"
00029 #include "gui/tree/treewidget.h"
00030 #include "gui/tree/htmldelegate.h"
00031 #include "gui/hex/hexfilewidget.h"
00032 
00033 #include <QAction>
00034 
00035 #include "qtprogramloader.h"
00036 #include "core/log/logmanager.h"
00037 #include "core/interpreter/fromfilemodule.h"
00038 #include "core/modules/standard/standardmodule.h"
00039 #include "core/modules/ebml/ebmlmodule.h"
00040 #include "core/modules/hmc/hmcmodule.h"
00041 #include "core/modules/mkv/mkvmodule.h"
00042 #include "core/modules/stream/streammodule.h"
00043 #include "core/moduleloader.h"
00044 #include "core/util/fileutil.h"
00045 #include "core/util/osutil.h"
00046 
00047 
00048 
00049 class ModuleLoader;
00050 class ProgramLoader;
00051 
00060 class MainWindow : public QMainWindow
00061 {
00062     Q_OBJECT
00063 
00064 public:
00065     MainWindow(ModuleLoader& moduleLoader, const ProgramLoader &programLoader, QWidget *parent = 0);
00066 
00071     void openFile(const std::string& path);
00072     std::vector<std::string> scriptsDirs;
00073 
00074     TreeWidget* treeWidget;
00075     HexFileWidget* hexFileWidget;
00076     LogWidget* logWidget;
00077 
00078 private slots:
00079     virtual void dropEvent(QDropEvent *event) final;
00080     virtual void dragEnterEvent(QDragEnterEvent* event) final;
00081     virtual void dragMoveEvent(QDragMoveEvent* event) final;
00082     virtual void dragLeaveEvent(QDragLeaveEvent* event) final;
00083 
00084     void openFragmentedFile(Object& object);
00085     void open();
00086     void openRecentFile();
00087     void updateRecentFileActions();
00088     void refreshScripts();
00089 
00090 private:
00091     void openFiles(QStringList paths);
00092     void createActions();
00093     void createMenus();
00094 
00095 
00096     QMenu *fileMenu;
00097     QAction *openAct;
00098     QAction *refreshAct;
00099     QMenu *recentFilesMenu;
00100     QAction *separatorAct;
00101 
00102     ModuleLoader& moduleLoader;
00103     const ProgramLoader& programLoader;
00104 
00105     static const int maxRecentFiles = 5;
00106     QAction *recentFileActs[maxRecentFiles];
00107 };
00108 
00109 #endif // MAINWINDOW_H