summaryrefslogtreecommitdiff
path: root/src/modinfodialogfiletree.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-07-02 12:02:07 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-07-02 12:02:07 -0400
commit82d985064e5105ded4b20d357eaf7cd1b97fe9da (patch)
tree2de9879fa59758d057de1bc1b8017846da377421 /src/modinfodialogfiletree.cpp
parentc6e80f1a5eed4a57663e7fc55c2727258eaad552 (diff)
added a ModInfoDialogTabContext to avoid passing too many things to tab constructors
mod is passed to ctors to make sure they can never be empty only call deleteRequest() to selected mod comments
Diffstat (limited to 'src/modinfodialogfiletree.cpp')
-rw-r--r--src/modinfodialogfiletree.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/modinfodialogfiletree.cpp b/src/modinfodialogfiletree.cpp
index 6690dd2f..35480e2c 100644
--- a/src/modinfodialogfiletree.cpp
+++ b/src/modinfodialogfiletree.cpp
@@ -13,10 +13,8 @@ namespace shell = MOBase::shell;
// checking whether menu items apply to them, just show all of them
const int max_scan_for_context_menu = 50;
-FileTreeTab::FileTreeTab(
- OrganizerCore& oc, PluginContainer& plugin,
- QWidget* parent, Ui::ModInfoDialog* ui, int id)
- : ModInfoDialogTab(oc, plugin, parent, ui, id), m_fs(nullptr)
+FileTreeTab::FileTreeTab(ModInfoDialogTabContext cx)
+ : ModInfoDialogTab(std::move(cx)), m_fs(nullptr)
{
m_fs = new QFileSystemModel(this);
m_fs->setReadOnly(false);
@@ -58,7 +56,7 @@ void FileTreeTab::clear()
void FileTreeTab::update()
{
- const auto rootPath = mod()->absolutePath();
+ const auto rootPath = mod().absolutePath();
m_fs->setRootPath(rootPath);
ui->filetree->setRootIndex(m_fs->index(rootPath));
@@ -139,7 +137,7 @@ void FileTreeTab::onPreview()
return;
}
- core().previewFile(parentWidget(), mod()->name(), m_fs->filePath(selection));
+ core().previewFile(parentWidget(), mod().name(), m_fs->filePath(selection));
}
void FileTreeTab::onExplore()
@@ -149,7 +147,7 @@ void FileTreeTab::onExplore()
if (selection.isValid()) {
shell::ExploreFile(m_fs->filePath(selection));
} else {
- shell::ExploreFile(mod()->absolutePath());
+ shell::ExploreFile(mod().absolutePath());
}
}
@@ -205,7 +203,7 @@ void FileTreeTab::onUnhide()
void FileTreeTab::onOpenInExplorer()
{
- shell::ExploreFile(mod()->absolutePath());
+ shell::ExploreFile(mod().absolutePath());
}
bool FileTreeTab::deleteFile(const QModelIndex& index)