mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-29 21:30:18 +02:00
Add stubs and b asic integration with MainWindow
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
0a5013ff9f
commit
ea8f105292
@ -110,7 +110,6 @@
|
|||||||
#include "ui/widgets/LabeledToolButton.h"
|
#include "ui/widgets/LabeledToolButton.h"
|
||||||
|
|
||||||
#include "minecraft/PackProfile.h"
|
#include "minecraft/PackProfile.h"
|
||||||
#include "minecraft/ShortcutUtils.h"
|
|
||||||
#include "minecraft/VersionFile.h"
|
#include "minecraft/VersionFile.h"
|
||||||
#include "minecraft/WorldList.h"
|
#include "minecraft/WorldList.h"
|
||||||
#include "minecraft/mod/ModFolderModel.h"
|
#include "minecraft/mod/ModFolderModel.h"
|
||||||
@ -209,26 +208,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
exportInstanceMenu->addAction(ui->actionExportInstanceMrPack);
|
exportInstanceMenu->addAction(ui->actionExportInstanceMrPack);
|
||||||
exportInstanceMenu->addAction(ui->actionExportInstanceFlamePack);
|
exportInstanceMenu->addAction(ui->actionExportInstanceFlamePack);
|
||||||
ui->actionExportInstance->setMenu(exportInstanceMenu);
|
ui->actionExportInstance->setMenu(exportInstanceMenu);
|
||||||
|
|
||||||
QList<QAction*> shortcutActions = { ui->actionCreateInstanceShortcutOther };
|
|
||||||
if (!DesktopServices::isFlatpak()) {
|
|
||||||
QString desktopDir = FS::getDesktopDir();
|
|
||||||
QString applicationDir = FS::getApplicationsDir();
|
|
||||||
|
|
||||||
if (!applicationDir.isEmpty())
|
|
||||||
shortcutActions.push_front(ui->actionCreateInstanceShortcutApplications);
|
|
||||||
|
|
||||||
if (!desktopDir.isEmpty())
|
|
||||||
shortcutActions.push_front(ui->actionCreateInstanceShortcutDesktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shortcutActions.length() > 1) {
|
|
||||||
auto shortcutInstanceMenu = new QMenu(this);
|
|
||||||
|
|
||||||
for (auto action : shortcutActions)
|
|
||||||
shortcutInstanceMenu->addAction(action);
|
|
||||||
ui->actionCreateInstanceShortcut->setMenu(shortcutInstanceMenu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide, disable and show stuff
|
// hide, disable and show stuff
|
||||||
@ -1552,25 +1531,10 @@ void MainWindow::on_actionCreateInstanceShortcut_triggered()
|
|||||||
if (!m_selectedInstance)
|
if (!m_selectedInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (DesktopServices::isFlatpak())
|
CreateShortcutDialog shortcutDlg(m_selectedInstance, this);
|
||||||
on_actionCreateInstanceShortcutOther_triggered();
|
if (!shortcutDlg.exec())
|
||||||
else
|
return;
|
||||||
on_actionCreateInstanceShortcutDesktop_triggered();
|
shortcutDlg.createShortcut();
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionCreateInstanceShortcutDesktop_triggered()
|
|
||||||
{
|
|
||||||
ShortcutUtils::createInstanceShortcutOnDesktop({ m_selectedInstance.get(), m_selectedInstance->name(), tr("instance"), this });
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionCreateInstanceShortcutApplications_triggered()
|
|
||||||
{
|
|
||||||
ShortcutUtils::createInstanceShortcutInApplications({ m_selectedInstance.get(), m_selectedInstance->name(), tr("instance"), this });
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionCreateInstanceShortcutOther_triggered()
|
|
||||||
{
|
|
||||||
ShortcutUtils::createInstanceShortcutInOther({ m_selectedInstance.get(), m_selectedInstance->name(), tr("instance"), this });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::taskEnd()
|
void MainWindow::taskEnd()
|
||||||
|
@ -166,9 +166,6 @@ class MainWindow : public QMainWindow {
|
|||||||
void on_actionEditInstance_triggered();
|
void on_actionEditInstance_triggered();
|
||||||
|
|
||||||
void on_actionCreateInstanceShortcut_triggered();
|
void on_actionCreateInstanceShortcut_triggered();
|
||||||
void on_actionCreateInstanceShortcutDesktop_triggered();
|
|
||||||
void on_actionCreateInstanceShortcutApplications_triggered();
|
|
||||||
void on_actionCreateInstanceShortcutOther_triggered();
|
|
||||||
|
|
||||||
void taskEnd();
|
void taskEnd();
|
||||||
|
|
||||||
|
@ -771,39 +771,6 @@
|
|||||||
<string>Open the Java folder in a file browser. Only available if the built-in Java downloader is used.</string>
|
<string>Open the Java folder in a file browser. Only available if the built-in Java downloader is used.</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionCreateInstanceShortcutDesktop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Desktop</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Creates a shortcut to this instance on your desktop</string>
|
|
||||||
</property>
|
|
||||||
<property name="menuRole">
|
|
||||||
<enum>QAction::TextHeuristicRole</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionCreateInstanceShortcutApplications">
|
|
||||||
<property name="text">
|
|
||||||
<string>Applications</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Create a shortcut of this instance on your start menu</string>
|
|
||||||
</property>
|
|
||||||
<property name="menuRole">
|
|
||||||
<enum>QAction::TextHeuristicRole</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionCreateInstanceShortcutOther">
|
|
||||||
<property name="text">
|
|
||||||
<string>Other...</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Creates a shortcut in a folder selected by you</string>
|
|
||||||
</property>
|
|
||||||
<property name="menuRole">
|
|
||||||
<enum>QAction::TextHeuristicRole</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -50,21 +50,59 @@
|
|||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "InstanceList.h"
|
#include "InstanceList.h"
|
||||||
#include "icons/IconList.h"
|
#include "icons/IconList.h"
|
||||||
|
#include "minecraft/ShortcutUtils.h"
|
||||||
|
|
||||||
CreateShortcutDialog::CreateShortcutDialog(InstancePtr instance, QWidget* parent)
|
CreateShortcutDialog::CreateShortcutDialog(InstancePtr instance, QWidget* parent)
|
||||||
: QDialog(parent), ui(new Ui::CreateShortcutDialog), m_instance(instance)
|
: QDialog(parent), ui(new Ui::CreateShortcutDialog), m_instance(instance)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
resize(minimumSizeHint());
|
|
||||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|
||||||
|
|
||||||
InstIconKey = instance->iconKey();
|
InstIconKey = instance->iconKey();
|
||||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||||
ui->instNameTextBox->setText(instance->name());
|
ui->instNameTextBox->setText(instance->name());
|
||||||
ui->instNameTextBox->setFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateShortcutDialog::~CreateShortcutDialog()
|
CreateShortcutDialog::~CreateShortcutDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_iconButton_clicked()
|
||||||
|
{
|
||||||
|
IconPickerDialog dlg(this);
|
||||||
|
dlg.execWithSelection(InstIconKey);
|
||||||
|
|
||||||
|
if (dlg.result() == QDialog::Accepted) {
|
||||||
|
InstIconKey = dlg.selectedIconKey;
|
||||||
|
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_saveTargetSelectionBox_currentIndexChanged(int index)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_instNameTextBox_textChanged(const QString& arg1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_overrideAccountCheckbox_stateChanged(int state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_accountSelectionBox_currentIndexChanged(int index)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_targetCheckbox_stateChanged(int state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_worldSelectionBox_currentIndexChanged(int index)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::on_serverAddressTextBox_textChanged(const QString& arg1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CreateShortcutDialog::targetChanged()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// Real work
|
||||||
|
void CreateShortcutDialog::createShortcut() const
|
||||||
|
{}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ class CreateShortcutDialog : public QDialog {
|
|||||||
explicit CreateShortcutDialog(InstancePtr instance, QWidget* parent = nullptr);
|
explicit CreateShortcutDialog(InstancePtr instance, QWidget* parent = nullptr);
|
||||||
~CreateShortcutDialog();
|
~CreateShortcutDialog();
|
||||||
|
|
||||||
|
void createShortcut() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// Icon, target and name
|
// Icon, target and name
|
||||||
void on_iconButton_clicked();
|
void on_iconButton_clicked();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user