Compare commits

..

6 Commits

Author SHA1 Message Date
Petr Mrázek
e6cc65cf69 NOISSUE no means no, #2 2020-03-26 10:38:13 +01:00
Petr Mrázek
ebb17cb5f8 NOISSUE no means no. 2020-03-26 03:51:14 +01:00
Petr Mrázek
69490535d0 Merge pull request #2979 from Brottweiler/desktop-entry-tweak
Tweak GenericName for Linux desktop entry
2020-02-25 18:02:09 +01:00
Brottweiler
95a09ba099 GH-2979 Tweak GenericName 2020-02-24 19:39:22 +01:00
Petr Mrázek
6cb956b45b NOISSUE Nice. 2020-02-24 18:59:36 +01:00
OverMighty
47fa7b3f8c GH-2988 add --import command-line option
When specified, opens the "Import from zip" dialog as soon as the main
window is shown, with the URL field prefilled with the argument given to
the option.

Closes #2998
2020-02-24 18:52:26 +01:00
6 changed files with 55 additions and 9 deletions

View File

@@ -46,7 +46,7 @@ set(MultiMC_NEWS_RSS_URL "https://multimc.org/rss.xml" CACHE STRING "URL to fetc
######## Set version numbers ########
set(MultiMC_VERSION_MAJOR 0)
set(MultiMC_VERSION_MINOR 6)
set(MultiMC_VERSION_HOTFIX 8)
set(MultiMC_VERSION_HOTFIX 10)
# Build number
set(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")

View File

@@ -151,6 +151,10 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
QJsonObject libObj = requireObject(libVal);
// parse the library
auto lib = libraryFromJson(libObj, filename);
if(lib->rawName().artifactId() == "ForgeWrapper") {
out->mainClass.clear();
out->addProblem(ProblemSeverity::Error, QObject::tr("Forge workarounds have no place in MultiMC."));
}
out->libraries.append(lib);
}
};

View File

@@ -57,6 +57,8 @@ public:
void checkInstancePathForProblems();
void updatesAllowedChanged(bool allowed);
void droppedURLs(QList<QUrl> urls);
signals:
void isClosing();
@@ -180,8 +182,6 @@ private slots:
*/
void downloadUpdates(GoUpdate::Status status);
void droppedURLs(QList<QUrl> urls);
void konamiTriggered();
void globalSettingsClosed();

View File

@@ -34,6 +34,7 @@
#include <QNetworkAccessManager>
#include <QTranslator>
#include <QLibraryInfo>
#include <QList>
#include <QStringList>
#include <QDebug>
#include <QStyleFactory>
@@ -173,6 +174,10 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
// --alive
parser.addSwitch("alive");
parser.addDocumentation("alive", "Write a small '" + liveCheckFile + "' file after MultiMC starts");
// --import
parser.addOption("import");
parser.addShortOpt("import", 'I');
parser.addDocumentation("import", "Import instance from specified zip (local path or URL)");
// parse the arguments
try
@@ -207,6 +212,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
}
m_instanceIdToLaunch = args["launch"].toString();
m_liveCheck = args["alive"].toBool();
m_zipToImport = args["import"].toUrl();
QString origcwdPath = QDir::currentPath();
QString binPath = applicationDirPath();
@@ -278,13 +284,20 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
connect(m_peerInstance, &LocalPeer::messageReceived, this, &MultiMC::messageReceived);
if(m_peerInstance->isClient())
{
int timeout = 2000;
if(m_instanceIdToLaunch.isEmpty())
{
m_peerInstance->sendMessage("activate", 2000);
m_peerInstance->sendMessage("activate", timeout);
if(!m_zipToImport.isEmpty())
{
m_peerInstance->sendMessage("import " + m_zipToImport.toString(), timeout);
}
}
else
{
m_peerInstance->sendMessage(m_instanceIdToLaunch, 2000);
m_peerInstance->sendMessage("launch " + m_instanceIdToLaunch, timeout);
}
m_status = MultiMC::Succeeded;
return;
@@ -812,6 +825,11 @@ void MultiMC::performMainStartupAction()
showMainWindow(false);
qDebug() << "<> Main window shown.";
}
if(!m_zipToImport.isEmpty())
{
qDebug() << "<> Importing instance from zip:" << m_zipToImport;
m_mainWindow->droppedURLs({ m_zipToImport });
}
}
void MultiMC::showFatalErrorMessage(const QString& title, const QString& content)
@@ -848,18 +866,40 @@ void MultiMC::messageReceived(const QString& message)
qDebug() << "Received message" << message << "while still initializing. It will be ignored.";
return;
}
if(message == "activate")
QStringList args = message.split(' ');
QString command = args.takeFirst();
if(command == "activate")
{
showMainWindow();
}
else
else if(command == "import")
{
auto inst = instances()->getInstanceById(message);
if(args.isEmpty())
{
qWarning() << "Received" << command << "message without a zip path/URL.";
return;
}
m_mainWindow->droppedURLs({ QUrl(args.takeFirst()) });
}
else if(command == "launch")
{
if(args.isEmpty())
{
qWarning() << "Received" << command << "message without an instance ID.";
return;
}
auto inst = instances()->getInstanceById(args.takeFirst());
if(inst)
{
launch(inst, true, nullptr);
}
}
else
{
qWarning() << "Received invalid message" << message;
}
}
void MultiMC::analyticsSettingChanged(const Setting&, QVariant value)

View File

@@ -6,6 +6,7 @@
#include <QFlag>
#include <QIcon>
#include <QDateTime>
#include <QUrl>
#include <updater/GoUpdate.h>
#include <BaseInstance.h>
@@ -221,5 +222,6 @@ private:
public:
QString m_instanceIdToLaunch;
bool m_liveCheck = false;
QUrl m_zipToImport;
std::unique_ptr<QFile> logFile;
};

View File

@@ -1,7 +1,7 @@
[Desktop Entry]
Version=1.0
Name=MultiMC
GenericName=MultiMC
GenericName=Minecraft Launcher
Comment=Free, open source launcher and instance manager for Minecraft.
Type=Application
Terminal=false