commit
3887cfe5df
@ -48,6 +48,7 @@
|
|||||||
#include "pathmatcher/MultiMatcher.h"
|
#include "pathmatcher/MultiMatcher.h"
|
||||||
#include "pathmatcher/SimplePrefixMatcher.h"
|
#include "pathmatcher/SimplePrefixMatcher.h"
|
||||||
#include "settings/INIFile.h"
|
#include "settings/INIFile.h"
|
||||||
|
#include "tools/GenericProfiler.h"
|
||||||
#include "ui/InstanceWindow.h"
|
#include "ui/InstanceWindow.h"
|
||||||
#include "ui/MainWindow.h"
|
#include "ui/MainWindow.h"
|
||||||
|
|
||||||
@ -879,6 +880,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
// FIXME: what to do with these?
|
// FIXME: what to do with these?
|
||||||
m_profilers.insert("jprofiler", std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory()));
|
m_profilers.insert("jprofiler", std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory()));
|
||||||
m_profilers.insert("jvisualvm", std::shared_ptr<BaseProfilerFactory>(new JVisualVMFactory()));
|
m_profilers.insert("jvisualvm", std::shared_ptr<BaseProfilerFactory>(new JVisualVMFactory()));
|
||||||
|
m_profilers.insert("generic", std::shared_ptr<BaseProfilerFactory>(new GenericProfilerFactory()));
|
||||||
for (auto profiler : m_profilers.values()) {
|
for (auto profiler : m_profilers.values()) {
|
||||||
profiler->registerSettings(m_settings);
|
profiler->registerSettings(m_settings);
|
||||||
}
|
}
|
||||||
|
@ -443,6 +443,8 @@ set(TOOLS_SOURCES
|
|||||||
tools/JVisualVM.h
|
tools/JVisualVM.h
|
||||||
tools/MCEditTool.cpp
|
tools/MCEditTool.cpp
|
||||||
tools/MCEditTool.h
|
tools/MCEditTool.h
|
||||||
|
tools/GenericProfiler.cpp
|
||||||
|
tools/GenericProfiler.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(META_SOURCES
|
set(META_SOURCES
|
||||||
|
46
launcher/tools/GenericProfiler.cpp
Normal file
46
launcher/tools/GenericProfiler.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
/*
|
||||||
|
* Prism Launcher - Minecraft Launcher
|
||||||
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.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/>.
|
||||||
|
*/
|
||||||
|
#include "GenericProfiler.h"
|
||||||
|
|
||||||
|
#include "BaseInstance.h"
|
||||||
|
#include "launch/LaunchTask.h"
|
||||||
|
#include "settings/SettingsObject.h"
|
||||||
|
|
||||||
|
class GenericProfiler : public BaseProfiler {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
GenericProfiler(SettingsObjectPtr settings, InstancePtr instance, QObject* parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void beginProfilingImpl(shared_qobject_ptr<LaunchTask> process);
|
||||||
|
};
|
||||||
|
|
||||||
|
GenericProfiler::GenericProfiler(SettingsObjectPtr settings, InstancePtr instance, QObject* parent)
|
||||||
|
: BaseProfiler(settings, instance, parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void GenericProfiler::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process)
|
||||||
|
{
|
||||||
|
emit readyToLaunch(tr("Started process: %1").arg(process->pid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseExternalTool* GenericProfilerFactory::createTool(InstancePtr instance, QObject* parent)
|
||||||
|
{
|
||||||
|
return new GenericProfiler(globalSettings, instance, parent);
|
||||||
|
}
|
||||||
|
#include "GenericProfiler.moc"
|
29
launcher/tools/GenericProfiler.h
Normal file
29
launcher/tools/GenericProfiler.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
/*
|
||||||
|
* Prism Launcher - Minecraft Launcher
|
||||||
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.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/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "BaseProfiler.h"
|
||||||
|
|
||||||
|
class GenericProfilerFactory : public BaseProfilerFactory {
|
||||||
|
public:
|
||||||
|
QString name() const override { return "Generic"; }
|
||||||
|
void registerSettings([[maybe_unused]] SettingsObjectPtr settings) override{};
|
||||||
|
BaseExternalTool* createTool(InstancePtr instance, QObject* parent = 0) override;
|
||||||
|
bool check([[maybe_unused]] QString* error) override { return true; };
|
||||||
|
bool check([[maybe_unused]] const QString& path, [[maybe_unused]] QString* error) override { return true; };
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user