From 981f8b3acf7e76f27c02f4ced80d55b424cc7497 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 3 Feb 2013 12:49:25 +0100 Subject: initial commit to mercurial repository. Corresponds to MO version 0.12.6 --- src/installdialog.h | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 src/installdialog.h (limited to 'src/installdialog.h') diff --git a/src/installdialog.h b/src/installdialog.h new file mode 100644 index 00000000..14c9d733 --- /dev/null +++ b/src/installdialog.h @@ -0,0 +1,127 @@ +/* +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see . +*/ + +#ifndef INSTALLDIALOG_H +#define INSTALLDIALOG_H + +#include "mytree.h" +#include "archivetree.h" +#include "tutorabledialog.h" +#include +#include +#include +#include +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + + +namespace Ui { + class InstallDialog; +} + + +/** + * a dialog presented to manually define how a mod is to be installed. It provides + * a tree view of the file contents that can modified directly + **/ +class InstallDialog : public TutorableDialog +{ + Q_OBJECT + +public: + /** + * @brief constructor + * + * @param tree tree structure describing the vanilla archive structure. The InstallDialog does NOT take custody of this pointer! + * @param modName name of the mod. The name can be modified through the dialog + * @param parent parent widget + **/ + explicit InstallDialog(DirectoryTree *tree, const QString &modName, QWidget *parent = 0); + ~InstallDialog(); + + /** + * @brief retrieve the (modified) mod name + * + * @return updated mod name + **/ + QString getModName() const; + + /** + * @brief retrieve the user-modified directory structure + * + * @return modified data structure. This is a NEW datatree object for which the caller takes custody + **/ + DirectoryTree *getDataTree() const; + +signals: + + void openFile(const QString fileName); + +private: + + void updatePreview(); + bool testForProblem(); + void updateProblems(); + + void setDataRoot(QTreeWidgetItem* root); + + void updateFileList(QTreeWidgetItem *item, QString targetName, FileData* const *fileData, size_t size) const; + + void updateCheckState(QTreeWidgetItem *item); +// void recursiveCheck(QTreeWidgetItem *item); +// void recursiveUncheck(QTreeWidgetItem *item); + + void addDataToTree(DirectoryTree::Node *node, QTreeWidgetItem *treeItem); + + void mapDataNode(DirectoryTree::Node *node, QTreeWidgetItem *baseItem) const; + + static QString getFullPath(const DirectoryTree::Node *node); + +private slots: + + void on_treeContent_customContextMenuRequested(QPoint pos); + + void unset_data(); + void use_as_data(); + void create_directory(); + void open_file(); + + void treeChanged(); + + void on_cancelButton_clicked(); + + void on_okButton_clicked(); + +private: + Ui::InstallDialog *ui; + + DirectoryTree *m_DataTree; + + ArchiveTree *m_Tree; + QLabel *m_ProblemLabel; + QTreeWidgetItem *m_TreeRoot; + QTreeWidgetItem *m_DataRoot; + QTreeWidgetItem *m_TreeSelection; + bool m_Updating; + +}; + +#endif // INSTALLDIALOG_H -- cgit v1.3.1