mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-26 03:42:15 +02:00
Add source files for UI
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
1c288543f2
commit
0a5013ff9f
@ -1050,6 +1050,8 @@ SET(LAUNCHER_SOURCES
|
|||||||
ui/dialogs/ProfileSetupDialog.h
|
ui/dialogs/ProfileSetupDialog.h
|
||||||
ui/dialogs/CopyInstanceDialog.cpp
|
ui/dialogs/CopyInstanceDialog.cpp
|
||||||
ui/dialogs/CopyInstanceDialog.h
|
ui/dialogs/CopyInstanceDialog.h
|
||||||
|
ui/dialogs/CreateShortcutDialog.cpp
|
||||||
|
ui/dialogs/CreateShortcutDialog.h
|
||||||
ui/dialogs/CustomMessageBox.cpp
|
ui/dialogs/CustomMessageBox.cpp
|
||||||
ui/dialogs/CustomMessageBox.h
|
ui/dialogs/CustomMessageBox.h
|
||||||
ui/dialogs/ExportInstanceDialog.cpp
|
ui/dialogs/ExportInstanceDialog.cpp
|
||||||
@ -1232,6 +1234,7 @@ qt_wrap_ui(LAUNCHER_UI
|
|||||||
ui/widgets/MinecraftSettingsWidget.ui
|
ui/widgets/MinecraftSettingsWidget.ui
|
||||||
ui/widgets/JavaSettingsWidget.ui
|
ui/widgets/JavaSettingsWidget.ui
|
||||||
ui/dialogs/CopyInstanceDialog.ui
|
ui/dialogs/CopyInstanceDialog.ui
|
||||||
|
ui/dialogs/CreateShortcutDialog.ui
|
||||||
ui/dialogs/ProfileSetupDialog.ui
|
ui/dialogs/ProfileSetupDialog.ui
|
||||||
ui/dialogs/ProgressDialog.ui
|
ui/dialogs/ProgressDialog.ui
|
||||||
ui/dialogs/NewInstanceDialog.ui
|
ui/dialogs/NewInstanceDialog.ui
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
#include "ui/GuiUtil.h"
|
#include "ui/GuiUtil.h"
|
||||||
#include "ui/dialogs/AboutDialog.h"
|
#include "ui/dialogs/AboutDialog.h"
|
||||||
#include "ui/dialogs/CopyInstanceDialog.h"
|
#include "ui/dialogs/CopyInstanceDialog.h"
|
||||||
|
#include "ui/dialogs/CreateShortcutDialog.h"
|
||||||
#include "ui/dialogs/CustomMessageBox.h"
|
#include "ui/dialogs/CustomMessageBox.h"
|
||||||
#include "ui/dialogs/ExportInstanceDialog.h"
|
#include "ui/dialogs/ExportInstanceDialog.h"
|
||||||
#include "ui/dialogs/ExportPackDialog.h"
|
#include "ui/dialogs/ExportPackDialog.h"
|
||||||
|
70
launcher/ui/dialogs/CreateShortcutDialog.cpp
Normal file
70
launcher/ui/dialogs/CreateShortcutDialog.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
/*
|
||||||
|
* Prism Launcher - Minecraft Launcher
|
||||||
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
|
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
|
||||||
|
* Copyright (C) 2025 Yihe Li <winmikedows@hotmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* This file incorporates work covered by the following copyright and
|
||||||
|
* permission notice:
|
||||||
|
*
|
||||||
|
* Copyright 2013-2021 MultiMC Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
|
#include "BuildConfig.h"
|
||||||
|
#include "CreateShortcutDialog.h"
|
||||||
|
#include "ui_CreateShortcutDialog.h"
|
||||||
|
|
||||||
|
#include "ui/dialogs/IconPickerDialog.h"
|
||||||
|
|
||||||
|
#include "BaseInstance.h"
|
||||||
|
#include "DesktopServices.h"
|
||||||
|
#include "FileSystem.h"
|
||||||
|
#include "InstanceList.h"
|
||||||
|
#include "icons/IconList.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;
|
||||||
|
}
|
56
launcher/ui/dialogs/CreateShortcutDialog.h
Normal file
56
launcher/ui/dialogs/CreateShortcutDialog.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/* Copyright 2013-2021 MultiMC Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "BaseInstance.h"
|
||||||
|
|
||||||
|
class BaseInstance;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CreateShortcutDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CreateShortcutDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CreateShortcutDialog(InstancePtr instance, QWidget* parent = nullptr);
|
||||||
|
~CreateShortcutDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// Icon, target and name
|
||||||
|
void on_iconButton_clicked();
|
||||||
|
void on_saveTargetSelectionBox_currentIndexChanged(int index);
|
||||||
|
void on_instNameTextBox_textChanged(const QString& arg1);
|
||||||
|
|
||||||
|
// Override account
|
||||||
|
void on_overrideAccountCheckbox_stateChanged(int state);
|
||||||
|
void on_accountSelectionBox_currentIndexChanged(int index);
|
||||||
|
|
||||||
|
// Override target (world, server)
|
||||||
|
void on_targetCheckbox_stateChanged(int state);
|
||||||
|
void on_worldSelectionBox_currentIndexChanged(int index);
|
||||||
|
void on_serverAddressTextBox_textChanged(const QString& arg1);
|
||||||
|
void targetChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* data */
|
||||||
|
Ui::CreateShortcutDialog* ui;
|
||||||
|
QString InstIconKey;
|
||||||
|
InstancePtr m_instance;
|
||||||
|
bool m_QuickJoinSupported = false;
|
||||||
|
};
|
@ -135,6 +135,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>World:</string>
|
<string>World:</string>
|
||||||
</property>
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">targetBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
@ -152,6 +155,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Server Address:</string>
|
<string>Server Address:</string>
|
||||||
</property>
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">targetBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
@ -214,4 +220,7 @@
|
|||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="targetBtnGroup"/>
|
||||||
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user