mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Merge branch 'data_files_menu' into 'master'
Implement a context menu for data directories page Closes #8130 See merge request OpenMW/openmw!4458
This commit is contained in:
commit
cf3badb8a4
10 changed files with 97 additions and 3 deletions
|
@ -275,6 +275,7 @@
|
||||||
Feature #8067: Support Game Mode on macOS
|
Feature #8067: Support Game Mode on macOS
|
||||||
Feature #8078: OpenMW-CS Terrain Equalize Tool
|
Feature #8078: OpenMW-CS Terrain Equalize Tool
|
||||||
Feature #8087: Creature movement flags are not exposed
|
Feature #8087: Creature movement flags are not exposed
|
||||||
|
Feature #8130: Launcher: Add the ability to open a selected data directory in the file browser
|
||||||
Feature #8145: Starter spell flag is not exposed
|
Feature #8145: Starter spell flag is not exposed
|
||||||
Task #5859: User openmw-cs.cfg has comment talking about settings.cfg
|
Task #5859: User openmw-cs.cfg has comment talking about settings.cfg
|
||||||
Task #5896: Do not use deprecated MyGUI properties
|
Task #5896: Do not use deprecated MyGUI properties
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#include "datafilespage.hpp"
|
#include "datafilespage.hpp"
|
||||||
#include "maindialog.hpp"
|
#include "maindialog.hpp"
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -244,6 +246,31 @@ void Launcher::DataFilesPage::buildView()
|
||||||
&DataFilesPage::navMeshToolFinished);
|
&DataFilesPage::navMeshToolFinished);
|
||||||
|
|
||||||
buildArchiveContextMenu();
|
buildArchiveContextMenu();
|
||||||
|
buildDataFilesContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::DataFilesPage::slotCopySelectedItemsPaths()
|
||||||
|
{
|
||||||
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
|
QStringList filepaths;
|
||||||
|
|
||||||
|
for (QListWidgetItem* item : ui.directoryListWidget->selectedItems())
|
||||||
|
{
|
||||||
|
QString path = qvariant_cast<Config::SettingValue>(item->data(Qt::UserRole)).originalRepresentation;
|
||||||
|
filepaths.push_back(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filepaths.isEmpty())
|
||||||
|
{
|
||||||
|
clipboard->setText(filepaths.join("\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::DataFilesPage::slotOpenSelectedItemsPaths()
|
||||||
|
{
|
||||||
|
QListWidgetItem* item = ui.directoryListWidget->currentItem();
|
||||||
|
QUrl confFolderUrl = QUrl::fromLocalFile(qvariant_cast<Config::SettingValue>(item->data(Qt::UserRole)).value);
|
||||||
|
QDesktopServices::openUrl(confFolderUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::buildArchiveContextMenu()
|
void Launcher::DataFilesPage::buildArchiveContextMenu()
|
||||||
|
@ -256,6 +283,18 @@ void Launcher::DataFilesPage::buildArchiveContextMenu()
|
||||||
mArchiveContextMenu->addAction(tr("&Uncheck Selected"), this, SLOT(slotUncheckMultiSelectedItems()));
|
mArchiveContextMenu->addAction(tr("&Uncheck Selected"), this, SLOT(slotUncheckMultiSelectedItems()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Launcher::DataFilesPage::buildDataFilesContextMenu()
|
||||||
|
{
|
||||||
|
connect(ui.directoryListWidget, &QListWidget::customContextMenuRequested, this,
|
||||||
|
&DataFilesPage::slotShowDataFilesContextMenu);
|
||||||
|
|
||||||
|
mDataFilesContextMenu = new QMenu(ui.directoryListWidget);
|
||||||
|
mDataFilesContextMenu->addAction(
|
||||||
|
tr("&Copy Path(s) to Clipboard"), this, &Launcher::DataFilesPage::slotCopySelectedItemsPaths);
|
||||||
|
mDataFilesContextMenu->addAction(
|
||||||
|
tr("&Open Path in File Explorer"), this, &Launcher::DataFilesPage::slotOpenSelectedItemsPaths);
|
||||||
|
}
|
||||||
|
|
||||||
bool Launcher::DataFilesPage::loadSettings()
|
bool Launcher::DataFilesPage::loadSettings()
|
||||||
{
|
{
|
||||||
ui.navMeshMaxSizeSpinBox->setValue(getMaxNavMeshDbFileSizeMiB());
|
ui.navMeshMaxSizeSpinBox->setValue(getMaxNavMeshDbFileSizeMiB());
|
||||||
|
@ -832,6 +871,12 @@ void Launcher::DataFilesPage::slotShowArchiveContextMenu(const QPoint& pos)
|
||||||
mArchiveContextMenu->exec(globalPos);
|
mArchiveContextMenu->exec(globalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Launcher::DataFilesPage::slotShowDataFilesContextMenu(const QPoint& pos)
|
||||||
|
{
|
||||||
|
QPoint globalPos = ui.directoryListWidget->viewport()->mapToGlobal(pos);
|
||||||
|
mDataFilesContextMenu->exec(globalPos);
|
||||||
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::setCheckStateForMultiSelectedItems(bool checked)
|
void Launcher::DataFilesPage::setCheckStateForMultiSelectedItems(bool checked)
|
||||||
{
|
{
|
||||||
Qt::CheckState checkState = checked ? Qt::Checked : Qt::Unchecked;
|
Qt::CheckState checkState = checked ? Qt::Checked : Qt::Unchecked;
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace Launcher
|
||||||
ContentSelectorView::ContentSelector* mSelector;
|
ContentSelectorView::ContentSelector* mSelector;
|
||||||
Ui::DataFilesPage ui;
|
Ui::DataFilesPage ui;
|
||||||
QMenu* mArchiveContextMenu;
|
QMenu* mArchiveContextMenu;
|
||||||
|
QMenu* mDataFilesContextMenu;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DataFilesPage(const Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
explicit DataFilesPage(const Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
||||||
|
@ -79,6 +80,7 @@ namespace Launcher
|
||||||
void moveSources(QListWidget* sourceList, int step);
|
void moveSources(QListWidget* sourceList, int step);
|
||||||
|
|
||||||
void slotShowArchiveContextMenu(const QPoint& pos);
|
void slotShowArchiveContextMenu(const QPoint& pos);
|
||||||
|
void slotShowDataFilesContextMenu(const QPoint& pos);
|
||||||
void slotCheckMultiSelectedItems();
|
void slotCheckMultiSelectedItems();
|
||||||
void slotUncheckMultiSelectedItems();
|
void slotUncheckMultiSelectedItems();
|
||||||
|
|
||||||
|
@ -129,6 +131,7 @@ namespace Launcher
|
||||||
void addArchivesFromDir(const QString& dir);
|
void addArchivesFromDir(const QString& dir);
|
||||||
void buildView();
|
void buildView();
|
||||||
void buildArchiveContextMenu();
|
void buildArchiveContextMenu();
|
||||||
|
void buildDataFilesContextMenu();
|
||||||
void setCheckStateForMultiSelectedItems(bool checked);
|
void setCheckStateForMultiSelectedItems(bool checked);
|
||||||
void setProfile(int index, bool savePrevious);
|
void setProfile(int index, bool savePrevious);
|
||||||
void setProfile(const QString& previous, const QString& current, bool savePrevious);
|
void setProfile(const QString& previous, const QString& current, bool savePrevious);
|
||||||
|
@ -140,6 +143,8 @@ namespace Launcher
|
||||||
void reloadCells(QStringList selectedFiles);
|
void reloadCells(QStringList selectedFiles);
|
||||||
void refreshDataFilesView();
|
void refreshDataFilesView();
|
||||||
void updateNavMeshProgress(int minDataSize);
|
void updateNavMeshProgress(int minDataSize);
|
||||||
|
void slotCopySelectedItemsPaths();
|
||||||
|
void slotOpenSelectedItemsPaths();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file paths of all selected content files
|
* Returns the file paths of all selected content files
|
||||||
|
|
|
@ -58,6 +58,9 @@
|
||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
|
|
|
@ -320,17 +320,17 @@ void ContentSelectorView::ContentSelector::slotCheckMultiSelectedItems()
|
||||||
void ContentSelectorView::ContentSelector::slotCopySelectedItemsPaths()
|
void ContentSelectorView::ContentSelector::slotCopySelectedItemsPaths()
|
||||||
{
|
{
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
QString filepaths;
|
QStringList filepaths;
|
||||||
for (const QModelIndex& index : ui->addonView->selectionModel()->selectedIndexes())
|
for (const QModelIndex& index : ui->addonView->selectionModel()->selectedIndexes())
|
||||||
{
|
{
|
||||||
int row = mAddonProxyModel->mapToSource(index).row();
|
int row = mAddonProxyModel->mapToSource(index).row();
|
||||||
const ContentSelectorModel::EsmFile* file = mContentModel->item(row);
|
const ContentSelectorModel::EsmFile* file = mContentModel->item(row);
|
||||||
filepaths += file->filePath() + "\n";
|
filepaths.push_back(file->filePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filepaths.isEmpty())
|
if (!filepaths.isEmpty())
|
||||||
{
|
{
|
||||||
clipboard->setText(filepaths);
|
clipboard->setText(filepaths.join("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,6 +390,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
|
||||||
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Copy Path(s) to Clipboard</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Open Path in File Explorer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Launcher::GraphicsPage</name>
|
<name>Launcher::GraphicsPage</name>
|
||||||
|
|
|
@ -390,6 +390,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
|
||||||
<source>Delete</source>
|
<source>Delete</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Copy Path(s) to Clipboard</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Open Path in File Explorer</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Launcher::GraphicsPage</name>
|
<name>Launcher::GraphicsPage</name>
|
||||||
|
|
|
@ -390,6 +390,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
|
||||||
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
||||||
<translation>Cette archive est activée dans un fichier openmw.cfg qui n'est pas celui de l'utilisateur.</translation>
|
<translation>Cette archive est activée dans un fichier openmw.cfg qui n'est pas celui de l'utilisateur.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Copy Path(s) to Clipboard</source>
|
||||||
|
<translation>&Copier l'emplacement dans le presse papier</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Open Path in File Explorer</source>
|
||||||
|
<translation>&Ouvrir l'emplacement dans l'explorateur de fichiers</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Launcher::GraphicsPage</name>
|
<name>Launcher::GraphicsPage</name>
|
||||||
|
|
|
@ -392,6 +392,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
|
||||||
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
||||||
<translation>Этот архив включен в openmw.cfg, не являющемся пользовательским</translation>
|
<translation>Этот архив включен в openmw.cfg, не являющемся пользовательским</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Copy Path(s) to Clipboard</source>
|
||||||
|
<translation>&Скопировать пути в буфер обмена</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Open Path in File Explorer</source>
|
||||||
|
<translation>&Открыть путь в диспетчере файлов</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Launcher::GraphicsPage</name>
|
<name>Launcher::GraphicsPage</name>
|
||||||
|
|
|
@ -393,6 +393,14 @@ de ordinarie fonterna i Morrowind. Bocka denna ruta om du ändå föredrar ordin
|
||||||
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
<source>This archive is enabled in an openmw.cfg other than the user one</source>
|
||||||
<translation>Detta arkiv är aktiverat i en annan openmw.cfg än användarens</translation>
|
<translation>Detta arkiv är aktiverat i en annan openmw.cfg än användarens</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Copy Path(s) to Clipboard</source>
|
||||||
|
<translation>&Kopiera sökväg(ar) till klippbordet</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Open Path in File Explorer</source>
|
||||||
|
<translation>Öppna katalogen i filutforskaren</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Launcher::GraphicsPage</name>
|
<name>Launcher::GraphicsPage</name>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue