mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-28 12:50:20 +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 "minecraft/PackProfile.h"
|
||||
#include "minecraft/ShortcutUtils.h"
|
||||
#include "minecraft/VersionFile.h"
|
||||
#include "minecraft/WorldList.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->actionExportInstanceFlamePack);
|
||||
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
|
||||
@ -1552,25 +1531,10 @@ void MainWindow::on_actionCreateInstanceShortcut_triggered()
|
||||
if (!m_selectedInstance)
|
||||
return;
|
||||
|
||||
if (DesktopServices::isFlatpak())
|
||||
on_actionCreateInstanceShortcutOther_triggered();
|
||||
else
|
||||
on_actionCreateInstanceShortcutDesktop_triggered();
|
||||
}
|
||||
|
||||
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 });
|
||||
CreateShortcutDialog shortcutDlg(m_selectedInstance, this);
|
||||
if (!shortcutDlg.exec())
|
||||
return;
|
||||
shortcutDlg.createShortcut();
|
||||
}
|
||||
|
||||
void MainWindow::taskEnd()
|
||||
|
@ -166,9 +166,6 @@ class MainWindow : public QMainWindow {
|
||||
void on_actionEditInstance_triggered();
|
||||
|
||||
void on_actionCreateInstanceShortcut_triggered();
|
||||
void on_actionCreateInstanceShortcutDesktop_triggered();
|
||||
void on_actionCreateInstanceShortcutApplications_triggered();
|
||||
void on_actionCreateInstanceShortcutOther_triggered();
|
||||
|
||||
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>
|
||||
</property>
|
||||
</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>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -50,21 +50,59 @@
|
||||
#include "FileSystem.h"
|
||||
#include "InstanceList.h"
|
||||
#include "icons/IconList.h"
|
||||
#include "minecraft/ShortcutUtils.h"
|
||||
|
||||
CreateShortcutDialog::CreateShortcutDialog(InstancePtr instance, QWidget* parent)
|
||||
: QDialog(parent), ui(new Ui::CreateShortcutDialog), m_instance(instance)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
resize(minimumSizeHint());
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
InstIconKey = instance->iconKey();
|
||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||
ui->instNameTextBox->setText(instance->name());
|
||||
ui->instNameTextBox->setFocus();
|
||||
}
|
||||
|
||||
CreateShortcutDialog::~CreateShortcutDialog()
|
||||
{
|
||||
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);
|
||||
~CreateShortcutDialog();
|
||||
|
||||
void createShortcut() const;
|
||||
|
||||
private slots:
|
||||
// Icon, target and name
|
||||
void on_iconButton_clicked();
|
||||
|
Loading…
x
Reference in New Issue
Block a user