Merge branch 'PrismLauncher:develop' into develop
This commit is contained in:
commit
f3b29d67f4
@ -187,7 +187,7 @@ bool copy::operator()(const QString& offset)
|
|||||||
// blacklisted paths, so we iterate over the source directory, and if there's no blacklist
|
// blacklisted paths, so we iterate over the source directory, and if there's no blacklist
|
||||||
// match, we copy the file.
|
// match, we copy the file.
|
||||||
QDir src_dir(src);
|
QDir src_dir(src);
|
||||||
QDirIterator source_it(src, QDir::Filter::Files, QDirIterator::Subdirectories);
|
QDirIterator source_it(src, QDir::Filter::Files | QDir::Filter::Hidden, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
while (source_it.hasNext()) {
|
while (source_it.hasNext()) {
|
||||||
auto src_path = source_it.next();
|
auto src_path = source_it.next();
|
||||||
|
@ -28,31 +28,38 @@ struct RuntimeContext {
|
|||||||
QString javaPath;
|
QString javaPath;
|
||||||
QString system;
|
QString system;
|
||||||
|
|
||||||
QString mappedJavaRealArchitecture() const {
|
QString mappedJavaRealArchitecture() const
|
||||||
if (javaRealArchitecture == "aarch64") {
|
{
|
||||||
|
if (javaRealArchitecture == "amd64")
|
||||||
|
return "x86_64";
|
||||||
|
if (javaRealArchitecture == "i386" || javaRealArchitecture == "i686")
|
||||||
|
return "x86";
|
||||||
|
if (javaRealArchitecture == "aarch64")
|
||||||
return "arm64";
|
return "arm64";
|
||||||
}
|
if (javaRealArchitecture == "arm" || javaRealArchitecture == "armhf")
|
||||||
|
return "arm32";
|
||||||
return javaRealArchitecture;
|
return javaRealArchitecture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFromInstanceSettings(SettingsObjectPtr instanceSettings) {
|
void updateFromInstanceSettings(SettingsObjectPtr instanceSettings)
|
||||||
|
{
|
||||||
javaArchitecture = instanceSettings->get("JavaArchitecture").toString();
|
javaArchitecture = instanceSettings->get("JavaArchitecture").toString();
|
||||||
javaRealArchitecture = instanceSettings->get("JavaRealArchitecture").toString();
|
javaRealArchitecture = instanceSettings->get("JavaRealArchitecture").toString();
|
||||||
javaPath = instanceSettings->get("JavaPath").toString();
|
javaPath = instanceSettings->get("JavaPath").toString();
|
||||||
system = currentSystem();
|
system = currentSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getClassifier() const {
|
QString getClassifier() const { return system + "-" + mappedJavaRealArchitecture(); }
|
||||||
return system + "-" + mappedJavaRealArchitecture();
|
|
||||||
}
|
|
||||||
|
|
||||||
// "Legacy" refers to the fact that Mojang assumed that these are the only two architectures
|
// "Legacy" refers to the fact that Mojang assumed that these are the only two architectures
|
||||||
bool isLegacyArch() const {
|
bool isLegacyArch() const
|
||||||
QSet<QString> legacyArchitectures{"amd64", "x86_64", "i386", "i686", "x86"};
|
{
|
||||||
return legacyArchitectures.contains(mappedJavaRealArchitecture());
|
const QString mapped = mappedJavaRealArchitecture();
|
||||||
|
return mapped == "x86_64" || mapped == "x86";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool classifierMatches(QString target) const {
|
bool classifierMatches(QString target) const
|
||||||
|
{
|
||||||
// try to match precise classifier "[os]-[arch]"
|
// try to match precise classifier "[os]-[arch]"
|
||||||
bool x = target == getClassifier();
|
bool x = target == getClassifier();
|
||||||
// try to match imprecise classifier on legacy architectures "[os]"
|
// try to match imprecise classifier on legacy architectures "[os]"
|
||||||
@ -62,7 +69,8 @@ struct RuntimeContext {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString currentSystem() {
|
static QString currentSystem()
|
||||||
|
{
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
return "linux";
|
return "linux";
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
|
@ -162,6 +162,18 @@ auto HttpMetaCache::evictEntry(MetaEntryPtr entry) -> bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HttpMetaCache::evictAll()
|
||||||
|
{
|
||||||
|
for (QString& base : m_entries.keys()) {
|
||||||
|
EntryMap& map = m_entries[base];
|
||||||
|
qDebug() << "Evicting base" << base;
|
||||||
|
for (MetaEntryPtr entry : map.entry_list) {
|
||||||
|
if (!evictEntry(entry))
|
||||||
|
qWarning() << "Unexpected missing cache entry" << entry->basePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto HttpMetaCache::staleEntry(QString base, QString resource_path) -> MetaEntryPtr
|
auto HttpMetaCache::staleEntry(QString base, QString resource_path) -> MetaEntryPtr
|
||||||
{
|
{
|
||||||
auto foo = new MetaEntry();
|
auto foo = new MetaEntry();
|
||||||
|
@ -113,6 +113,7 @@ class HttpMetaCache : public QObject {
|
|||||||
|
|
||||||
// evict selected entry from cache
|
// evict selected entry from cache
|
||||||
auto evictEntry(MetaEntryPtr entry) -> bool;
|
auto evictEntry(MetaEntryPtr entry) -> bool;
|
||||||
|
void evictAll();
|
||||||
|
|
||||||
void addBase(QString base, QString base_root);
|
void addBase(QString base, QString base_root);
|
||||||
|
|
||||||
|
@ -229,19 +229,13 @@ public:
|
|||||||
TranslatedAction actionRenameInstance;
|
TranslatedAction actionRenameInstance;
|
||||||
TranslatedAction actionChangeInstGroup;
|
TranslatedAction actionChangeInstGroup;
|
||||||
TranslatedAction actionChangeInstIcon;
|
TranslatedAction actionChangeInstIcon;
|
||||||
TranslatedAction actionEditInstNotes;
|
|
||||||
TranslatedAction actionEditInstance;
|
TranslatedAction actionEditInstance;
|
||||||
TranslatedAction actionWorlds;
|
|
||||||
TranslatedAction actionMods;
|
|
||||||
TranslatedAction actionViewSelectedInstFolder;
|
TranslatedAction actionViewSelectedInstFolder;
|
||||||
TranslatedAction actionViewSelectedMCFolder;
|
|
||||||
TranslatedAction actionDeleteInstance;
|
TranslatedAction actionDeleteInstance;
|
||||||
TranslatedAction actionConfig_Folder;
|
|
||||||
TranslatedAction actionCAT;
|
TranslatedAction actionCAT;
|
||||||
TranslatedAction actionCopyInstance;
|
TranslatedAction actionCopyInstance;
|
||||||
TranslatedAction actionLaunchInstanceOffline;
|
TranslatedAction actionLaunchInstanceOffline;
|
||||||
TranslatedAction actionLaunchInstanceDemo;
|
TranslatedAction actionLaunchInstanceDemo;
|
||||||
TranslatedAction actionScreenshots;
|
|
||||||
TranslatedAction actionExportInstance;
|
TranslatedAction actionExportInstance;
|
||||||
QVector<TranslatedAction *> all_actions;
|
QVector<TranslatedAction *> all_actions;
|
||||||
|
|
||||||
@ -258,6 +252,7 @@ public:
|
|||||||
|
|
||||||
QMenu * helpMenu = nullptr;
|
QMenu * helpMenu = nullptr;
|
||||||
TranslatedToolButton helpMenuButton;
|
TranslatedToolButton helpMenuButton;
|
||||||
|
TranslatedAction actionClearMetadata;
|
||||||
TranslatedAction actionReportBug;
|
TranslatedAction actionReportBug;
|
||||||
TranslatedAction actionDISCORD;
|
TranslatedAction actionDISCORD;
|
||||||
TranslatedAction actionMATRIX;
|
TranslatedAction actionMATRIX;
|
||||||
@ -347,6 +342,13 @@ public:
|
|||||||
actionUndoTrashInstance->setShortcut(QKeySequence("Ctrl+Z"));
|
actionUndoTrashInstance->setShortcut(QKeySequence("Ctrl+Z"));
|
||||||
all_actions.append(&actionUndoTrashInstance);
|
all_actions.append(&actionUndoTrashInstance);
|
||||||
|
|
||||||
|
actionClearMetadata = TranslatedAction(MainWindow);
|
||||||
|
actionClearMetadata->setObjectName(QStringLiteral("actionClearMetadata"));
|
||||||
|
actionClearMetadata->setIcon(APPLICATION->getThemedIcon("refresh"));
|
||||||
|
actionClearMetadata.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Clear Metadata Cache"));
|
||||||
|
actionClearMetadata.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Clear cached metadata"));
|
||||||
|
all_actions.append(&actionClearMetadata);
|
||||||
|
|
||||||
if (!BuildConfig.BUG_TRACKER_URL.isEmpty()) {
|
if (!BuildConfig.BUG_TRACKER_URL.isEmpty()) {
|
||||||
actionReportBug = TranslatedAction(MainWindow);
|
actionReportBug = TranslatedAction(MainWindow);
|
||||||
actionReportBug->setObjectName(QStringLiteral("actionReportBug"));
|
actionReportBug->setObjectName(QStringLiteral("actionReportBug"));
|
||||||
@ -445,6 +447,8 @@ public:
|
|||||||
helpMenu = new QMenu(MainWindow);
|
helpMenu = new QMenu(MainWindow);
|
||||||
helpMenu->setToolTipsVisible(true);
|
helpMenu->setToolTipsVisible(true);
|
||||||
|
|
||||||
|
helpMenu->addAction(actionClearMetadata);
|
||||||
|
|
||||||
if (!BuildConfig.BUG_TRACKER_URL.isEmpty()) {
|
if (!BuildConfig.BUG_TRACKER_URL.isEmpty()) {
|
||||||
helpMenu->addAction(actionReportBug);
|
helpMenu->addAction(actionReportBug);
|
||||||
}
|
}
|
||||||
@ -505,16 +509,8 @@ public:
|
|||||||
fileMenu->addAction(actionCloseWindow);
|
fileMenu->addAction(actionCloseWindow);
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
fileMenu->addAction(actionEditInstance);
|
fileMenu->addAction(actionEditInstance);
|
||||||
fileMenu->addAction(actionEditInstNotes);
|
|
||||||
fileMenu->addAction(actionMods);
|
|
||||||
fileMenu->addAction(actionWorlds);
|
|
||||||
fileMenu->addAction(actionScreenshots);
|
|
||||||
fileMenu->addAction(actionChangeInstGroup);
|
fileMenu->addAction(actionChangeInstGroup);
|
||||||
fileMenu->addSeparator();
|
|
||||||
fileMenu->addAction(actionViewSelectedMCFolder);
|
|
||||||
fileMenu->addAction(actionConfig_Folder);
|
|
||||||
fileMenu->addAction(actionViewSelectedInstFolder);
|
fileMenu->addAction(actionViewSelectedInstFolder);
|
||||||
fileMenu->addSeparator();
|
|
||||||
fileMenu->addAction(actionExportInstance);
|
fileMenu->addAction(actionExportInstance);
|
||||||
fileMenu->addAction(actionDeleteInstance);
|
fileMenu->addAction(actionDeleteInstance);
|
||||||
fileMenu->addAction(actionCopyInstance);
|
fileMenu->addAction(actionCopyInstance);
|
||||||
@ -537,6 +533,8 @@ public:
|
|||||||
|
|
||||||
helpMenu = menuBar->addMenu(tr("&Help"));
|
helpMenu = menuBar->addMenu(tr("&Help"));
|
||||||
helpMenu->setSeparatorsCollapsible(false);
|
helpMenu->setSeparatorsCollapsible(false);
|
||||||
|
helpMenu->addAction(actionClearMetadata);
|
||||||
|
helpMenu->addSeparator();
|
||||||
helpMenu->addAction(actionAbout);
|
helpMenu->addAction(actionAbout);
|
||||||
helpMenu->addAction(actionOpenWiki);
|
helpMenu->addAction(actionOpenWiki);
|
||||||
helpMenu->addAction(actionNewsMenuBar);
|
helpMenu->addAction(actionNewsMenuBar);
|
||||||
@ -586,13 +584,7 @@ public:
|
|||||||
void setInstanceActionsEnabled(bool enabled)
|
void setInstanceActionsEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
actionEditInstance->setEnabled(enabled);
|
actionEditInstance->setEnabled(enabled);
|
||||||
actionEditInstNotes->setEnabled(enabled);
|
|
||||||
actionMods->setEnabled(enabled);
|
|
||||||
actionWorlds->setEnabled(enabled);
|
|
||||||
actionScreenshots->setEnabled(enabled);
|
|
||||||
actionChangeInstGroup->setEnabled(enabled);
|
actionChangeInstGroup->setEnabled(enabled);
|
||||||
actionViewSelectedMCFolder->setEnabled(enabled);
|
|
||||||
actionConfig_Folder->setEnabled(enabled);
|
|
||||||
actionViewSelectedInstFolder->setEnabled(enabled);
|
actionViewSelectedInstFolder->setEnabled(enabled);
|
||||||
actionExportInstance->setEnabled(enabled);
|
actionExportInstance->setEnabled(enabled);
|
||||||
actionDeleteInstance->setEnabled(enabled);
|
actionDeleteInstance->setEnabled(enabled);
|
||||||
@ -687,35 +679,11 @@ public:
|
|||||||
|
|
||||||
actionEditInstance = TranslatedAction(MainWindow);
|
actionEditInstance = TranslatedAction(MainWindow);
|
||||||
actionEditInstance->setObjectName(QStringLiteral("actionEditInstance"));
|
actionEditInstance->setObjectName(QStringLiteral("actionEditInstance"));
|
||||||
actionEditInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Edit Inst&ance..."));
|
actionEditInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Edit..."));
|
||||||
actionEditInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the instance settings, mods and versions."));
|
actionEditInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the instance settings, mods and versions."));
|
||||||
actionEditInstance->setShortcut(QKeySequence(tr("Ctrl+I")));
|
actionEditInstance->setShortcut(QKeySequence(tr("Ctrl+I")));
|
||||||
all_actions.append(&actionEditInstance);
|
all_actions.append(&actionEditInstance);
|
||||||
|
|
||||||
actionEditInstNotes = TranslatedAction(MainWindow);
|
|
||||||
actionEditInstNotes->setObjectName(QStringLiteral("actionEditInstNotes"));
|
|
||||||
actionEditInstNotes.setTextId(QT_TRANSLATE_NOOP("MainWindow", "E&dit Notes..."));
|
|
||||||
actionEditInstNotes.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Edit the notes for the selected instance."));
|
|
||||||
all_actions.append(&actionEditInstNotes);
|
|
||||||
|
|
||||||
actionMods = TranslatedAction(MainWindow);
|
|
||||||
actionMods->setObjectName(QStringLiteral("actionMods"));
|
|
||||||
actionMods.setTextId(QT_TRANSLATE_NOOP("MainWindow", "View &Mods"));
|
|
||||||
actionMods.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "View the mods of this instance."));
|
|
||||||
all_actions.append(&actionMods);
|
|
||||||
|
|
||||||
actionWorlds = TranslatedAction(MainWindow);
|
|
||||||
actionWorlds->setObjectName(QStringLiteral("actionWorlds"));
|
|
||||||
actionWorlds.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&View Worlds"));
|
|
||||||
actionWorlds.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "View the worlds of this instance."));
|
|
||||||
all_actions.append(&actionWorlds);
|
|
||||||
|
|
||||||
actionScreenshots = TranslatedAction(MainWindow);
|
|
||||||
actionScreenshots->setObjectName(QStringLiteral("actionScreenshots"));
|
|
||||||
actionScreenshots.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Manage &Screenshots"));
|
|
||||||
actionScreenshots.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "View and upload screenshots for this instance."));
|
|
||||||
all_actions.append(&actionScreenshots);
|
|
||||||
|
|
||||||
actionChangeInstGroup = TranslatedAction(MainWindow);
|
actionChangeInstGroup = TranslatedAction(MainWindow);
|
||||||
actionChangeInstGroup->setObjectName(QStringLiteral("actionChangeInstGroup"));
|
actionChangeInstGroup->setObjectName(QStringLiteral("actionChangeInstGroup"));
|
||||||
actionChangeInstGroup.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Change Group..."));
|
actionChangeInstGroup.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Change Group..."));
|
||||||
@ -723,38 +691,22 @@ public:
|
|||||||
actionChangeInstGroup->setShortcut(QKeySequence(tr("Ctrl+G")));
|
actionChangeInstGroup->setShortcut(QKeySequence(tr("Ctrl+G")));
|
||||||
all_actions.append(&actionChangeInstGroup);
|
all_actions.append(&actionChangeInstGroup);
|
||||||
|
|
||||||
actionViewSelectedMCFolder = TranslatedAction(MainWindow);
|
|
||||||
actionViewSelectedMCFolder->setObjectName(QStringLiteral("actionViewSelectedMCFolder"));
|
|
||||||
actionViewSelectedMCFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Minec&raft Folder"));
|
|
||||||
actionViewSelectedMCFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's Minecraft folder in a file browser."));
|
|
||||||
actionViewSelectedMCFolder->setShortcut(QKeySequence(tr("Ctrl+M")));
|
|
||||||
all_actions.append(&actionViewSelectedMCFolder);
|
|
||||||
|
|
||||||
actionConfig_Folder = TranslatedAction(MainWindow);
|
|
||||||
actionConfig_Folder->setObjectName(QStringLiteral("actionConfig_Folder"));
|
|
||||||
actionConfig_Folder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Confi&g Folder"));
|
|
||||||
actionConfig_Folder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the instance's config folder."));
|
|
||||||
// Qt on macOS is "smart" and will eat up this action when added to the menu bar because it starts with the word "config"...
|
|
||||||
// Docs: https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar
|
|
||||||
actionConfig_Folder->setMenuRole(QAction::NoRole);
|
|
||||||
all_actions.append(&actionConfig_Folder);
|
|
||||||
|
|
||||||
actionViewSelectedInstFolder = TranslatedAction(MainWindow);
|
actionViewSelectedInstFolder = TranslatedAction(MainWindow);
|
||||||
actionViewSelectedInstFolder->setObjectName(QStringLiteral("actionViewSelectedInstFolder"));
|
actionViewSelectedInstFolder->setObjectName(QStringLiteral("actionViewSelectedInstFolder"));
|
||||||
actionViewSelectedInstFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Instance Folder"));
|
actionViewSelectedInstFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Folder"));
|
||||||
actionViewSelectedInstFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's root folder in a file browser."));
|
actionViewSelectedInstFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's root folder in a file browser."));
|
||||||
all_actions.append(&actionViewSelectedInstFolder);
|
all_actions.append(&actionViewSelectedInstFolder);
|
||||||
|
|
||||||
actionExportInstance = TranslatedAction(MainWindow);
|
actionExportInstance = TranslatedAction(MainWindow);
|
||||||
actionExportInstance->setObjectName(QStringLiteral("actionExportInstance"));
|
actionExportInstance->setObjectName(QStringLiteral("actionExportInstance"));
|
||||||
actionExportInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "E&xport Instance..."));
|
actionExportInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "E&xport..."));
|
||||||
actionExportInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Export the selected instance as a zip file."));
|
actionExportInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Export the selected instance as a zip file."));
|
||||||
actionExportInstance->setShortcut(QKeySequence(tr("Ctrl+E")));
|
actionExportInstance->setShortcut(QKeySequence(tr("Ctrl+E")));
|
||||||
all_actions.append(&actionExportInstance);
|
all_actions.append(&actionExportInstance);
|
||||||
|
|
||||||
actionDeleteInstance = TranslatedAction(MainWindow);
|
actionDeleteInstance = TranslatedAction(MainWindow);
|
||||||
actionDeleteInstance->setObjectName(QStringLiteral("actionDeleteInstance"));
|
actionDeleteInstance->setObjectName(QStringLiteral("actionDeleteInstance"));
|
||||||
actionDeleteInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Dele&te Instance"));
|
actionDeleteInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Dele&te"));
|
||||||
actionDeleteInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Delete the selected instance."));
|
actionDeleteInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Delete the selected instance."));
|
||||||
actionDeleteInstance->setShortcuts({QKeySequence(tr("Backspace")), QKeySequence::Delete});
|
actionDeleteInstance->setShortcuts({QKeySequence(tr("Backspace")), QKeySequence::Delete});
|
||||||
actionDeleteInstance->setAutoRepeat(false);
|
actionDeleteInstance->setAutoRepeat(false);
|
||||||
@ -763,7 +715,7 @@ public:
|
|||||||
actionCopyInstance = TranslatedAction(MainWindow);
|
actionCopyInstance = TranslatedAction(MainWindow);
|
||||||
actionCopyInstance->setObjectName(QStringLiteral("actionCopyInstance"));
|
actionCopyInstance->setObjectName(QStringLiteral("actionCopyInstance"));
|
||||||
actionCopyInstance->setIcon(APPLICATION->getThemedIcon("copy"));
|
actionCopyInstance->setIcon(APPLICATION->getThemedIcon("copy"));
|
||||||
actionCopyInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Cop&y Instance..."));
|
actionCopyInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Cop&y..."));
|
||||||
actionCopyInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Copy the selected instance."));
|
actionCopyInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Copy the selected instance."));
|
||||||
actionCopyInstance->setShortcut(QKeySequence(tr("Ctrl+D")));
|
actionCopyInstance->setShortcut(QKeySequence(tr("Ctrl+D")));
|
||||||
all_actions.append(&actionCopyInstance);
|
all_actions.append(&actionCopyInstance);
|
||||||
@ -797,20 +749,10 @@ public:
|
|||||||
instanceToolBar->addSeparator();
|
instanceToolBar->addSeparator();
|
||||||
|
|
||||||
instanceToolBar->addAction(actionEditInstance);
|
instanceToolBar->addAction(actionEditInstance);
|
||||||
instanceToolBar->addAction(actionEditInstNotes);
|
|
||||||
instanceToolBar->addAction(actionMods);
|
|
||||||
instanceToolBar->addAction(actionWorlds);
|
|
||||||
instanceToolBar->addAction(actionScreenshots);
|
|
||||||
instanceToolBar->addAction(actionChangeInstGroup);
|
instanceToolBar->addAction(actionChangeInstGroup);
|
||||||
|
|
||||||
instanceToolBar->addSeparator();
|
|
||||||
|
|
||||||
instanceToolBar->addAction(actionViewSelectedMCFolder);
|
|
||||||
instanceToolBar->addAction(actionConfig_Folder);
|
|
||||||
instanceToolBar->addAction(actionViewSelectedInstFolder);
|
instanceToolBar->addAction(actionViewSelectedInstFolder);
|
||||||
|
|
||||||
instanceToolBar->addSeparator();
|
|
||||||
|
|
||||||
instanceToolBar->addAction(actionExportInstance);
|
instanceToolBar->addAction(actionExportInstance);
|
||||||
instanceToolBar->addAction(actionDeleteInstance);
|
instanceToolBar->addAction(actionDeleteInstance);
|
||||||
instanceToolBar->addAction(actionCopyInstance);
|
instanceToolBar->addAction(actionCopyInstance);
|
||||||
@ -1890,15 +1832,6 @@ void MainWindow::on_actionViewCentralModsFolder_triggered()
|
|||||||
DesktopServices::openDirectory(APPLICATION->settings()->get("CentralModsDir").toString(), true);
|
DesktopServices::openDirectory(APPLICATION->settings()->get("CentralModsDir").toString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionConfig_Folder_triggered()
|
|
||||||
{
|
|
||||||
if (m_selectedInstance)
|
|
||||||
{
|
|
||||||
QString str = m_selectedInstance->instanceConfigFolder();
|
|
||||||
DesktopServices::openDirectory(QDir(str).absolutePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::checkForUpdates()
|
void MainWindow::checkForUpdates()
|
||||||
{
|
{
|
||||||
if(BuildConfig.UPDATER_ENABLED)
|
if(BuildConfig.UPDATER_ENABLED)
|
||||||
@ -1932,31 +1865,11 @@ void MainWindow::globalSettingsClosed()
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionEditInstNotes_triggered()
|
|
||||||
{
|
|
||||||
APPLICATION->showInstanceWindow(m_selectedInstance, "notes");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionWorlds_triggered()
|
|
||||||
{
|
|
||||||
APPLICATION->showInstanceWindow(m_selectedInstance, "worlds");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionMods_triggered()
|
|
||||||
{
|
|
||||||
APPLICATION->showInstanceWindow(m_selectedInstance, "mods");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionEditInstance_triggered()
|
void MainWindow::on_actionEditInstance_triggered()
|
||||||
{
|
{
|
||||||
APPLICATION->showInstanceWindow(m_selectedInstance);
|
APPLICATION->showInstanceWindow(m_selectedInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionScreenshots_triggered()
|
|
||||||
{
|
|
||||||
APPLICATION->showInstanceWindow(m_selectedInstance, "screenshots");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionManageAccounts_triggered()
|
void MainWindow::on_actionManageAccounts_triggered()
|
||||||
{
|
{
|
||||||
APPLICATION->ShowGlobalSettings(this, "accounts");
|
APPLICATION->ShowGlobalSettings(this, "accounts");
|
||||||
@ -1967,6 +1880,11 @@ void MainWindow::on_actionReportBug_triggered()
|
|||||||
DesktopServices::openUrl(QUrl(BuildConfig.BUG_TRACKER_URL));
|
DesktopServices::openUrl(QUrl(BuildConfig.BUG_TRACKER_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionClearMetadata_triggered()
|
||||||
|
{
|
||||||
|
APPLICATION->metacache()->evictAll();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionOpenWiki_triggered()
|
void MainWindow::on_actionOpenWiki_triggered()
|
||||||
{
|
{
|
||||||
DesktopServices::openUrl(QUrl(BuildConfig.HELP_URL.arg("")));
|
DesktopServices::openUrl(QUrl(BuildConfig.HELP_URL.arg("")));
|
||||||
@ -2045,20 +1963,6 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionViewSelectedMCFolder_triggered()
|
|
||||||
{
|
|
||||||
if (m_selectedInstance)
|
|
||||||
{
|
|
||||||
QString str = m_selectedInstance->gameRoot();
|
|
||||||
if (!FS::ensureFilePathExists(str))
|
|
||||||
{
|
|
||||||
// TODO: report error
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopServices::openDirectory(QDir(str).absolutePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// Save the window state and geometry.
|
// Save the window state and geometry.
|
||||||
|
@ -112,12 +112,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionViewInstanceFolder_triggered();
|
void on_actionViewInstanceFolder_triggered();
|
||||||
|
|
||||||
void on_actionConfig_Folder_triggered();
|
|
||||||
|
|
||||||
void on_actionViewSelectedInstFolder_triggered();
|
void on_actionViewSelectedInstFolder_triggered();
|
||||||
|
|
||||||
void on_actionViewSelectedMCFolder_triggered();
|
|
||||||
|
|
||||||
void refreshInstances();
|
void refreshInstances();
|
||||||
|
|
||||||
void on_actionViewCentralModsFolder_triggered();
|
void on_actionViewCentralModsFolder_triggered();
|
||||||
@ -130,6 +126,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionReportBug_triggered();
|
void on_actionReportBug_triggered();
|
||||||
|
|
||||||
|
void on_actionClearMetadata_triggered();
|
||||||
|
|
||||||
void on_actionOpenWiki_triggered();
|
void on_actionOpenWiki_triggered();
|
||||||
|
|
||||||
void on_actionMoreNews_triggered();
|
void on_actionMoreNews_triggered();
|
||||||
@ -159,14 +157,6 @@ private slots:
|
|||||||
|
|
||||||
void on_actionEditInstance_triggered();
|
void on_actionEditInstance_triggered();
|
||||||
|
|
||||||
void on_actionEditInstNotes_triggered();
|
|
||||||
|
|
||||||
void on_actionMods_triggered();
|
|
||||||
|
|
||||||
void on_actionWorlds_triggered();
|
|
||||||
|
|
||||||
void on_actionScreenshots_triggered();
|
|
||||||
|
|
||||||
void taskEnd();
|
void taskEnd();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,6 +147,42 @@ slots:
|
|||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_copy_with_dot_hidden()
|
||||||
|
{
|
||||||
|
QString folder = QFINDTESTDATA("testdata/FileSystem/test_folder");
|
||||||
|
auto f = [&folder]()
|
||||||
|
{
|
||||||
|
QTemporaryDir tempDir;
|
||||||
|
tempDir.setAutoRemove(true);
|
||||||
|
qDebug() << "From:" << folder << "To:" << tempDir.path();
|
||||||
|
|
||||||
|
QDir target_dir(FS::PathCombine(tempDir.path(), "test_folder"));
|
||||||
|
qDebug() << tempDir.path();
|
||||||
|
qDebug() << target_dir.path();
|
||||||
|
FS::copy c(folder, target_dir.path());
|
||||||
|
c();
|
||||||
|
|
||||||
|
auto filter = QDir::Filter::Files | QDir::Filter::Dirs | QDir::Filter::Hidden;
|
||||||
|
|
||||||
|
for (auto entry: target_dir.entryList(filter)) {
|
||||||
|
qDebug() << entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVERIFY(target_dir.entryList(filter).contains(".secret_folder"));
|
||||||
|
target_dir.cd(".secret_folder");
|
||||||
|
QVERIFY(target_dir.entryList(filter).contains(".secret_file.txt"));
|
||||||
|
};
|
||||||
|
|
||||||
|
// first try variant without trailing /
|
||||||
|
QVERIFY(!folder.endsWith('/'));
|
||||||
|
f();
|
||||||
|
|
||||||
|
// then variant with trailing /
|
||||||
|
folder.append('/');
|
||||||
|
QVERIFY(folder.endsWith('/'));
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
|
||||||
void test_getDesktop()
|
void test_getDesktop()
|
||||||
{
|
{
|
||||||
QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
||||||
|
1
tests/testdata/FileSystem/test_folder/.secret_folder/.secret_file.txt
vendored
Normal file
1
tests/testdata/FileSystem/test_folder/.secret_folder/.secret_file.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
oooooo spooky easter egg :oo
|
Loading…
Reference in New Issue
Block a user