Added file logger
This commit is contained in:
parent
eba9b3d759
commit
f83119ce7e
@ -168,6 +168,14 @@ MultiMC.h
|
||||
MultiMC.cpp
|
||||
MultiMCVersion.h
|
||||
|
||||
# Logging
|
||||
logger/QsDebugOutput.cpp
|
||||
logger/QsDebugOutput.h
|
||||
logger/QsLog.cpp
|
||||
logger/QsLog.h
|
||||
logger/QsLogDest.cpp
|
||||
logger/QsLogDest.h
|
||||
|
||||
# GUI
|
||||
gui/mainwindow.h
|
||||
gui/mainwindow.cpp
|
||||
|
34
MultiMC.cpp
34
MultiMC.cpp
@ -20,6 +20,8 @@
|
||||
#include "cmdutils.h"
|
||||
#include <inisettingsobject.h>
|
||||
#include <setting.h>
|
||||
#include <logger/QsLog.h>
|
||||
#include <logger/QsLogDest.h>
|
||||
|
||||
#include "config.h"
|
||||
using namespace Util::Commandline;
|
||||
@ -123,6 +125,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
// change directory
|
||||
QDir::setCurrent(args["dir"].toString());
|
||||
|
||||
// init the logger
|
||||
initLogger();
|
||||
|
||||
// load settings
|
||||
initGlobalSettings();
|
||||
|
||||
@ -156,11 +161,11 @@ MultiMC::~MultiMC()
|
||||
{
|
||||
if (m_mmc_translator)
|
||||
{
|
||||
removeTranslator(m_mmc_translator.data());
|
||||
removeTranslator(m_mmc_translator.get());
|
||||
}
|
||||
if (m_qt_translator)
|
||||
{
|
||||
removeTranslator(m_qt_translator.data());
|
||||
removeTranslator(m_qt_translator.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +177,7 @@ void MultiMC::initTranslations()
|
||||
{
|
||||
std::cout << "Loading Qt Language File for "
|
||||
<< QLocale::system().name().toLocal8Bit().constData() << "...";
|
||||
if (!installTranslator(m_qt_translator.data()))
|
||||
if (!installTranslator(m_qt_translator.get()))
|
||||
{
|
||||
std::cout << " failed.";
|
||||
m_qt_translator.reset();
|
||||
@ -190,7 +195,7 @@ void MultiMC::initTranslations()
|
||||
{
|
||||
std::cout << "Loading MMC Language File for "
|
||||
<< QLocale::system().name().toLocal8Bit().constData() << "...";
|
||||
if (!installTranslator(m_mmc_translator.data()))
|
||||
if (!installTranslator(m_mmc_translator.get()))
|
||||
{
|
||||
std::cout << " failed.";
|
||||
m_mmc_translator.reset();
|
||||
@ -203,6 +208,19 @@ void MultiMC::initTranslations()
|
||||
}
|
||||
}
|
||||
|
||||
void MultiMC::initLogger()
|
||||
{
|
||||
// init the logging mechanism
|
||||
QsLogging::Logger &logger = QsLogging::Logger::instance();
|
||||
logger.setLoggingLevel(QsLogging::TraceLevel);
|
||||
m_fileDestination = QsLogging::DestinationFactory::MakeFileDestination("MultiMC.log");
|
||||
m_debugDestination = QsLogging::DestinationFactory::MakeDebugOutputDestination();
|
||||
logger.addDestination(m_fileDestination.get());
|
||||
logger.addDestination(m_debugDestination.get());
|
||||
// log all the things
|
||||
logger.setLoggingLevel(QsLogging::TraceLevel);
|
||||
}
|
||||
|
||||
void MultiMC::initGlobalSettings()
|
||||
{
|
||||
m_settings.reset(new INISettingsObject("multimc.cfg", this));
|
||||
@ -275,7 +293,7 @@ void MultiMC::initHttpMetaCache()
|
||||
m_metacache->Load();
|
||||
}
|
||||
|
||||
QSharedPointer<IconList> MultiMC::icons()
|
||||
std::shared_ptr<IconList> MultiMC::icons()
|
||||
{
|
||||
if (!m_icons)
|
||||
{
|
||||
@ -284,7 +302,7 @@ QSharedPointer<IconList> MultiMC::icons()
|
||||
return m_icons;
|
||||
}
|
||||
|
||||
QSharedPointer<LWJGLVersionList> MultiMC::lwjgllist()
|
||||
std::shared_ptr<LWJGLVersionList> MultiMC::lwjgllist()
|
||||
{
|
||||
if (!m_lwjgllist)
|
||||
{
|
||||
@ -293,7 +311,7 @@ QSharedPointer<LWJGLVersionList> MultiMC::lwjgllist()
|
||||
return m_lwjgllist;
|
||||
}
|
||||
|
||||
QSharedPointer<ForgeVersionList> MultiMC::forgelist()
|
||||
std::shared_ptr<ForgeVersionList> MultiMC::forgelist()
|
||||
{
|
||||
if (!m_forgelist)
|
||||
{
|
||||
@ -302,7 +320,7 @@ QSharedPointer<ForgeVersionList> MultiMC::forgelist()
|
||||
return m_forgelist;
|
||||
}
|
||||
|
||||
QSharedPointer<MinecraftVersionList> MultiMC::minecraftlist()
|
||||
std::shared_ptr<MinecraftVersionList> MultiMC::minecraftlist()
|
||||
{
|
||||
if (!m_minecraftlist)
|
||||
{
|
||||
|
50
MultiMC.h
50
MultiMC.h
@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSharedPointer>
|
||||
#include "MultiMCVersion.h"
|
||||
#include "config.h"
|
||||
#include <memory>
|
||||
#include "logger/QsLog.h"
|
||||
#include "logger/QsLogDest.h"
|
||||
|
||||
|
||||
class MinecraftVersionList;
|
||||
class LWJGLVersionList;
|
||||
@ -34,17 +37,17 @@ public:
|
||||
MultiMC(int &argc, char **argv);
|
||||
virtual ~MultiMC();
|
||||
|
||||
QSharedPointer<SettingsObject> settings()
|
||||
std::shared_ptr<SettingsObject> settings()
|
||||
{
|
||||
return m_settings;
|
||||
};
|
||||
}
|
||||
|
||||
QSharedPointer<InstanceList> instances()
|
||||
std::shared_ptr<InstanceList> instances()
|
||||
{
|
||||
return m_instances;
|
||||
};
|
||||
}
|
||||
|
||||
QSharedPointer<IconList> icons();
|
||||
std::shared_ptr<IconList> icons();
|
||||
|
||||
Status status()
|
||||
{
|
||||
@ -56,39 +59,44 @@ public:
|
||||
return m_version;
|
||||
}
|
||||
|
||||
QSharedPointer<QNetworkAccessManager> qnam()
|
||||
std::shared_ptr<QNetworkAccessManager> qnam()
|
||||
{
|
||||
return m_qnam;
|
||||
}
|
||||
|
||||
QSharedPointer<HttpMetaCache> metacache()
|
||||
std::shared_ptr<HttpMetaCache> metacache()
|
||||
{
|
||||
return m_metacache;
|
||||
}
|
||||
|
||||
QSharedPointer<LWJGLVersionList> lwjgllist();
|
||||
std::shared_ptr<LWJGLVersionList> lwjgllist();
|
||||
|
||||
QSharedPointer<ForgeVersionList> forgelist();
|
||||
std::shared_ptr<ForgeVersionList> forgelist();
|
||||
|
||||
QSharedPointer<MinecraftVersionList> minecraftlist();
|
||||
std::shared_ptr<MinecraftVersionList> minecraftlist();
|
||||
|
||||
private:
|
||||
void initLogger();
|
||||
|
||||
void initGlobalSettings();
|
||||
|
||||
void initHttpMetaCache();
|
||||
|
||||
void initTranslations();
|
||||
|
||||
private:
|
||||
QSharedPointer<QTranslator> m_qt_translator;
|
||||
QSharedPointer<QTranslator> m_mmc_translator;
|
||||
QSharedPointer<SettingsObject> m_settings;
|
||||
QSharedPointer<InstanceList> m_instances;
|
||||
QSharedPointer<IconList> m_icons;
|
||||
QSharedPointer<QNetworkAccessManager> m_qnam;
|
||||
QSharedPointer<HttpMetaCache> m_metacache;
|
||||
QSharedPointer<LWJGLVersionList> m_lwjgllist;
|
||||
QSharedPointer<ForgeVersionList> m_forgelist;
|
||||
QSharedPointer<MinecraftVersionList> m_minecraftlist;
|
||||
std::shared_ptr<QTranslator> m_qt_translator;
|
||||
std::shared_ptr<QTranslator> m_mmc_translator;
|
||||
std::shared_ptr<SettingsObject> m_settings;
|
||||
std::shared_ptr<InstanceList> m_instances;
|
||||
std::shared_ptr<IconList> m_icons;
|
||||
std::shared_ptr<QNetworkAccessManager> m_qnam;
|
||||
std::shared_ptr<HttpMetaCache> m_metacache;
|
||||
std::shared_ptr<LWJGLVersionList> m_lwjgllist;
|
||||
std::shared_ptr<ForgeVersionList> m_forgelist;
|
||||
std::shared_ptr<MinecraftVersionList> m_minecraftlist;
|
||||
QsLogging::DestinationPtr m_fileDestination;
|
||||
QsLogging::DestinationPtr m_debugDestination;
|
||||
|
||||
Status m_status = MultiMC::Failed;
|
||||
MultiMCVersion m_version = {VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD};
|
||||
|
@ -39,7 +39,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) :
|
||||
|
||||
contentsWidget->installEventFilter(this);
|
||||
|
||||
contentsWidget->setModel(MMC->icons().data());
|
||||
contentsWidget->setModel(MMC->icons().get());
|
||||
|
||||
auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"),QDialogButtonBox::ResetRole);
|
||||
auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"),QDialogButtonBox::ResetRole);
|
||||
|
@ -28,10 +28,8 @@
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
|
||||
LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent ) :
|
||||
m_inst(inst),
|
||||
QDialog(parent),
|
||||
ui(new Ui::LegacyModEditDialog)
|
||||
LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
|
||||
: m_inst(inst), QDialog(parent), ui(new Ui::LegacyModEditDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -39,7 +37,7 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
||||
{
|
||||
ensureFolderPathExists(m_inst->jarModsDir());
|
||||
m_jarmods = m_inst->jarModList();
|
||||
ui->jarModsTreeView->setModel(m_jarmods.data());
|
||||
ui->jarModsTreeView->setModel(m_jarmods.get());
|
||||
#ifndef Q_OS_LINUX
|
||||
// FIXME: internal DnD causes segfaults later
|
||||
ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop);
|
||||
@ -53,7 +51,7 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
||||
{
|
||||
ensureFolderPathExists(m_inst->coreModsDir());
|
||||
m_coremods = m_inst->coreModList();
|
||||
ui->coreModsTreeView->setModel(m_coremods.data());
|
||||
ui->coreModsTreeView->setModel(m_coremods.get());
|
||||
ui->coreModsTreeView->installEventFilter(this);
|
||||
m_coremods->startWatching();
|
||||
}
|
||||
@ -61,7 +59,7 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
||||
{
|
||||
ensureFolderPathExists(m_inst->loaderModsDir());
|
||||
m_mods = m_inst->loaderModList();
|
||||
ui->loaderModTreeView->setModel(m_mods.data());
|
||||
ui->loaderModTreeView->setModel(m_mods.get());
|
||||
ui->loaderModTreeView->installEventFilter(this);
|
||||
m_mods->startWatching();
|
||||
}
|
||||
@ -69,7 +67,7 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
||||
{
|
||||
ensureFolderPathExists(m_inst->texturePacksDir());
|
||||
m_texturepacks = m_inst->texturePackList();
|
||||
ui->texPackTreeView->setModel(m_texturepacks.data());
|
||||
ui->texPackTreeView->setModel(m_texturepacks.get());
|
||||
ui->texPackTreeView->installEventFilter(this);
|
||||
m_texturepacks->startWatching();
|
||||
}
|
||||
@ -166,7 +164,6 @@ bool LegacyModEditDialog::texturePackListFilter ( QKeyEvent* keyEvent )
|
||||
return QDialog::eventFilter(ui->texPackTreeView, keyEvent);
|
||||
}
|
||||
|
||||
|
||||
bool LegacyModEditDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
if (ev->type() != QEvent::KeyPress)
|
||||
@ -185,7 +182,6 @@ bool LegacyModEditDialog::eventFilter ( QObject* obj, QEvent* ev )
|
||||
return QDialog::eventFilter(obj, ev);
|
||||
}
|
||||
|
||||
|
||||
void LegacyModEditDialog::on_addCoreBtn_clicked()
|
||||
{
|
||||
//: Title of core mod selection dialog
|
||||
@ -199,11 +195,12 @@ void LegacyModEditDialog::on_addCoreBtn_clicked()
|
||||
}
|
||||
void LegacyModEditDialog::on_addForgeBtn_clicked()
|
||||
{
|
||||
VersionSelectDialog vselect(MMC->forgelist().data(), this);
|
||||
VersionSelectDialog vselect(MMC->forgelist().get(), this);
|
||||
vselect.setFilter(1, m_inst->intendedVersionId());
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
ForgeVersionPtr forge = vselect.selectedVersion().dynamicCast<ForgeVersion>();
|
||||
ForgeVersionPtr forge =
|
||||
std::dynamic_pointer_cast<ForgeVersion> (vselect.selectedVersion());
|
||||
if (!forge)
|
||||
return;
|
||||
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename);
|
||||
@ -342,7 +339,6 @@ void LegacyModEditDialog::on_viewTexPackBtn_clicked()
|
||||
openDirInDefaultProgram(m_inst->texturePacksDir(), true);
|
||||
}
|
||||
|
||||
|
||||
void LegacyModEditDialog::on_buttonBox_rejected()
|
||||
{
|
||||
close();
|
||||
|
@ -60,10 +60,10 @@ protected:
|
||||
bool texturePackListFilter( QKeyEvent* ev );
|
||||
private:
|
||||
Ui::LegacyModEditDialog *ui;
|
||||
QSharedPointer<ModList> m_mods;
|
||||
QSharedPointer<ModList> m_coremods;
|
||||
QSharedPointer<ModList> m_jarmods;
|
||||
QSharedPointer<ModList> m_texturepacks;
|
||||
std::shared_ptr<ModList> m_mods;
|
||||
std::shared_ptr<ModList> m_coremods;
|
||||
std::shared_ptr<ModList> m_jarmods;
|
||||
std::shared_ptr<ModList> m_texturepacks;
|
||||
LegacyInstance * m_inst;
|
||||
DownloadJobPtr forgeJob;
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
|
||||
{
|
||||
main_model = new EnabledItemFilter(this);
|
||||
main_model->setActive(true);
|
||||
main_model->setSourceModel(m_version.data());
|
||||
main_model->setSourceModel(m_version.get());
|
||||
ui->libraryTreeView->setModel(main_model);
|
||||
ui->libraryTreeView->installEventFilter(this);
|
||||
ui->mainClassEdit->setText(m_version->mainClass);
|
||||
@ -56,7 +56,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
|
||||
{
|
||||
ensureFolderPathExists(m_inst->loaderModsDir());
|
||||
m_mods = m_inst->loaderModList();
|
||||
ui->loaderModTreeView->setModel(m_mods.data());
|
||||
ui->loaderModTreeView->setModel(m_mods.get());
|
||||
ui->loaderModTreeView->installEventFilter(this);
|
||||
m_mods->startWatching();
|
||||
}
|
||||
@ -64,7 +64,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
|
||||
{
|
||||
ensureFolderPathExists(m_inst->resourcePacksDir());
|
||||
m_resourcepacks = m_inst->resourcePackList();
|
||||
ui->resPackTreeView->setModel(m_resourcepacks.data());
|
||||
ui->resPackTreeView->setModel(m_resourcepacks.get());
|
||||
ui->resPackTreeView->installEventFilter(this);
|
||||
m_resourcepacks->startWatching();
|
||||
}
|
||||
@ -97,7 +97,7 @@ void OneSixModEditDialog::on_customizeBtn_clicked()
|
||||
if (m_inst->customizeVersion())
|
||||
{
|
||||
m_version = m_inst->getFullVersion();
|
||||
main_model->setSourceModel(m_version.data());
|
||||
main_model->setSourceModel(m_version.get());
|
||||
updateVersionControls();
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ void OneSixModEditDialog::on_revertBtn_clicked()
|
||||
if (m_inst->revertCustomVersion())
|
||||
{
|
||||
m_version = m_inst->getFullVersion();
|
||||
main_model->setSourceModel(m_version.data());
|
||||
main_model->setSourceModel(m_version.get());
|
||||
updateVersionControls();
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ void OneSixModEditDialog::on_revertBtn_clicked()
|
||||
|
||||
void OneSixModEditDialog::on_forgeBtn_clicked()
|
||||
{
|
||||
VersionSelectDialog vselect(MMC->forgelist().data(), this);
|
||||
VersionSelectDialog vselect(MMC->forgelist().get(), this);
|
||||
vselect.setFilter(1, m_inst->currentVersionId());
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
@ -139,7 +139,7 @@ void OneSixModEditDialog::on_forgeBtn_clicked()
|
||||
m_inst->customizeVersion();
|
||||
{
|
||||
m_version = m_inst->getFullVersion();
|
||||
main_model->setSourceModel(m_version.data());
|
||||
main_model->setSourceModel(m_version.get());
|
||||
updateVersionControls();
|
||||
}
|
||||
}
|
||||
@ -150,10 +150,11 @@ void OneSixModEditDialog::on_forgeBtn_clicked()
|
||||
{
|
||||
m_inst->customizeVersion();
|
||||
m_version = m_inst->getFullVersion();
|
||||
main_model->setSourceModel(m_version.data());
|
||||
main_model->setSourceModel(m_version.get());
|
||||
updateVersionControls();
|
||||
}
|
||||
ForgeVersionPtr forgeVersion = vselect.selectedVersion().dynamicCast<ForgeVersion>();
|
||||
ForgeVersionPtr forgeVersion =
|
||||
std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion());
|
||||
if (!forgeVersion)
|
||||
return;
|
||||
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forgeVersion->filename);
|
||||
|
@ -52,9 +52,9 @@ protected:
|
||||
bool resourcePackListFilter( QKeyEvent* ev );
|
||||
private:
|
||||
Ui::OneSixModEditDialog *ui;
|
||||
QSharedPointer<OneSixVersion> m_version;
|
||||
QSharedPointer<ModList> m_mods;
|
||||
QSharedPointer<ModList> m_resourcepacks;
|
||||
std::shared_ptr<OneSixVersion> m_version;
|
||||
std::shared_ptr<ModList> m_mods;
|
||||
std::shared_ptr<ModList> m_resourcepacks;
|
||||
EnabledItemFilter * main_model;
|
||||
OneSixInstance * m_inst;
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>400</height>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@ -101,7 +101,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>159</height>
|
||||
<height>179</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -159,8 +159,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>93</height>
|
||||
<width>682</width>
|
||||
<height>584</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -176,10 +176,10 @@
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">&gt;</span></p></body></html></string>
|
||||
</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Andrew Okin &lt;</span><a href="mailto:forkk@forkk.net"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">forkk@forkk.net</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Petr Mrázek &lt;</span><a href="mailto:peterix@gmail.com"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">peterix@gmail.com</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Orochimarufan &lt;</span><a href="mailto:orochimarufan.x3@gmail.com"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#0000ff;">orochimarufan.x3@gmail.com</span></a><span style=" font-family:'Ubuntu';">&gt;</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -190,8 +190,8 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>93</height>
|
||||
<width>682</width>
|
||||
<height>584</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -213,44 +213,45 @@ p, li { white-space: pre-wrap; }
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Copyright 2012 MultiMC Contributors</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">you may not use this file except in compliance with the License.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">You may obtain a copy of the License at</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';"> http://www.apache.org/licenses/LICENSE-2.0</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Unless required by applicable law or agreed to in writing, software</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">See the License for the specific language governing permissions and</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">limitations under the License.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">MultiMC uses bspatch, </span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Copyright 2003-2005 Colin Percival</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">All rights reserved</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Redistribution and use in source and binary forms, with or without</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">modification, are permitted providing that the following conditions</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">are met: </span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">1. Redistributions of source code must retain the above copyright</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';"> notice, this list of conditions and the following disclaimer.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">2. Redistributions in binary form must reproduce the above copyright</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';"> notice, this list of conditions and the following disclaimer in the</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';"> documentation and/or other materials provided with the distribution.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">POSSIBILITY OF SUCH DAMAGE.</span></p></body></html></string>
|
||||
</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Copyright 2012 MultiMC Contributors</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">you may not use this file except in compliance with the License.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">You may obtain a copy of the License at</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;"> http://www.apache.org/licenses/LICENSE-2.0</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Unless required by applicable law or agreed to in writing, software</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">See the License for the specific language governing permissions and</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">limitations under the License.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">MultiMC uses QSLog, </span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Copyright (c) 2010, Razvan Petru</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">All rights reserved.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Redistribution and use in source and binary forms, with or without modification,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">are permitted provided that the following conditions are met:</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">* Redistributions of source code must retain the above copyright notice, this</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;"> list of conditions and the following disclaimer.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">* Redistributions in binary form must reproduce the above copyright notice, this</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;"> list of conditions and the following disclaimer in the documentation and/or other</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;"> materials provided with the distribution.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">* The name of the contributors may not be used to endorse or promote products</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;"> derived from this software without specific prior written permission.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "logindialog.h"
|
||||
#include "ui_logindialog.h"
|
||||
#include "keyring.h"
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) :
|
||||
QDialog(parent),
|
||||
@ -109,7 +109,7 @@ void LoginDialog::passwordToggled ( bool state )
|
||||
blockToggles = true;
|
||||
if(!state)
|
||||
{
|
||||
qDebug() << "password disabled";
|
||||
QLOG_DEBUG() << "password disabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,7 +117,7 @@ void LoginDialog::passwordToggled ( bool state )
|
||||
{
|
||||
ui->rememberUsernameCheckbox->setChecked(true);
|
||||
}
|
||||
qDebug() << "password enabled";
|
||||
QLOG_DEBUG() << "password enabled";
|
||||
}
|
||||
blockToggles = false;
|
||||
}
|
||||
@ -134,11 +134,11 @@ void LoginDialog::usernameToggled ( bool state )
|
||||
{
|
||||
ui->rememberPasswordCheckbox->setChecked(false);
|
||||
}
|
||||
qDebug() << "username disabled";
|
||||
QLOG_DEBUG() << "username disabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "username enabled";
|
||||
QLOG_DEBUG() << "username enabled";
|
||||
}
|
||||
blockToggles = false;
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
ui->labelStatus->setVisible(false);
|
||||
auto lwjgllist = MMC->lwjgllist();
|
||||
ui->lwjglListView->setModel(lwjgllist.data());
|
||||
ui->lwjglListView->setModel(lwjgllist.get());
|
||||
|
||||
connect(lwjgllist.data(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool)));
|
||||
connect(lwjgllist.data(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString)));
|
||||
connect(lwjgllist.get(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool)));
|
||||
connect(lwjgllist.get(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString)));
|
||||
loadingStateUpdated(lwjgllist->isLoading());
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,7 @@
|
||||
#include "LabeledToolButton.h"
|
||||
#include "EditNotesDialog.h"
|
||||
|
||||
MainWindow::MainWindow ( QWidget *parent )
|
||||
:QMainWindow ( parent ), ui ( new Ui::MainWindow )
|
||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString()));
|
||||
@ -123,8 +122,9 @@ MainWindow::MainWindow ( QWidget *parent )
|
||||
proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
|
||||
// proxymodel->setDynamicSortFilter ( true );
|
||||
|
||||
// FIXME: instList should be global-ish, or at least not tied to the main window... maybe the application itself?
|
||||
proxymodel->setSourceModel ( MMC->instances().data() );
|
||||
// FIXME: instList should be global-ish, or at least not tied to the main window...
|
||||
// maybe the application itself?
|
||||
proxymodel->setSourceModel(MMC->instances().get());
|
||||
proxymodel->sort(0);
|
||||
view->setFrameShape(QFrame::NoFrame);
|
||||
view->setModel(proxymodel);
|
||||
@ -139,17 +139,15 @@ MainWindow::MainWindow ( QWidget *parent )
|
||||
setCatBackground(cat_enable);
|
||||
}
|
||||
// start instance when double-clicked
|
||||
connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(instanceActivated(const QModelIndex &)));
|
||||
connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this,
|
||||
SLOT(instanceActivated(const QModelIndex &)));
|
||||
// track the selection -- update the instance toolbar
|
||||
connect(
|
||||
view->selectionModel(),
|
||||
SIGNAL(currentChanged(const QModelIndex &,const QModelIndex &)),
|
||||
this,
|
||||
SLOT(instanceChanged(const QModelIndex &,const QModelIndex &))
|
||||
);
|
||||
connect(view->selectionModel(),
|
||||
SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this,
|
||||
SLOT(instanceChanged(const QModelIndex &, const QModelIndex &)));
|
||||
// model reset -> selection is invalid. All the instance pointers are wrong.
|
||||
// FIXME: stop using POINTERS everywhere
|
||||
connect(MMC->instances().data() ,SIGNAL(dataIsInvalid()),SLOT(selectionBad()));
|
||||
connect(MMC->instances().get(), SIGNAL(dataIsInvalid()), SLOT(selectionBad()));
|
||||
|
||||
// run the things that load and download other things... FIXME: this is NOT the place
|
||||
// FIXME: invisible actions in the background = NOPE.
|
||||
@ -216,8 +214,7 @@ void MainWindow::setCatBackground ( bool enabled )
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
view->setStyleSheet(
|
||||
"QListView"
|
||||
view->setStyleSheet("QListView"
|
||||
"{"
|
||||
"background-image: url(:/backgrounds/kitteh);"
|
||||
"background-attachment: fixed;"
|
||||
@ -225,8 +222,7 @@ void MainWindow::setCatBackground ( bool enabled )
|
||||
"background-position: top right;"
|
||||
"background-repeat: none;"
|
||||
"background-color:palette(base);"
|
||||
"}"
|
||||
);
|
||||
"}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -234,19 +230,19 @@ void MainWindow::setCatBackground ( bool enabled )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::instanceActivated(QModelIndex index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
BaseInstance * inst = (BaseInstance *) index.data(InstanceList::InstancePointerRole).value<void *>();
|
||||
BaseInstance *inst =
|
||||
(BaseInstance *)index.data(InstanceList::InstancePointerRole).value<void *>();
|
||||
doLogin();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAddInstance_triggered()
|
||||
{
|
||||
if (!MMC->minecraftlist()->isLoaded() &&
|
||||
m_versionLoadTask && m_versionLoadTask->isRunning())
|
||||
if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask &&
|
||||
m_versionLoadTask->isRunning())
|
||||
{
|
||||
QEventLoop waitLoop;
|
||||
waitLoop.connect(m_versionLoadTask, SIGNAL(failed(QString)), SLOT(quit()));
|
||||
@ -307,7 +303,6 @@ void MainWindow::on_actionChangeInstIcon_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionChangeInstGroup_triggered()
|
||||
{
|
||||
if (!m_selectedInstance)
|
||||
@ -321,7 +316,6 @@ void MainWindow::on_actionChangeInstGroup_triggered()
|
||||
m_selectedInstance->setGroupPost(name);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionViewInstanceFolder_triggered()
|
||||
{
|
||||
QString str = MMC->settings()->get("InstanceDir").toString();
|
||||
@ -347,10 +341,8 @@ void MainWindow::on_actionConfig_Folder_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionCheckUpdate_triggered()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSettings_triggered()
|
||||
@ -386,8 +378,9 @@ void MainWindow::on_actionDeleteInstance_triggered()
|
||||
{
|
||||
if (m_selectedInstance)
|
||||
{
|
||||
int response = QMessageBox::question(this, "CAREFUL",
|
||||
QString("This is permanent! Are you sure?\nAbout to delete: ") + m_selectedInstance->name());
|
||||
int response = QMessageBox::question(
|
||||
this, "CAREFUL", QString("This is permanent! Are you sure?\nAbout to delete: ") +
|
||||
m_selectedInstance->name());
|
||||
if (response == QMessageBox::Yes)
|
||||
{
|
||||
m_selectedInstance->nuke();
|
||||
@ -401,7 +394,8 @@ void MainWindow::on_actionRenameInstance_triggered()
|
||||
{
|
||||
bool ok = false;
|
||||
QString name(m_selectedInstance->name());
|
||||
name = QInputDialog::getText ( this, tr ( "Instance name" ), tr ( "Enter a new instance name." ),
|
||||
name =
|
||||
QInputDialog::getText(this, tr("Instance name"), tr("Enter a new instance name."),
|
||||
QLineEdit::Normal, name, &ok);
|
||||
|
||||
if (name.length() > 0)
|
||||
@ -412,7 +406,6 @@ void MainWindow::on_actionRenameInstance_triggered()
|
||||
renameButton->setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,8 +474,10 @@ void MainWindow::doLogin(const QString& errorMsg)
|
||||
|
||||
ProgressDialog *tDialog = new ProgressDialog(this);
|
||||
LoginTask *loginTask = new LoginTask(uInfo, tDialog);
|
||||
connect(loginTask, SIGNAL(succeeded()),SLOT(onLoginComplete()), Qt::QueuedConnection);
|
||||
connect(loginTask, SIGNAL(failed(QString)), SLOT(doLogin(QString)), Qt::QueuedConnection);
|
||||
connect(loginTask, SIGNAL(succeeded()), SLOT(onLoginComplete()),
|
||||
Qt::QueuedConnection);
|
||||
connect(loginTask, SIGNAL(failed(QString)), SLOT(doLogin(QString)),
|
||||
Qt::QueuedConnection);
|
||||
m_activeInst = m_selectedInstance;
|
||||
tDialog->exec(loginTask);
|
||||
}
|
||||
@ -549,8 +544,8 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
|
||||
|
||||
console = new ConsoleWindow(proc);
|
||||
console->show();
|
||||
connect(proc, SIGNAL(log(QString, MessageLevel::Enum)),
|
||||
console, SLOT(write(QString, MessageLevel::Enum)));
|
||||
connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console,
|
||||
SLOT(write(QString, MessageLevel::Enum)));
|
||||
connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded()));
|
||||
proc->setLogin(response.username, response.session_id);
|
||||
proc->launch();
|
||||
@ -578,16 +573,20 @@ void MainWindow::startTask(Task *task)
|
||||
task->start();
|
||||
}
|
||||
|
||||
|
||||
// Create A Desktop Shortcut
|
||||
void MainWindow::on_actionMakeDesktopShortcut_triggered()
|
||||
{
|
||||
QString name("Test");
|
||||
name = QInputDialog::getText ( this, tr ( "MultiMC Shortcut" ), tr ( "Enter a Shortcut Name." ), QLineEdit::Normal, name );
|
||||
name = QInputDialog::getText(this, tr("MultiMC Shortcut"), tr("Enter a Shortcut Name."),
|
||||
QLineEdit::Normal, name);
|
||||
|
||||
Util::createShortCut ( Util::getDesktopDir(), QApplication::instance()->applicationFilePath(), QStringList() << "-dl" << QDir::currentPath() << "test", name, "application-x-octet-stream" );
|
||||
Util::createShortCut(Util::getDesktopDir(), QApplication::instance()->applicationFilePath(),
|
||||
QStringList() << "-dl" << QDir::currentPath() << "test", name,
|
||||
"application-x-octet-stream");
|
||||
|
||||
QMessageBox::warning ( this, tr("Not useful"), tr("A Dummy Shortcut was created. it will not do anything productive") );
|
||||
QMessageBox::warning(
|
||||
this, tr("Not useful"),
|
||||
tr("A Dummy Shortcut was created. it will not do anything productive"));
|
||||
}
|
||||
|
||||
// BrowserDialog
|
||||
@ -601,7 +600,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
|
||||
if (view->selectionModel()->selectedIndexes().count() < 1)
|
||||
return;
|
||||
|
||||
VersionSelectDialog vselect(m_selectedInstance->versionList().data(), this);
|
||||
VersionSelectDialog vselect(m_selectedInstance->versionList().get(), this);
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor());
|
||||
@ -634,13 +633,18 @@ void MainWindow::on_actionInstanceSettings_triggered()
|
||||
|
||||
void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||
{
|
||||
if(current.isValid() && nullptr != (m_selectedInstance = (BaseInstance *) current.data(InstanceList::InstancePointerRole).value<void *>()))
|
||||
if (current.isValid() &&
|
||||
nullptr != (m_selectedInstance =
|
||||
(BaseInstance *)current.data(InstanceList::InstancePointerRole)
|
||||
.value<void *>()))
|
||||
{
|
||||
ui->instanceToolBar->setEnabled(true);
|
||||
QString iconKey = m_selectedInstance->iconKey();
|
||||
renameButton->setText(m_selectedInstance->name());
|
||||
ui->actionChangeInstLWJGLVersion->setEnabled(m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion"));
|
||||
ui->actionEditInstMods->setEnabled(m_selectedInstance->menuActionEnabled("actionEditInstMods"));
|
||||
ui->actionChangeInstLWJGLVersion->setEnabled(
|
||||
m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion"));
|
||||
ui->actionEditInstMods->setEnabled(
|
||||
m_selectedInstance->menuActionEnabled("actionEditInstMods"));
|
||||
statusBar()->clearMessage();
|
||||
statusBar()->showMessage(m_selectedInstance->getStatusbarDescription());
|
||||
auto ico = MMC->icons()->getIcon(iconKey);
|
||||
@ -663,8 +667,6 @@ void MainWindow::selectionBad()
|
||||
ui->actionChangeInstIcon->setIcon(ico);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::on_actionEditInstNotes_triggered()
|
||||
{
|
||||
if (!m_selectedInstance)
|
||||
|
@ -96,7 +96,7 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const
|
||||
|
||||
void NewInstanceDialog::on_btnChangeVersion_clicked()
|
||||
{
|
||||
VersionSelectDialog vselect(MMC->minecraftlist().data(), this);
|
||||
VersionSelectDialog vselect(MMC->minecraftlist().get(), this);
|
||||
vselect.exec();
|
||||
if (vselect.result() == QDialog::Accepted)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
loadSettings(MMC->settings().data());
|
||||
loadSettings(MMC->settings().get());
|
||||
updateCheckboxStuff();
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked)
|
||||
|
||||
void SettingsDialog::on_buttonBox_accepted()
|
||||
{
|
||||
applySettings(MMC->settings().data());
|
||||
applySettings(MMC->settings().get());
|
||||
}
|
||||
|
||||
void SettingsDialog::applySettings(SettingsObject *s)
|
||||
|
@ -91,6 +91,6 @@ void VersionSelectDialog::setFilter(int column, QString filter)
|
||||
if (filteredTypes.length() > 0)
|
||||
regexStr = QString("^((?!%1).)*$").arg(filteredTypes.join('|'));
|
||||
|
||||
qDebug() << "Filter:" << regexStr;
|
||||
QLOG_DEBUG() << "Filter:" << regexStr;
|
||||
*/
|
||||
}
|
||||
|
52
logger/QsDebugOutput.cpp
Normal file
52
logger/QsDebugOutput.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2010, Razvan Petru
|
||||
// All rights reserved.
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
// list of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
// * The name of the contributors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "QsDebugOutput.h"
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
void QsDebugOutput::output(const QString &message)
|
||||
{
|
||||
OutputDebugStringW(reinterpret_cast<const WCHAR *>(message.utf16()));
|
||||
OutputDebugStringW(L"\n");
|
||||
}
|
||||
#elif defined(Q_OS_SYMBIAN)
|
||||
#include <e32debug.h>
|
||||
void QsDebugOutput::output(const QString &message)
|
||||
{
|
||||
TPtrC8 symbianMessage(reinterpret_cast<const TUint8 *>(qPrintable(message)));
|
||||
RDebug::RawPrint(symbianMessage);
|
||||
}
|
||||
#elif defined(Q_OS_UNIX)
|
||||
#include <cstdio>
|
||||
void QsDebugOutput::output(const QString &message)
|
||||
{
|
||||
fprintf(stderr, "%s\n", qPrintable(message));
|
||||
fflush(stderr);
|
||||
}
|
||||
#endif
|
34
logger/QsDebugOutput.h
Normal file
34
logger/QsDebugOutput.h
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2010, Razvan Petru
|
||||
// All rights reserved.
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
// list of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
// * The name of the contributors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#pragma once
|
||||
|
||||
class QString;
|
||||
|
||||
class QsDebugOutput
|
||||
{
|
||||
public:
|
||||
static void output(const QString &a_message);
|
||||
};
|
141
logger/QsLog.cpp
Normal file
141
logger/QsLog.cpp
Normal file
@ -0,0 +1,141 @@
|
||||
// Copyright (c) 2010, Razvan Petru
|
||||
// All rights reserved.
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
// list of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
// * The name of the contributors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "QsLog.h"
|
||||
#include "QsLogDest.h"
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QDateTime>
|
||||
#include <QtGlobal>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace QsLogging
|
||||
{
|
||||
typedef QList<Destination *> DestinationList;
|
||||
|
||||
static const char *LevelStrings[] = {"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"
|
||||
"UNKNOWN"};
|
||||
|
||||
// not using Qt::ISODate because we need the milliseconds too
|
||||
static const QString fmtDateTime("hhhh:mm:ss.zzz");
|
||||
|
||||
static const char *LevelToText(Level theLevel)
|
||||
{
|
||||
if (theLevel > FatalLevel)
|
||||
{
|
||||
assert(!"bad log level");
|
||||
return LevelStrings[UnknownLevel];
|
||||
}
|
||||
return LevelStrings[theLevel];
|
||||
}
|
||||
|
||||
class LoggerImpl
|
||||
{
|
||||
public:
|
||||
LoggerImpl() : level(InfoLevel), start_time(QDateTime::currentDateTime())
|
||||
{
|
||||
}
|
||||
QMutex logMutex;
|
||||
Level level;
|
||||
DestinationList destList;
|
||||
QDateTime start_time;
|
||||
};
|
||||
|
||||
Logger::Logger() : d(new LoggerImpl)
|
||||
{
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Logger::addDestination(Destination *destination)
|
||||
{
|
||||
assert(destination);
|
||||
d->destList.push_back(destination);
|
||||
}
|
||||
|
||||
void Logger::setLoggingLevel(Level newLevel)
|
||||
{
|
||||
d->level = newLevel;
|
||||
}
|
||||
|
||||
Level Logger::loggingLevel() const
|
||||
{
|
||||
return d->level;
|
||||
}
|
||||
|
||||
//! creates the complete log message and passes it to the logger
|
||||
void Logger::Helper::writeToLog()
|
||||
{
|
||||
const char *const levelName = LevelToText(level);
|
||||
const QString completeMessage(QString("%1\t%2\t%3")
|
||||
.arg(QDateTime::currentDateTime().toString(fmtDateTime))
|
||||
.arg(levelName, 5)
|
||||
.arg(buffer));
|
||||
|
||||
Logger &logger = Logger::instance();
|
||||
QMutexLocker lock(&logger.d->logMutex);
|
||||
logger.write(completeMessage);
|
||||
}
|
||||
|
||||
Logger::Helper::Helper(Level logLevel) : level(logLevel), qtDebug(&buffer)
|
||||
{
|
||||
}
|
||||
|
||||
Logger::Helper::~Helper()
|
||||
{
|
||||
try
|
||||
{
|
||||
writeToLog();
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
// you shouldn't throw exceptions from a sink
|
||||
Q_UNUSED(e);
|
||||
assert(!"exception in logger helper destructor");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//! sends the message to all the destinations
|
||||
void Logger::write(const QString &message)
|
||||
{
|
||||
for (DestinationList::iterator it = d->destList.begin(), endIt = d->destList.end();
|
||||
it != endIt; ++it)
|
||||
{
|
||||
if (!(*it))
|
||||
{
|
||||
assert(!"null log destination");
|
||||
continue;
|
||||
}
|
||||
(*it)->write(message);
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace
|
130
logger/QsLog.h
Normal file
130
logger/QsLog.h
Normal file
@ -0,0 +1,130 @@
|
||||
// Copyright (c) 2010, Razvan Petru
|
||||
// All rights reserved.
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
// list of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
// * The name of the contributors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
|
||||
namespace QsLogging
|
||||
{
|
||||
class Destination;
|
||||
enum Level
|
||||
{
|
||||
TraceLevel = 0,
|
||||
DebugLevel,
|
||||
InfoLevel,
|
||||
WarnLevel,
|
||||
ErrorLevel,
|
||||
FatalLevel,
|
||||
UnknownLevel
|
||||
};
|
||||
|
||||
class LoggerImpl; // d pointer
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
static Logger &instance()
|
||||
{
|
||||
static Logger staticLog;
|
||||
return staticLog;
|
||||
}
|
||||
|
||||
//! Adds a log message destination. Don't add null destinations.
|
||||
void addDestination(Destination *destination);
|
||||
//! Logging at a level < 'newLevel' will be ignored
|
||||
void setLoggingLevel(Level newLevel);
|
||||
//! The default level is INFO
|
||||
Level loggingLevel() const;
|
||||
|
||||
//! The helper forwards the streaming to QDebug and builds the final
|
||||
//! log message.
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
explicit Helper(Level logLevel);
|
||||
~Helper();
|
||||
QDebug &stream()
|
||||
{
|
||||
return qtDebug;
|
||||
}
|
||||
|
||||
private:
|
||||
void writeToLog();
|
||||
|
||||
Level level;
|
||||
QString buffer;
|
||||
QDebug qtDebug;
|
||||
};
|
||||
|
||||
private:
|
||||
Logger();
|
||||
Logger(const Logger &);
|
||||
Logger &operator=(const Logger &);
|
||||
~Logger();
|
||||
|
||||
void write(const QString &message);
|
||||
|
||||
LoggerImpl *d;
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
||||
#define QLOG_TRACE() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::TraceLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::TraceLevel).stream()
|
||||
#define QLOG_DEBUG() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::DebugLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::DebugLevel).stream()
|
||||
#define QLOG_INFO() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::InfoLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::InfoLevel).stream()
|
||||
#define QLOG_WARN() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::WarnLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::WarnLevel).stream()
|
||||
#define QLOG_ERROR() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::ErrorLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::ErrorLevel).stream()
|
||||
#define QLOG_FATAL() QsLogging::Logger::Helper(QsLogging::FatalLevel).stream()
|
||||
|
||||
/*
|
||||
#define QLOG_TRACE() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::TraceLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::TraceLevel).stream() << __FILE__ << '@' << __LINE__
|
||||
#define QLOG_DEBUG() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::DebugLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::DebugLevel).stream() << __FILE__ << '@' << __LINE__
|
||||
#define QLOG_INFO() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::InfoLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::InfoLevel).stream() << __FILE__ << '@' << __LINE__
|
||||
#define QLOG_WARN() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::WarnLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::WarnLevel).stream() << __FILE__ << '@' << __LINE__
|
||||
#define QLOG_ERROR() \
|
||||
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::ErrorLevel) \
|
||||
QsLogging::Logger::Helper(QsLogging::ErrorLevel).stream() << __FILE__ << '@' << __LINE__
|
||||
#define QLOG_FATAL() \
|
||||
QsLogging::Logger::Helper(QsLogging::FatalLevel).stream() << __FILE__ << '@' << __LINE__
|
||||
*/
|
83
logger/QsLogDest.cpp
Normal file
83
logger/QsLogDest.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2010, Razvan Petru
|
||||
// All rights reserved.
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
// list of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
// * The name of the contributors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "QsLogDest.h"
|
||||
#include "QsDebugOutput.h"
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QString>
|
||||
|
||||
namespace QsLogging
|
||||
{
|
||||
|
||||
//! file message sink
|
||||
class FileDestination : public Destination
|
||||
{
|
||||
public:
|
||||
FileDestination(const QString &filePath);
|
||||
virtual void write(const QString &message);
|
||||
|
||||
private:
|
||||
QFile mFile;
|
||||
QTextStream mOutputStream;
|
||||
};
|
||||
|
||||
FileDestination::FileDestination(const QString &filePath)
|
||||
{
|
||||
mFile.setFileName(filePath);
|
||||
mFile.open(QFile::WriteOnly | QFile::Text |
|
||||
QFile::Truncate); // fixme: should throw on failure
|
||||
mOutputStream.setDevice(&mFile);
|
||||
}
|
||||
|
||||
void FileDestination::write(const QString &message)
|
||||
{
|
||||
mOutputStream << message << endl;
|
||||
mOutputStream.flush();
|
||||
}
|
||||
|
||||
//! debugger sink
|
||||
class DebugOutputDestination : public Destination
|
||||
{
|
||||
public:
|
||||
virtual void write(const QString &message);
|
||||
};
|
||||
|
||||
void DebugOutputDestination::write(const QString &message)
|
||||
{
|
||||
QsDebugOutput::output(message);
|
||||
}
|
||||
|
||||
DestinationPtr DestinationFactory::MakeFileDestination(const QString &filePath)
|
||||
{
|
||||
return DestinationPtr(new FileDestination(filePath));
|
||||
}
|
||||
|
||||
DestinationPtr DestinationFactory::MakeDebugOutputDestination()
|
||||
{
|
||||
return DestinationPtr(new DebugOutputDestination);
|
||||
}
|
||||
|
||||
} // end namespace
|
53
logger/QsLogDest.h
Normal file
53
logger/QsLogDest.h
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2010, Razvan Petru
|
||||
// All rights reserved.
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
// list of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
// * The name of the contributors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
class QString;
|
||||
|
||||
namespace QsLogging
|
||||
{
|
||||
|
||||
class Destination
|
||||
{
|
||||
public:
|
||||
virtual ~Destination()
|
||||
{
|
||||
}
|
||||
virtual void write(const QString &message) = 0;
|
||||
};
|
||||
typedef std::shared_ptr<Destination> DestinationPtr;
|
||||
|
||||
//! Creates logging destinations/sinks. The caller will have ownership of
|
||||
//! the newly created destinations.
|
||||
class DestinationFactory
|
||||
{
|
||||
public:
|
||||
static DestinationPtr MakeFileDestination(const QString &filePath);
|
||||
static DestinationPtr MakeDebugOutputDestination();
|
||||
};
|
||||
|
||||
} // end namespace
|
@ -132,7 +132,7 @@ InstanceList *BaseInstance::instList() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QSharedPointer<BaseVersionList> BaseInstance::versionList() const
|
||||
std::shared_ptr<BaseVersionList> BaseInstance::versionList() const
|
||||
{
|
||||
return MMC->minecraftlist();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public:
|
||||
* \brief Gets a pointer to this instance's version list.
|
||||
* \return A pointer to the available version list for this instance.
|
||||
*/
|
||||
virtual QSharedPointer<BaseVersionList> versionList() const;
|
||||
virtual std::shared_ptr<BaseVersionList> versionList() const;
|
||||
|
||||
/*!
|
||||
* \brief Gets this instance's settings object.
|
||||
@ -179,9 +179,9 @@ signals:
|
||||
void nuked(BaseInstance * inst);
|
||||
|
||||
protected:
|
||||
QSharedPointer<BaseInstancePrivate> inst_d;
|
||||
std::shared_ptr<BaseInstancePrivate> inst_d;
|
||||
};
|
||||
|
||||
// pointer for lazy people
|
||||
typedef QSharedPointer<BaseInstance> InstancePtr;
|
||||
typedef std::shared_ptr<BaseInstance> InstancePtr;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class BaseInstance;
|
||||
|
||||
#define I_D(Class) Class##Private * const d = (Class##Private * const) inst_d.data()
|
||||
#define I_D(Class) Class##Private * const d = (Class##Private * const) inst_d.get()
|
||||
|
||||
struct BaseInstancePrivate
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QSharedPointer>
|
||||
#include <memory>
|
||||
|
||||
/*!
|
||||
* An abstract base class for versions.
|
||||
@ -40,6 +40,6 @@ struct BaseVersion
|
||||
virtual QString typeString() const = 0;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<BaseVersion> BaseVersionPtr;
|
||||
typedef std::shared_ptr<BaseVersion> BaseVersionPtr;
|
||||
|
||||
Q_DECLARE_METATYPE( BaseVersionPtr )
|
@ -10,7 +10,7 @@
|
||||
|
||||
ForgeInstaller::ForgeInstaller(QString filename, QString universal_url)
|
||||
{
|
||||
QSharedPointer<OneSixVersion> newVersion;
|
||||
std::shared_ptr<OneSixVersion> newVersion;
|
||||
m_universal_url = universal_url;
|
||||
|
||||
QuaZip zip(filename);
|
||||
@ -88,7 +88,7 @@ ForgeInstaller::ForgeInstaller(QString filename, QString universal_url)
|
||||
realVersionId = m_forge_version->id = installObj.value("minecraft").toString();
|
||||
}
|
||||
|
||||
bool ForgeInstaller::apply(QSharedPointer<OneSixVersion> to)
|
||||
bool ForgeInstaller::apply(std::shared_ptr<OneSixVersion> to)
|
||||
{
|
||||
if (!m_forge_version)
|
||||
return false;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <QString>
|
||||
#include <QSharedPointer>
|
||||
#include <memory>
|
||||
|
||||
class OneSixVersion;
|
||||
|
||||
@ -9,11 +9,11 @@ class ForgeInstaller
|
||||
public:
|
||||
ForgeInstaller(QString filename, QString universal_url);
|
||||
|
||||
bool apply(QSharedPointer<OneSixVersion> to);
|
||||
bool apply(std::shared_ptr<OneSixVersion> to);
|
||||
|
||||
private:
|
||||
// the version, read from the installer
|
||||
QSharedPointer<OneSixVersion> m_forge_version;
|
||||
std::shared_ptr<OneSixVersion> m_forge_version;
|
||||
QString internalPath;
|
||||
QString finalPath;
|
||||
QString realVersionId;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <setting.h>
|
||||
|
||||
#include "pathutils.h"
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
InstanceFactory InstanceFactory::loader;
|
||||
|
||||
@ -72,12 +73,12 @@ InstanceFactory::InstCreateError InstanceFactory::createInstance( BaseInstance*&
|
||||
{
|
||||
QDir rootDir(instDir);
|
||||
|
||||
qDebug(instDir.toUtf8());
|
||||
QLOG_DEBUG() << instDir.toUtf8();
|
||||
if (!rootDir.exists() && !rootDir.mkpath("."))
|
||||
{
|
||||
return InstanceFactory::CantCreateDir;
|
||||
}
|
||||
auto mcVer = version.dynamicCast<MinecraftVersion>();
|
||||
auto mcVer = std::dynamic_pointer_cast<MinecraftVersion>(version);
|
||||
if(!mcVer)
|
||||
return InstanceFactory::NoSuchVersion;
|
||||
|
||||
|
@ -61,7 +61,7 @@ int InstanceLauncher::launch()
|
||||
{
|
||||
std::cout << "Launching Instance '" << qPrintable ( instId ) << "'" << std::endl;
|
||||
auto instance = MMC->instances()->getInstanceById(instId);
|
||||
if ( instance.isNull() )
|
||||
if ( !instance )
|
||||
{
|
||||
std::cout << "Could not find instance requested. note that you have to specify the ID, not the NAME" << std::endl;
|
||||
return 1;
|
||||
|
@ -92,7 +92,7 @@ void LegacyInstance::cleanupAfterRun()
|
||||
//FIXME: delete the launcher and icons and whatnot.
|
||||
}
|
||||
|
||||
QSharedPointer< ModList > LegacyInstance::coreModList()
|
||||
std::shared_ptr< ModList > LegacyInstance::coreModList()
|
||||
{
|
||||
I_D(LegacyInstance);
|
||||
if(!d->core_mod_list)
|
||||
@ -104,7 +104,7 @@ QSharedPointer< ModList > LegacyInstance::coreModList()
|
||||
return d->core_mod_list;
|
||||
}
|
||||
|
||||
QSharedPointer< ModList > LegacyInstance::jarModList()
|
||||
std::shared_ptr< ModList > LegacyInstance::jarModList()
|
||||
{
|
||||
I_D(LegacyInstance);
|
||||
if(!d->jar_mod_list)
|
||||
@ -124,7 +124,7 @@ void LegacyInstance::jarModsChanged()
|
||||
}
|
||||
|
||||
|
||||
QSharedPointer< ModList > LegacyInstance::loaderModList()
|
||||
std::shared_ptr< ModList > LegacyInstance::loaderModList()
|
||||
{
|
||||
I_D(LegacyInstance);
|
||||
if(!d->loader_mod_list)
|
||||
@ -136,7 +136,7 @@ QSharedPointer< ModList > LegacyInstance::loaderModList()
|
||||
return d->loader_mod_list;
|
||||
}
|
||||
|
||||
QSharedPointer< ModList > LegacyInstance::texturePackList()
|
||||
std::shared_ptr< ModList > LegacyInstance::texturePackList()
|
||||
{
|
||||
I_D(LegacyInstance);
|
||||
if(!d->texture_pack_list)
|
||||
|
@ -19,10 +19,10 @@ public:
|
||||
QString modListFile() const;
|
||||
|
||||
////// Mod Lists //////
|
||||
QSharedPointer<ModList> jarModList();
|
||||
QSharedPointer<ModList> coreModList();
|
||||
QSharedPointer<ModList> loaderModList();
|
||||
QSharedPointer<ModList> texturePackList();
|
||||
std::shared_ptr<ModList> jarModList();
|
||||
std::shared_ptr<ModList> coreModList();
|
||||
std::shared_ptr<ModList> loaderModList();
|
||||
std::shared_ptr<ModList> texturePackList();
|
||||
|
||||
////// Directories //////
|
||||
QString savesDir() const;
|
||||
|
@ -9,8 +9,8 @@ class ModList;
|
||||
|
||||
struct LegacyInstancePrivate: public BaseInstancePrivate
|
||||
{
|
||||
QSharedPointer<ModList> jar_mod_list;
|
||||
QSharedPointer<ModList> core_mod_list;
|
||||
QSharedPointer<ModList> loader_mod_list;
|
||||
QSharedPointer<ModList> texture_pack_list;
|
||||
std::shared_ptr<ModList> jar_mod_list;
|
||||
std::shared_ptr<ModList> core_mod_list;
|
||||
std::shared_ptr<ModList> loader_mod_list;
|
||||
std::shared_ptr<ModList> texture_pack_list;
|
||||
};
|
@ -9,9 +9,11 @@
|
||||
#include <quazip.h>
|
||||
#include <quazipfile.h>
|
||||
#include <JlCompress.h>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
|
||||
LegacyUpdate::LegacyUpdate ( BaseInstance* inst, QObject* parent ) : BaseUpdate ( inst, parent ) {}
|
||||
LegacyUpdate::LegacyUpdate(BaseInstance *inst, QObject *parent) : BaseUpdate(inst, parent)
|
||||
{
|
||||
}
|
||||
|
||||
void LegacyUpdate::executeTask()
|
||||
{
|
||||
@ -58,28 +60,31 @@ void LegacyUpdate::lwjglStart()
|
||||
req.setHeader(QNetworkRequest::UserAgentHeader, "Wget/1.14 (linux-gnu)");
|
||||
QNetworkReply *rep = worker->get(req);
|
||||
|
||||
m_reply = QSharedPointer<QNetworkReply> (rep, &QObject::deleteLater);
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
|
||||
connect(worker.data(), SIGNAL(finished(QNetworkReply*)), SLOT(lwjglFinished(QNetworkReply*)));
|
||||
//connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(downloadError(QNetworkReply::NetworkError)));
|
||||
connect(worker.get(), SIGNAL(finished(QNetworkReply *)),
|
||||
SLOT(lwjglFinished(QNetworkReply *)));
|
||||
// connect(rep, SIGNAL(error(QNetworkReply::NetworkError)),
|
||||
// SLOT(downloadError(QNetworkReply::NetworkError)));
|
||||
}
|
||||
|
||||
void LegacyUpdate::lwjglFinished(QNetworkReply *reply)
|
||||
{
|
||||
if(m_reply != reply)
|
||||
if (m_reply.get() != reply)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
emitFailed( "Failed to download: "+
|
||||
reply->errorString()+
|
||||
"\nSometimes you have to wait a bit if you download many LWJGL versions in a row. YMMV");
|
||||
emitFailed("Failed to download: " + reply->errorString() +
|
||||
"\nSometimes you have to wait a bit if you download many LWJGL versions in "
|
||||
"a row. YMMV");
|
||||
return;
|
||||
}
|
||||
auto worker = MMC->qnam();
|
||||
// Here i check if there is a cookie for me in the reply and extract it
|
||||
QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie>>(reply->header(QNetworkRequest::SetCookieHeader));
|
||||
QList<QNetworkCookie> cookies =
|
||||
qvariant_cast<QList<QNetworkCookie>>(reply->header(QNetworkRequest::SetCookieHeader));
|
||||
if (cookies.count() != 0)
|
||||
{
|
||||
// you must tell which cookie goes with which url
|
||||
@ -97,8 +102,9 @@ void LegacyUpdate::lwjglFinished(QNetworkReply* reply)
|
||||
req.setRawHeader("Host", hostname.toLatin1());
|
||||
req.setHeader(QNetworkRequest::UserAgentHeader, "Wget/1.14 (linux-gnu)");
|
||||
QNetworkReply *rep = worker->get(req);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64,qint64)), SIGNAL(progress(qint64,qint64)));
|
||||
m_reply = QSharedPointer<QNetworkReply> (rep, &QObject::deleteLater);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SIGNAL(progress(qint64, qint64)));
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
return;
|
||||
}
|
||||
QFile saveMe("lwjgl.zip");
|
||||
@ -190,7 +196,7 @@ void LegacyUpdate::extractLwjgl()
|
||||
file.close(); // do not forget to close!
|
||||
}
|
||||
zip.close();
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
QFile doneFile(PathCombine(lwjglTargetPath, "done"));
|
||||
doneFile.open(QIODevice::WriteOnly);
|
||||
doneFile.write("done.");
|
||||
@ -248,7 +254,8 @@ void LegacyUpdate::jarFailed()
|
||||
emitFailed("Failed to download the minecraft jar. Try again later.");
|
||||
}
|
||||
|
||||
bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >& contained, MetainfAction metainf )
|
||||
bool LegacyUpdate::MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained,
|
||||
MetainfAction metainf)
|
||||
{
|
||||
setStatus("Installing mods - Adding " + from.fileName());
|
||||
|
||||
@ -262,20 +269,21 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
|
||||
QString filename = modZip.getCurrentFileName();
|
||||
if (filename.contains("META-INF") && metainf == LegacyUpdate::IgnoreMetainf)
|
||||
{
|
||||
qDebug() << "Skipping META-INF " << filename << " from " << from.fileName();
|
||||
QLOG_INFO() << "Skipping META-INF " << filename << " from " << from.fileName();
|
||||
continue;
|
||||
}
|
||||
if (contained.contains(filename))
|
||||
{
|
||||
qDebug() << "Skipping already contained file " << filename << " from " << from.fileName();
|
||||
QLOG_INFO() << "Skipping already contained file " << filename << " from "
|
||||
<< from.fileName();
|
||||
continue;
|
||||
}
|
||||
contained.insert(filename);
|
||||
qDebug() << "Adding file " << filename << " from " << from.fileName();
|
||||
QLOG_INFO() << "Adding file " << filename << " from " << from.fileName();
|
||||
|
||||
if (!fileInsideMod.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug() << "Failed to open " << filename << " from " << from.fileName();
|
||||
QLOG_ERROR() << "Failed to open " << filename << " from " << from.fileName();
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
@ -288,7 +296,7 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
|
||||
*/
|
||||
if (!zipOutFile.open(QIODevice::WriteOnly, info_out))
|
||||
{
|
||||
qDebug() << "Failed to open " << filename << " in the jar";
|
||||
QLOG_ERROR() << "Failed to open " << filename << " in the jar";
|
||||
fileInsideMod.close();
|
||||
return false;
|
||||
}
|
||||
@ -296,7 +304,7 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
|
||||
{
|
||||
zipOutFile.close();
|
||||
fileInsideMod.close();
|
||||
qDebug() << "Failed to copy data of " << filename << " into the jar";
|
||||
QLOG_ERROR() << "Failed to copy data of " << filename << " into the jar";
|
||||
return false;
|
||||
}
|
||||
zipOutFile.close();
|
||||
@ -387,7 +395,8 @@ void LegacyUpdate::ModTheJar()
|
||||
else if (mod.type() == Mod::MOD_SINGLEFILE)
|
||||
{
|
||||
auto filename = mod.filename();
|
||||
if(!JlCompress::compressFile(&zipOut, filename.absoluteFilePath(), filename.fileName()))
|
||||
if (!JlCompress::compressFile(&zipOut, filename.absoluteFilePath(),
|
||||
filename.fileName()))
|
||||
{
|
||||
zipOut.close();
|
||||
QFile::remove(runnableJar.filePath());
|
||||
@ -395,7 +404,8 @@ void LegacyUpdate::ModTheJar()
|
||||
return;
|
||||
}
|
||||
addedFiles.insert(filename.fileName());
|
||||
qDebug() << "Adding file " << filename.fileName() << " from " << filename.absoluteFilePath();
|
||||
QLOG_INFO() << "Adding file " << filename.fileName() << " from "
|
||||
<< filename.absoluteFilePath();
|
||||
}
|
||||
else if (mod.type() == Mod::MOD_FOLDER)
|
||||
{
|
||||
@ -411,7 +421,8 @@ void LegacyUpdate::ModTheJar()
|
||||
emitFailed("Failed to add " + filename.fileName() + " to the jar");
|
||||
return;
|
||||
}
|
||||
qDebug() << "Adding folder " << filename.fileName() << " from " << filename.absoluteFilePath();
|
||||
QLOG_INFO() << "Adding folder " << filename.fileName() << " from "
|
||||
<< filename.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
bool MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString>& contained, MetainfAction metainf);
|
||||
private:
|
||||
|
||||
QSharedPointer<QNetworkReply> m_reply;
|
||||
std::shared_ptr<QNetworkReply> m_reply;
|
||||
|
||||
// target version, determined during this task
|
||||
// MinecraftVersion *targetVersion;
|
||||
|
@ -20,14 +20,13 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QDebug>
|
||||
#include <quazip.h>
|
||||
#include <quazipfile.h>
|
||||
|
||||
#include "Mod.h"
|
||||
#include <pathutils.h>
|
||||
#include <inifile.h>
|
||||
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
Mod::Mod( const QFileInfo& file )
|
||||
{
|
||||
@ -134,8 +133,8 @@ void Mod::ReadMCModInfo(QByteArray contents)
|
||||
int version = val.toDouble();
|
||||
if(version != 2)
|
||||
{
|
||||
qDebug() << "BAD stuff happened to mod json:";
|
||||
qDebug() << contents;
|
||||
QLOG_ERROR() << "BAD stuff happened to mod json:";
|
||||
QLOG_ERROR() << contents;
|
||||
return;
|
||||
}
|
||||
auto arrVal = jsonDoc.object().value("modlist");
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include <pathutils.h>
|
||||
#include <QMimeData>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
#include <QUuid>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
ModList::ModList ( const QString& dir, const QString& list_file )
|
||||
: QAbstractListModel(), m_dir(dir), m_list_file(list_file)
|
||||
@ -39,18 +39,18 @@ void ModList::startWatching()
|
||||
{
|
||||
is_watching = m_watcher->addPath(m_dir.absolutePath());
|
||||
if(is_watching)
|
||||
qDebug() << "Started watching " << m_dir.absolutePath();
|
||||
QLOG_INFO() << "Started watching " << m_dir.absolutePath();
|
||||
else
|
||||
qDebug() << "Failed to start watching " << m_dir.absolutePath();
|
||||
QLOG_INFO() << "Failed to start watching " << m_dir.absolutePath();
|
||||
}
|
||||
|
||||
void ModList::stopWatching()
|
||||
{
|
||||
is_watching = !m_watcher->removePath(m_dir.absolutePath());
|
||||
if(!is_watching)
|
||||
qDebug() << "Stopped watching " << m_dir.absolutePath();
|
||||
QLOG_INFO() << "Stopped watching " << m_dir.absolutePath();
|
||||
else
|
||||
qDebug() << "Failed to stop watching " << m_dir.absolutePath();
|
||||
QLOG_INFO() << "Failed to stop watching " << m_dir.absolutePath();
|
||||
}
|
||||
|
||||
|
||||
@ -436,7 +436,7 @@ bool ModList::dropMimeData ( const QMimeData* data, Qt::DropAction action, int r
|
||||
row = rowCount();
|
||||
if (column == -1)
|
||||
column = 0;
|
||||
qDebug() << "Drop row: " << row << " column: " << column;
|
||||
QLOG_INFO() << "Drop row: " << row << " column: " << column;
|
||||
|
||||
// files dropped from outside?
|
||||
if(data->hasUrls())
|
||||
@ -452,7 +452,7 @@ bool ModList::dropMimeData ( const QMimeData* data, Qt::DropAction action, int r
|
||||
continue;
|
||||
QString filename = url.toLocalFile();
|
||||
installMod(filename, row);
|
||||
qDebug() << "installing: " << filename;
|
||||
QLOG_INFO() << "installing: " << filename;
|
||||
}
|
||||
if(was_watching)
|
||||
startWatching();
|
||||
@ -466,7 +466,7 @@ bool ModList::dropMimeData ( const QMimeData* data, Qt::DropAction action, int r
|
||||
return false;
|
||||
QString remoteId = list[0];
|
||||
int remoteIndex = list[1].toInt();
|
||||
qDebug() << "move: " << sourcestr;
|
||||
QLOG_INFO() << "move: " << sourcestr;
|
||||
// no moving of things between two lists
|
||||
if(remoteId != m_list_id)
|
||||
return false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
#include <QtXml/QtXml>
|
||||
#include "OneSixAssets.h"
|
||||
#include "net/DownloadJob.h"
|
||||
@ -21,6 +21,7 @@ class ThreadedDeleter : public QThread
|
||||
public:
|
||||
void run()
|
||||
{
|
||||
QLOG_INFO() << "Cleaning up assets folder...";
|
||||
QDirIterator iter ( m_base, QDirIterator::Subdirectories );
|
||||
int base_length = m_base.length();
|
||||
while ( iter.hasNext() )
|
||||
@ -34,12 +35,12 @@ public:
|
||||
trimmedf.remove ( 0, base_length + 1 );
|
||||
if ( m_whitelist.contains ( trimmedf ) )
|
||||
{
|
||||
// qDebug() << trimmedf << " gets to live";
|
||||
QLOG_TRACE() << trimmedf << " gets to live";
|
||||
}
|
||||
else
|
||||
{
|
||||
// DO NOT TOLERATE JUNK
|
||||
// qDebug() << trimmedf << " dies";
|
||||
QLOG_TRACE() << trimmedf << " dies";
|
||||
QFile f ( filename );
|
||||
f.remove();
|
||||
}
|
||||
@ -67,13 +68,15 @@ void OneSixAssets::fetchXMLFinished()
|
||||
nuke_whitelist.clear();
|
||||
|
||||
auto firstJob = index_job->first();
|
||||
QByteArray ba = firstJob.dynamicCast<ByteArrayDownload>()->m_data;
|
||||
QByteArray ba = std::dynamic_pointer_cast<ByteArrayDownload>(firstJob)->m_data;
|
||||
|
||||
QString xmlErrorMsg;
|
||||
QDomDocument doc;
|
||||
if ( !doc.setContent ( ba, false, &xmlErrorMsg ) )
|
||||
{
|
||||
qDebug() << "Failed to process s3.amazonaws.com/Minecraft.Resources. XML error:" << xmlErrorMsg << ba;
|
||||
QLOG_ERROR() << "Failed to process s3.amazonaws.com/Minecraft.Resources. XML error:" << xmlErrorMsg << ba;
|
||||
emit failed();
|
||||
return;
|
||||
}
|
||||
//QRegExp etag_match(".*([a-f0-9]{32}).*");
|
||||
QDomNodeList contents = doc.elementsByTagName ( "Contents" );
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <cmdutils.h>
|
||||
#include <JlCompress.h>
|
||||
#include <gui/OneSixModEditDialog.h>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
OneSixInstance::OneSixInstance(const QString &rootDir, SettingsObject *setting_obj,
|
||||
QObject *parent)
|
||||
@ -102,7 +103,7 @@ MinecraftProcess *OneSixInstance::prepareForLaunch(LoginResponse response)
|
||||
for (auto lib : libs_to_extract)
|
||||
{
|
||||
QString path = "libraries/" + lib->storagePath();
|
||||
qDebug() << "Will extract " << path.toLocal8Bit();
|
||||
QLOG_INFO() << "Will extract " << path.toLocal8Bit();
|
||||
if (JlCompress::extractWithExceptions(path, natives_dir_raw, lib->extract_excludes)
|
||||
.isEmpty())
|
||||
{
|
||||
@ -156,7 +157,7 @@ void OneSixInstance::cleanupAfterRun()
|
||||
dir.removeRecursively();
|
||||
}
|
||||
|
||||
QSharedPointer<ModList> OneSixInstance::loaderModList()
|
||||
std::shared_ptr<ModList> OneSixInstance::loaderModList()
|
||||
{
|
||||
I_D(OneSixInstance);
|
||||
if (!d->loader_mod_list)
|
||||
@ -168,7 +169,7 @@ QSharedPointer<ModList> OneSixInstance::loaderModList()
|
||||
return d->loader_mod_list;
|
||||
}
|
||||
|
||||
QSharedPointer<ModList> OneSixInstance::resourcePackList()
|
||||
std::shared_ptr<ModList> OneSixInstance::resourcePackList()
|
||||
{
|
||||
I_D(OneSixInstance);
|
||||
if (!d->resource_pack_list)
|
||||
@ -271,7 +272,7 @@ bool OneSixInstance::reloadFullVersion()
|
||||
return false;
|
||||
}
|
||||
|
||||
QSharedPointer<OneSixVersion> OneSixInstance::getFullVersion()
|
||||
std::shared_ptr<OneSixVersion> OneSixInstance::getFullVersion()
|
||||
{
|
||||
I_D(OneSixInstance);
|
||||
return d->version;
|
||||
|
@ -14,8 +14,8 @@ public:
|
||||
|
||||
|
||||
////// Mod Lists //////
|
||||
QSharedPointer<ModList> loaderModList();
|
||||
QSharedPointer<ModList> resourcePackList();
|
||||
std::shared_ptr<ModList> loaderModList();
|
||||
std::shared_ptr<ModList> resourcePackList();
|
||||
|
||||
////// Directories //////
|
||||
QString resourcePacksDir() const;
|
||||
@ -40,7 +40,7 @@ public:
|
||||
/// reload the full version json file. return true on success!
|
||||
bool reloadFullVersion();
|
||||
/// get the current full version info
|
||||
QSharedPointer<OneSixVersion> getFullVersion();
|
||||
std::shared_ptr<OneSixVersion> getFullVersion();
|
||||
/// revert the current custom version back to base
|
||||
bool revertCustomVersion();
|
||||
/// customize the current base version
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
struct OneSixInstancePrivate: public BaseInstancePrivate
|
||||
{
|
||||
QSharedPointer<OneSixVersion> version;
|
||||
QSharedPointer<ModList> loader_mod_list;
|
||||
QSharedPointer<ModList> resource_pack_list;
|
||||
std::shared_ptr<OneSixVersion> version;
|
||||
std::shared_ptr<ModList> loader_mod_list;
|
||||
std::shared_ptr<ModList> resource_pack_list;
|
||||
};
|
@ -72,7 +72,7 @@ void OneSixLibrary::addNative(OpSys os, QString suffix)
|
||||
m_is_native = true;
|
||||
m_native_suffixes[os] = suffix;
|
||||
}
|
||||
void OneSixLibrary::setRules(QList<QSharedPointer<Rule>> rules)
|
||||
void OneSixLibrary::setRules(QList<std::shared_ptr<Rule>> rules)
|
||||
{
|
||||
m_rules = rules;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <QSharedPointer>
|
||||
#include <memory>
|
||||
#include <QJsonObject>
|
||||
#include "OpSys.h"
|
||||
|
||||
@ -14,7 +14,7 @@ private:
|
||||
// basic values used internally (so far)
|
||||
QString m_name;
|
||||
QString m_base_url = "https://s3.amazonaws.com/Minecraft.Download/libraries/";
|
||||
QList<QSharedPointer<Rule> > m_rules;
|
||||
QList<std::shared_ptr<Rule> > m_rules;
|
||||
|
||||
// custom values
|
||||
/// absolute URL. takes precedence over m_download_path, if defined
|
||||
@ -83,7 +83,7 @@ public:
|
||||
/// Attach a name suffix to the specified OS native
|
||||
void addNative(OpSys os, QString suffix);
|
||||
/// Set the load rules
|
||||
void setRules(QList<QSharedPointer<Rule> > rules);
|
||||
void setRules(QList<std::shared_ptr<Rule> > rules);
|
||||
|
||||
/// Returns true if the library should be loaded (or extracted, in case of natives)
|
||||
bool isActive();
|
||||
|
@ -2,9 +2,9 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
QList<QSharedPointer<Rule>> rulesFromJsonV4(QJsonObject &objectWithRules)
|
||||
QList<std::shared_ptr<Rule>> rulesFromJsonV4(QJsonObject &objectWithRules)
|
||||
{
|
||||
QList<QSharedPointer<Rule>> rules;
|
||||
QList<std::shared_ptr<Rule>> rules;
|
||||
auto rulesVal = objectWithRules.value("rules");
|
||||
if (!rulesVal.isArray())
|
||||
return rules;
|
||||
@ -12,7 +12,7 @@ QList<QSharedPointer<Rule>> rulesFromJsonV4(QJsonObject &objectWithRules)
|
||||
QJsonArray ruleList = rulesVal.toArray();
|
||||
for (auto ruleVal : ruleList)
|
||||
{
|
||||
QSharedPointer<Rule> rule;
|
||||
std::shared_ptr<Rule> rule;
|
||||
if (!ruleVal.isObject())
|
||||
continue;
|
||||
auto ruleObj = ruleVal.toObject();
|
||||
|
@ -11,7 +11,7 @@ enum RuleAction
|
||||
};
|
||||
|
||||
RuleAction RuleAction_fromString(QString);
|
||||
QList<QSharedPointer<Rule>> rulesFromJsonV4(QJsonObject &objectWithRules);
|
||||
QList<std::shared_ptr<Rule>> rulesFromJsonV4(QJsonObject &objectWithRules);
|
||||
|
||||
class Rule
|
||||
{
|
||||
@ -48,9 +48,9 @@ protected:
|
||||
: Rule(result), m_system(system), m_version_regexp(version_regexp) {}
|
||||
public:
|
||||
virtual QJsonObject toJson();
|
||||
static QSharedPointer<OsRule> create(RuleAction result, OpSys system, QString version_regexp)
|
||||
static std::shared_ptr<OsRule> create(RuleAction result, OpSys system, QString version_regexp)
|
||||
{
|
||||
return QSharedPointer<OsRule> (new OsRule(result, system, version_regexp));
|
||||
return std::shared_ptr<OsRule> (new OsRule(result, system, version_regexp));
|
||||
}
|
||||
};
|
||||
|
||||
@ -65,8 +65,8 @@ protected:
|
||||
: Rule(result) {}
|
||||
public:
|
||||
virtual QJsonObject toJson();
|
||||
static QSharedPointer<ImplicitRule> create(RuleAction result)
|
||||
static std::shared_ptr<ImplicitRule> create(RuleAction result)
|
||||
{
|
||||
return QSharedPointer<ImplicitRule> (new ImplicitRule(result));
|
||||
return std::shared_ptr<ImplicitRule> (new ImplicitRule(result));
|
||||
}
|
||||
};
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include <QTextStream>
|
||||
#include <QDataStream>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "BaseInstance.h"
|
||||
#include "lists/MinecraftVersionList.h"
|
||||
#include "OneSixVersion.h"
|
||||
@ -49,8 +47,8 @@ void OneSixUpdate::executeTask()
|
||||
}
|
||||
|
||||
// Get a pointer to the version object that corresponds to the instance's version.
|
||||
targetVersion =
|
||||
MMC->minecraftlist()->findVersion(intendedVersion).dynamicCast<MinecraftVersion>();
|
||||
targetVersion = std::dynamic_pointer_cast<MinecraftVersion>(
|
||||
MMC->minecraftlist()->findVersion(intendedVersion));
|
||||
if (targetVersion == nullptr)
|
||||
{
|
||||
// don't do anything if it was invalid
|
||||
@ -77,10 +75,9 @@ void OneSixUpdate::versionFileStart()
|
||||
auto job = new DownloadJob("Version index");
|
||||
job->addByteArrayDownload(QUrl(urlstr));
|
||||
specificVersionDownloadJob.reset(job);
|
||||
connect(specificVersionDownloadJob.data(), SIGNAL(succeeded()),
|
||||
SLOT(versionFileFinished()));
|
||||
connect(specificVersionDownloadJob.data(), SIGNAL(failed()), SLOT(versionFileFailed()));
|
||||
connect(specificVersionDownloadJob.data(), SIGNAL(progress(qint64, qint64)),
|
||||
connect(specificVersionDownloadJob.get(), SIGNAL(succeeded()), SLOT(versionFileFinished()));
|
||||
connect(specificVersionDownloadJob.get(), SIGNAL(failed()), SLOT(versionFileFailed()));
|
||||
connect(specificVersionDownloadJob.get(), SIGNAL(progress(qint64, qint64)),
|
||||
SIGNAL(progress(qint64, qint64)));
|
||||
specificVersionDownloadJob->start();
|
||||
}
|
||||
@ -103,7 +100,7 @@ void OneSixUpdate::versionFileFinished()
|
||||
emitFailed("Can't open " + version1 + " for writing.");
|
||||
return;
|
||||
}
|
||||
auto data = DlJob.dynamicCast<ByteArrayDownload>()->m_data;
|
||||
auto data = std::dynamic_pointer_cast<ByteArrayDownload>(DlJob)->m_data;
|
||||
qint64 actual = 0;
|
||||
if ((actual = vfile1.write(data)) != data.size())
|
||||
{
|
||||
@ -149,7 +146,7 @@ void OneSixUpdate::jarlibStart()
|
||||
return;
|
||||
}
|
||||
|
||||
QSharedPointer<OneSixVersion> version = inst->getFullVersion();
|
||||
std::shared_ptr<OneSixVersion> version = inst->getFullVersion();
|
||||
|
||||
// download the right jar, save it in versions/$version/$version.jar
|
||||
QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
|
||||
@ -177,9 +174,9 @@ void OneSixUpdate::jarlibStart()
|
||||
jarlibDownloadJob->addCacheDownload(download_path, entry);
|
||||
}
|
||||
}
|
||||
connect(jarlibDownloadJob.data(), SIGNAL(succeeded()), SLOT(jarlibFinished()));
|
||||
connect(jarlibDownloadJob.data(), SIGNAL(failed()), SLOT(jarlibFailed()));
|
||||
connect(jarlibDownloadJob.data(), SIGNAL(progress(qint64, qint64)),
|
||||
connect(jarlibDownloadJob.get(), SIGNAL(succeeded()), SLOT(jarlibFinished()));
|
||||
connect(jarlibDownloadJob.get(), SIGNAL(failed()), SLOT(jarlibFailed()));
|
||||
connect(jarlibDownloadJob.get(), SIGNAL(progress(qint64, qint64)),
|
||||
SIGNAL(progress(qint64, qint64)));
|
||||
|
||||
jarlibDownloadJob->start();
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
DownloadJobPtr jarlibDownloadJob;
|
||||
|
||||
// target version, determined during this task
|
||||
QSharedPointer<MinecraftVersion> targetVersion;
|
||||
std::shared_ptr<MinecraftVersion> targetVersion;
|
||||
};
|
||||
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include "OneSixLibrary.h"
|
||||
#include "OneSixRule.h"
|
||||
|
||||
QSharedPointer<OneSixVersion> fromJsonV4(QJsonObject root,
|
||||
QSharedPointer<OneSixVersion> fullVersion)
|
||||
std::shared_ptr<OneSixVersion> fromJsonV4(QJsonObject root,
|
||||
std::shared_ptr<OneSixVersion> fullVersion)
|
||||
{
|
||||
fullVersion->id = root.value("id").toString();
|
||||
|
||||
@ -64,7 +64,7 @@ QSharedPointer<OneSixVersion> fromJsonV4(QJsonObject root,
|
||||
auto nameVal = libObj.value("name");
|
||||
if (!nameVal.isString())
|
||||
continue;
|
||||
QSharedPointer<OneSixLibrary> library(new OneSixLibrary(nameVal.toString()));
|
||||
std::shared_ptr<OneSixLibrary> library(new OneSixLibrary(nameVal.toString()));
|
||||
|
||||
auto urlVal = libObj.value("url");
|
||||
if (urlVal.isString())
|
||||
@ -129,9 +129,9 @@ QSharedPointer<OneSixVersion> fromJsonV4(QJsonObject root,
|
||||
return fullVersion;
|
||||
}
|
||||
|
||||
QSharedPointer<OneSixVersion> OneSixVersion::fromJson(QJsonObject root)
|
||||
std::shared_ptr<OneSixVersion> OneSixVersion::fromJson(QJsonObject root)
|
||||
{
|
||||
QSharedPointer<OneSixVersion> readVersion(new OneSixVersion());
|
||||
std::shared_ptr<OneSixVersion> readVersion(new OneSixVersion());
|
||||
int launcher_ver = readVersion->minimumLauncherVersion =
|
||||
root.value("minimumLauncherVersion").toDouble();
|
||||
|
||||
@ -140,16 +140,16 @@ QSharedPointer<OneSixVersion> OneSixVersion::fromJson(QJsonObject root)
|
||||
return fromJsonV4(root, readVersion);
|
||||
else
|
||||
{
|
||||
return QSharedPointer<OneSixVersion>();
|
||||
return std::shared_ptr<OneSixVersion>();
|
||||
}
|
||||
}
|
||||
|
||||
QSharedPointer<OneSixVersion> OneSixVersion::fromFile(QString filepath)
|
||||
std::shared_ptr<OneSixVersion> OneSixVersion::fromFile(QString filepath)
|
||||
{
|
||||
QFile file(filepath);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
return QSharedPointer<OneSixVersion>();
|
||||
return std::shared_ptr<OneSixVersion>();
|
||||
}
|
||||
|
||||
auto data = file.readAll();
|
||||
@ -158,12 +158,12 @@ QSharedPointer<OneSixVersion> OneSixVersion::fromFile(QString filepath)
|
||||
|
||||
if (jsonError.error != QJsonParseError::NoError)
|
||||
{
|
||||
return QSharedPointer<OneSixVersion>();
|
||||
return std::shared_ptr<OneSixVersion>();
|
||||
}
|
||||
|
||||
if (!jsonDoc.isObject())
|
||||
{
|
||||
return QSharedPointer<OneSixVersion>();
|
||||
return std::shared_ptr<OneSixVersion>();
|
||||
}
|
||||
QJsonObject root = jsonDoc.object();
|
||||
auto version = fromJson(root);
|
||||
@ -202,9 +202,9 @@ bool OneSixVersion::toOriginalFile()
|
||||
return file.commit();
|
||||
}
|
||||
|
||||
QList<QSharedPointer<OneSixLibrary>> OneSixVersion::getActiveNormalLibs()
|
||||
QList<std::shared_ptr<OneSixLibrary>> OneSixVersion::getActiveNormalLibs()
|
||||
{
|
||||
QList<QSharedPointer<OneSixLibrary>> output;
|
||||
QList<std::shared_ptr<OneSixLibrary>> output;
|
||||
for (auto lib : libraries)
|
||||
{
|
||||
if (lib->isActive() && !lib->isNative())
|
||||
@ -215,9 +215,9 @@ QList<QSharedPointer<OneSixLibrary>> OneSixVersion::getActiveNormalLibs()
|
||||
return output;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<OneSixLibrary>> OneSixVersion::getActiveNativeLibs()
|
||||
QList<std::shared_ptr<OneSixLibrary>> OneSixVersion::getActiveNativeLibs()
|
||||
{
|
||||
QList<QSharedPointer<OneSixLibrary>> output;
|
||||
QList<std::shared_ptr<OneSixLibrary>> output;
|
||||
for (auto lib : libraries)
|
||||
{
|
||||
if (lib->isActive() && lib->isNative())
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#include <QtCore>
|
||||
#include <memory>
|
||||
|
||||
class OneSixLibrary;
|
||||
|
||||
class OneSixVersion : public QAbstractListModel
|
||||
@ -16,12 +18,12 @@ public:
|
||||
// serialization/deserialization
|
||||
public:
|
||||
bool toOriginalFile();
|
||||
static QSharedPointer<OneSixVersion> fromJson(QJsonObject root);
|
||||
static QSharedPointer<OneSixVersion> fromFile(QString filepath);
|
||||
static std::shared_ptr<OneSixVersion> fromJson(QJsonObject root);
|
||||
static std::shared_ptr<OneSixVersion> fromFile(QString filepath);
|
||||
|
||||
public:
|
||||
QList<QSharedPointer<OneSixLibrary>> getActiveNormalLibs();
|
||||
QList<QSharedPointer<OneSixLibrary>> getActiveNativeLibs();
|
||||
QList<std::shared_ptr<OneSixLibrary>> getActiveNormalLibs();
|
||||
QList<std::shared_ptr<OneSixLibrary>> getActiveNativeLibs();
|
||||
// called when something starts/stops messing with the object
|
||||
// FIXME: these are ugly in every possible way.
|
||||
void externalUpdateStart();
|
||||
@ -62,7 +64,7 @@ public:
|
||||
QString mainClass;
|
||||
|
||||
/// the list of libs - both active and inactive, native and java
|
||||
QList<QSharedPointer<OneSixLibrary>> libraries;
|
||||
QList<std::shared_ptr<OneSixLibrary>> libraries;
|
||||
|
||||
/*
|
||||
FIXME: add support for those rules here? Looks like a pile of quick hacks to me though.
|
||||
|
@ -18,11 +18,11 @@
|
||||
#include "MultiMC.h"
|
||||
|
||||
#include <QtNetwork>
|
||||
|
||||
#include <QtXml>
|
||||
|
||||
#include <QRegExp>
|
||||
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
#define JSON_URL "http://files.minecraftforge.net/minecraftforge/json"
|
||||
|
||||
ForgeVersionList::ForgeVersionList(QObject *parent) : BaseVersionList(parent)
|
||||
@ -62,7 +62,7 @@ QVariant ForgeVersionList::data(const QModelIndex &index, int role) const
|
||||
if (index.row() > count())
|
||||
return QVariant();
|
||||
|
||||
auto version = m_vlist[index.row()].dynamicCast<ForgeVersion>();
|
||||
auto version = std::dynamic_pointer_cast<ForgeVersion>(m_vlist[index.row()]);
|
||||
switch (role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
@ -164,9 +164,9 @@ void ForgeListLoadTask::executeTask()
|
||||
auto forgeListEntry = MMC->metacache()->resolveEntry("minecraftforge", "list.json");
|
||||
job->addCacheDownload(QUrl(JSON_URL), forgeListEntry);
|
||||
listJob.reset(job);
|
||||
connect(listJob.data(), SIGNAL(succeeded()), SLOT(list_downloaded()));
|
||||
connect(listJob.data(), SIGNAL(failed()), SLOT(list_failed()));
|
||||
connect(listJob.data(), SIGNAL(progress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
|
||||
connect(listJob.get(), SIGNAL(succeeded()), SLOT(list_downloaded()));
|
||||
connect(listJob.get(), SIGNAL(failed()), SLOT(list_failed()));
|
||||
connect(listJob.get(), SIGNAL(progress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
|
||||
listJob->start();
|
||||
}
|
||||
|
||||
@ -176,10 +176,10 @@ void ForgeListLoadTask::list_failed()
|
||||
auto reply = DlJob->m_reply;
|
||||
if(reply)
|
||||
{
|
||||
qDebug() << "Getting forge version list failed: " << reply->errorString();
|
||||
QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString();
|
||||
}
|
||||
else
|
||||
qDebug() << "Getting forge version list failed for reasons unknown.";
|
||||
QLOG_ERROR() << "Getting forge version list failed for reasons unknown.";
|
||||
}
|
||||
|
||||
void ForgeListLoadTask::list_downloaded()
|
||||
@ -187,7 +187,7 @@ void ForgeListLoadTask::list_downloaded()
|
||||
QByteArray data;
|
||||
{
|
||||
auto DlJob = listJob->first();
|
||||
auto filename = DlJob.dynamicCast<CacheDownload>()->m_target_path;
|
||||
auto filename = std::dynamic_pointer_cast<CacheDownload>(DlJob)->m_target_path;
|
||||
QFile listFile(filename);
|
||||
if(!listFile.open(QIODevice::ReadOnly))
|
||||
return;
|
||||
@ -272,7 +272,7 @@ void ForgeListLoadTask::list_downloaded()
|
||||
if (valid)
|
||||
{
|
||||
// Now, we construct the version object and add it to the list.
|
||||
QSharedPointer<ForgeVersion> fVersion(new ForgeVersion());
|
||||
std::shared_ptr<ForgeVersion> fVersion(new ForgeVersion());
|
||||
fVersion->universal_url = url;
|
||||
fVersion->changelog_url = changelog_url;
|
||||
fVersion->installer_url = installer_url;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "logic/net/DownloadJob.h"
|
||||
|
||||
class ForgeVersion;
|
||||
typedef QSharedPointer<ForgeVersion> ForgeVersionPtr;
|
||||
typedef std::shared_ptr<ForgeVersion> ForgeVersionPtr;
|
||||
|
||||
struct ForgeVersion : public BaseVersion
|
||||
{
|
||||
|
@ -29,13 +29,13 @@
|
||||
#include "logic/lists/IconList.h"
|
||||
#include "logic/BaseInstance.h"
|
||||
#include "logic/InstanceFactory.h"
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
const static int GROUP_FILE_FORMAT_VERSION = 1;
|
||||
|
||||
InstanceList::InstanceList(const QString &instDir, QObject *parent) :
|
||||
QAbstractListModel ( parent ), m_instDir("instances")
|
||||
InstanceList::InstanceList(const QString &instDir, QObject *parent)
|
||||
: QAbstractListModel(parent), m_instDir("instances")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
InstanceList::~InstanceList()
|
||||
@ -54,7 +54,7 @@ QModelIndex InstanceList::index ( int row, int column, const QModelIndex& parent
|
||||
Q_UNUSED(parent);
|
||||
if (row < 0 || row >= m_instances.size())
|
||||
return QModelIndex();
|
||||
return createIndex ( row, column, ( void* ) m_instances.at ( row ).data() );
|
||||
return createIndex(row, column, (void *)m_instances.at(row).get());
|
||||
}
|
||||
|
||||
QVariant InstanceList::data(const QModelIndex &index, int role) const
|
||||
@ -121,7 +121,7 @@ void InstanceList::saveGroupList()
|
||||
if (!groupFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
// An error occurred. Ignore it.
|
||||
qDebug("Failed to read instance group file.");
|
||||
QLOG_ERROR() << "Failed to read instance group file.";
|
||||
return;
|
||||
}
|
||||
QTextStream out(&groupFile);
|
||||
@ -181,7 +181,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> & groupMap)
|
||||
if (!groupFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
// An error occurred. Ignore it.
|
||||
qDebug("Failed to read instance group file.");
|
||||
QLOG_ERROR() << "Failed to read instance group file.";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -195,8 +195,9 @@ void InstanceList::loadGroupList(QMap<QString, QString> & groupMap)
|
||||
// if the json was bad, fail
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
{
|
||||
qWarning(QString("Failed to parse instance group file: %1 at offset %2").
|
||||
arg(error.errorString(), QString::number(error.offset)).toUtf8());
|
||||
QLOG_ERROR() << QString("Failed to parse instance group file: %1 at offset %2")
|
||||
.arg(error.errorString(), QString::number(error.offset))
|
||||
.toUtf8();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -230,7 +231,9 @@ void InstanceList::loadGroupList(QMap<QString, QString> & groupMap)
|
||||
if (!iter.value().isObject())
|
||||
{
|
||||
qWarning(QString("Group '%1' in the group list should "
|
||||
"be an object.").arg(groupName).toUtf8());
|
||||
"be an object.")
|
||||
.arg(groupName)
|
||||
.toUtf8());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -239,15 +242,17 @@ void InstanceList::loadGroupList(QMap<QString, QString> & groupMap)
|
||||
{
|
||||
qWarning(QString("Group '%1' in the group list is invalid. "
|
||||
"It should contain an array "
|
||||
"called 'instances'.").arg(groupName).toUtf8());
|
||||
"called 'instances'.")
|
||||
.arg(groupName)
|
||||
.toUtf8());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Iterate through the list of instances in the group.
|
||||
QJsonArray instancesArray = groupObj.value("instances").toArray();
|
||||
|
||||
for (QJsonArray::iterator iter2 = instancesArray.begin();
|
||||
iter2 != instancesArray.end(); iter2++)
|
||||
for (QJsonArray::iterator iter2 = instancesArray.begin(); iter2 != instancesArray.end();
|
||||
iter2++)
|
||||
{
|
||||
groupMap[(*iter2).toString()] = groupName;
|
||||
}
|
||||
@ -283,40 +288,42 @@ InstanceList::InstListError InstanceList::loadList()
|
||||
break;
|
||||
}
|
||||
|
||||
if (error != InstanceFactory::NoLoadError &&
|
||||
error != InstanceFactory::NotAnInstance)
|
||||
if (error != InstanceFactory::NoLoadError && error != InstanceFactory::NotAnInstance)
|
||||
{
|
||||
QString errorMsg = QString("Failed to load instance %1: ").
|
||||
arg(QFileInfo(subDir).baseName()).toUtf8();
|
||||
QString errorMsg = QString("Failed to load instance %1: ")
|
||||
.arg(QFileInfo(subDir).baseName())
|
||||
.toUtf8();
|
||||
|
||||
switch (error)
|
||||
{
|
||||
default:
|
||||
errorMsg += QString("Unknown instance loader error %1").
|
||||
arg(error);
|
||||
errorMsg += QString("Unknown instance loader error %1").arg(error);
|
||||
break;
|
||||
}
|
||||
qDebug(errorMsg.toUtf8());
|
||||
QLOG_ERROR() << errorMsg.toUtf8();
|
||||
}
|
||||
else if (!instPtr)
|
||||
{
|
||||
qDebug(QString("Error loading instance %1. Instance loader returned null.").
|
||||
arg(QFileInfo(subDir).baseName()).toUtf8());
|
||||
QLOG_ERROR() << QString("Error loading instance %1. Instance loader returned null.")
|
||||
.arg(QFileInfo(subDir).baseName())
|
||||
.toUtf8();
|
||||
}
|
||||
else
|
||||
{
|
||||
QSharedPointer<BaseInstance> inst(instPtr);
|
||||
std::shared_ptr<BaseInstance> inst(instPtr);
|
||||
auto iter = groupMap.find(inst->id());
|
||||
if (iter != groupMap.end())
|
||||
{
|
||||
inst->setGroupInitial((*iter));
|
||||
}
|
||||
qDebug(QString("Loaded instance %1").arg(inst->name()).toUtf8());
|
||||
QLOG_INFO() << QString("Loaded instance %1").arg(inst->name()).toUtf8();
|
||||
inst->setParent(this);
|
||||
m_instances.append(inst);
|
||||
connect(instPtr, SIGNAL(propertiesChanged(BaseInstance*)),this, SLOT(propertiesChanged(BaseInstance*)));
|
||||
connect(instPtr, SIGNAL(propertiesChanged(BaseInstance *)), this,
|
||||
SLOT(propertiesChanged(BaseInstance *)));
|
||||
connect(instPtr, SIGNAL(groupChanged()), this, SLOT(groupChanged()));
|
||||
connect(instPtr, SIGNAL(nuked(BaseInstance*)), this, SLOT(instanceNuked(BaseInstance*)));
|
||||
connect(instPtr, SIGNAL(nuked(BaseInstance *)), this,
|
||||
SLOT(instanceNuked(BaseInstance *)));
|
||||
}
|
||||
}
|
||||
endResetModel();
|
||||
@ -332,7 +339,8 @@ void InstanceList::clear()
|
||||
m_instances.clear();
|
||||
endResetModel();
|
||||
emit dataIsInvalid();
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
/// Add an instance. Triggers notifications, returns the new index
|
||||
int InstanceList::add(InstancePtr t)
|
||||
@ -340,9 +348,10 @@ int InstanceList::add(InstancePtr t)
|
||||
beginInsertRows(QModelIndex(), m_instances.size(), m_instances.size());
|
||||
m_instances.append(t);
|
||||
t->setParent(this);
|
||||
connect(t.data(), SIGNAL(propertiesChanged(BaseInstance*)),this, SLOT(propertiesChanged(BaseInstance*)));
|
||||
connect(t.data(), SIGNAL(groupChanged()),this, SLOT(groupChanged()));
|
||||
connect(t.data(), SIGNAL(nuked(BaseInstance*)), this, SLOT(instanceNuked(BaseInstance*)));
|
||||
connect(t.get(), SIGNAL(propertiesChanged(BaseInstance *)), this,
|
||||
SLOT(propertiesChanged(BaseInstance *)));
|
||||
connect(t.get(), SIGNAL(groupChanged()), this, SLOT(groupChanged()));
|
||||
connect(t.get(), SIGNAL(nuked(BaseInstance *)), this, SLOT(instanceNuked(BaseInstance *)));
|
||||
endInsertRows();
|
||||
return count() - 1;
|
||||
}
|
||||
@ -367,7 +376,7 @@ int InstanceList::getInstIndex ( BaseInstance* inst )
|
||||
{
|
||||
for (int i = 0; i < m_instances.count(); i++)
|
||||
{
|
||||
if(inst == m_instances[i].data())
|
||||
if (inst == m_instances[i].get())
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -375,7 +384,6 @@ int InstanceList::getInstIndex ( BaseInstance* inst )
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void InstanceList::instanceNuked(BaseInstance *inst)
|
||||
{
|
||||
int i = getInstIndex(inst);
|
||||
@ -387,7 +395,6 @@ void InstanceList::instanceNuked ( BaseInstance* inst )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InstanceList::propertiesChanged(BaseInstance *inst)
|
||||
{
|
||||
int i = getInstIndex(inst);
|
||||
@ -404,7 +411,8 @@ InstanceProxyModel::InstanceProxyModel ( QObject *parent )
|
||||
setCategorizedModel(true);
|
||||
}
|
||||
|
||||
bool InstanceProxyModel::subSortLessThan (const QModelIndex& left, const QModelIndex& right ) const
|
||||
bool InstanceProxyModel::subSortLessThan(const QModelIndex &left,
|
||||
const QModelIndex &right) const
|
||||
{
|
||||
BaseInstance *pdataLeft = static_cast<BaseInstance *>(left.internalPointer());
|
||||
BaseInstance *pdataRight = static_cast<BaseInstance *>(right.internalPointer());
|
||||
|
@ -17,15 +17,14 @@
|
||||
#include "MultiMC.h"
|
||||
|
||||
#include <QtNetwork>
|
||||
|
||||
#include <QtXml>
|
||||
|
||||
#include <QRegExp>
|
||||
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
#define RSS_URL "http://sourceforge.net/api/file/index/project-id/58488/mtime/desc/rss"
|
||||
|
||||
LWJGLVersionList::LWJGLVersionList(QObject *parent) :
|
||||
QAbstractListModel(parent)
|
||||
LWJGLVersionList::LWJGLVersionList(QObject *parent) : QAbstractListModel(parent)
|
||||
{
|
||||
setLoading(false);
|
||||
}
|
||||
@ -102,8 +101,7 @@ void LWJGLVersionList::netRequestComplete()
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QRegExp lwjglRegex("lwjgl-(([0-9]\\.?)+)\\.zip");
|
||||
Q_ASSERT_X(lwjglRegex.isValid(), "load LWJGL list",
|
||||
"LWJGL regex is invalid");
|
||||
Q_ASSERT_X(lwjglRegex.isValid(), "load LWJGL list", "LWJGL regex is invalid");
|
||||
|
||||
QDomDocument doc;
|
||||
|
||||
@ -111,7 +109,8 @@ void LWJGLVersionList::netRequestComplete()
|
||||
int errorLine;
|
||||
if (!doc.setContent(reply->readAll(), false, &xmlErrorMsg, &errorLine))
|
||||
{
|
||||
failed("Failed to load LWJGL list. XML error: " + xmlErrorMsg + " at line " + QString::number(errorLine));
|
||||
failed("Failed to load LWJGL list. XML error: " + xmlErrorMsg + " at line " +
|
||||
QString::number(errorLine));
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
@ -156,7 +155,7 @@ void LWJGLVersionList::netRequestComplete()
|
||||
m_vlist.swap(tempList);
|
||||
endResetModel();
|
||||
|
||||
qDebug("Loaded LWJGL list.");
|
||||
QLOG_INFO() << "Loaded LWJGL list.";
|
||||
finished();
|
||||
}
|
||||
else
|
||||
@ -179,7 +178,6 @@ const PtrLWJGLVersion LWJGLVersionList::getVersion(const QString &versionName)
|
||||
return PtrLWJGLVersion();
|
||||
}
|
||||
|
||||
|
||||
void LWJGLVersionList::failed(QString msg)
|
||||
{
|
||||
qWarning() << msg;
|
||||
|
@ -17,13 +17,13 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractListModel>
|
||||
#include <QSharedPointer>
|
||||
#include <QUrl>
|
||||
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class LWJGLVersion;
|
||||
typedef QSharedPointer<LWJGLVersion> PtrLWJGLVersion;
|
||||
typedef std::shared_ptr<LWJGLVersion> PtrLWJGLVersion;
|
||||
|
||||
class LWJGLVersion : public QObject
|
||||
{
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "MinecraftVersionList.h"
|
||||
#include <MultiMC.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <QtXml>
|
||||
|
||||
#include <QJsonDocument>
|
||||
@ -62,8 +60,8 @@ int MinecraftVersionList::count() const
|
||||
|
||||
bool cmpVersions(BaseVersionPtr first, BaseVersionPtr second)
|
||||
{
|
||||
auto left = first.dynamicCast<MinecraftVersion>();
|
||||
auto right = second.dynamicCast<MinecraftVersion>();
|
||||
auto left = std::dynamic_pointer_cast<MinecraftVersion>(first);
|
||||
auto right = std::dynamic_pointer_cast<MinecraftVersion>(second);
|
||||
return left->timestamp > right->timestamp;
|
||||
}
|
||||
|
||||
@ -78,7 +76,7 @@ BaseVersionPtr MinecraftVersionList::getLatestStable() const
|
||||
{
|
||||
for (int i = 0; i < m_vlist.length(); i++)
|
||||
{
|
||||
auto ver = m_vlist.at(i).dynamicCast<MinecraftVersion>();
|
||||
auto ver =std::dynamic_pointer_cast<MinecraftVersion>(m_vlist.at(i));
|
||||
if (ver->is_latest && !ver->is_snapshot)
|
||||
{
|
||||
return m_vlist.at(i);
|
||||
@ -272,7 +270,7 @@ void MCVListLoadTask::list_downloaded()
|
||||
QString dlUrl = QString(MCVLIST_URLBASE) + versionID + "/";
|
||||
|
||||
// Now, we construct the version object and add it to the list.
|
||||
QSharedPointer<MinecraftVersion> mcVersion(new MinecraftVersion());
|
||||
std::shared_ptr<MinecraftVersion> mcVersion(new MinecraftVersion());
|
||||
mcVersion->m_name = mcVersion->m_descriptor = versionID;
|
||||
mcVersion->timestamp = versionTime.toMSecsSinceEpoch();
|
||||
mcVersion->download_url = dlUrl;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "ByteArrayDownload.h"
|
||||
#include "MultiMC.h"
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
ByteArrayDownload::ByteArrayDownload(QUrl url) : Download()
|
||||
{
|
||||
@ -10,13 +10,13 @@ ByteArrayDownload::ByteArrayDownload(QUrl url) : Download()
|
||||
|
||||
void ByteArrayDownload::start()
|
||||
{
|
||||
qDebug() << "Downloading " << m_url.toString();
|
||||
QLOG_INFO() << "Downloading " << m_url.toString();
|
||||
QNetworkRequest request(m_url);
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
|
||||
auto worker = MMC->qnam();
|
||||
QNetworkReply *rep = worker->get(request);
|
||||
|
||||
m_reply = QSharedPointer<QNetworkReply>(rep, &QObject::deleteLater);
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SLOT(downloadProgress(qint64, qint64)));
|
||||
connect(rep, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||
@ -33,7 +33,8 @@ void ByteArrayDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal
|
||||
void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error)
|
||||
{
|
||||
// error happened during download.
|
||||
qDebug() << "URL:" << m_url.toString().toLocal8Bit() << "Network error: " << error;
|
||||
QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit()
|
||||
<< "Network error: " << error;
|
||||
m_status = Job_Failed;
|
||||
}
|
||||
|
||||
@ -45,14 +46,14 @@ void ByteArrayDownload::downloadFinished()
|
||||
// nothing went wrong...
|
||||
m_status = Job_Finished;
|
||||
m_data = m_reply->readAll();
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit succeeded(index_within_job);
|
||||
return;
|
||||
}
|
||||
// else the download failed
|
||||
else
|
||||
{
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
|
@ -21,4 +21,4 @@ protected slots:
|
||||
void downloadReadyRead();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<ByteArrayDownload> ByteArrayDownloadPtr;
|
||||
typedef std::shared_ptr<ByteArrayDownload> ByteArrayDownloadPtr;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QCryptographicHash>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
CacheDownload::CacheDownload(QUrl url, MetaEntryPtr entry)
|
||||
: Download(), md5sum(QCryptographicHash::Md5)
|
||||
@ -31,7 +31,7 @@ void CacheDownload::start()
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
qDebug() << "Downloading " << m_url.toString();
|
||||
QLOG_INFO() << "Downloading " << m_url.toString();
|
||||
QNetworkRequest request(m_url);
|
||||
request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1());
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader,"MultiMC/5.0 (Cached)");
|
||||
@ -39,7 +39,7 @@ void CacheDownload::start()
|
||||
auto worker = MMC->qnam();
|
||||
QNetworkReply *rep = worker->get(request);
|
||||
|
||||
m_reply = QSharedPointer<QNetworkReply>(rep, &QObject::deleteLater);
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SLOT(downloadProgress(qint64, qint64)));
|
||||
connect(rep, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||
@ -92,7 +92,7 @@ void CacheDownload::downloadFinished()
|
||||
m_entry->stale = false;
|
||||
MMC->metacache()->updateEntry(m_entry);
|
||||
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit succeeded(index_within_job);
|
||||
return;
|
||||
}
|
||||
@ -101,7 +101,7 @@ void CacheDownload::downloadFinished()
|
||||
{
|
||||
m_output_file.close();
|
||||
m_output_file.remove();
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
|
@ -31,4 +31,4 @@ public slots:
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CacheDownload> CacheDownloadPtr;
|
||||
typedef std::shared_ptr<CacheDownload> CacheDownloadPtr;
|
||||
|
@ -2,10 +2,9 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <QSharedPointer>
|
||||
#include <memory>
|
||||
#include <QNetworkReply>
|
||||
|
||||
|
||||
enum JobStatus
|
||||
{
|
||||
Job_NotStarted,
|
||||
@ -19,12 +18,13 @@ class Download : public QObject
|
||||
Q_OBJECT
|
||||
protected:
|
||||
explicit Download() : QObject(0) {};
|
||||
|
||||
public:
|
||||
virtual ~Download() {};
|
||||
|
||||
public:
|
||||
/// the network reply
|
||||
QSharedPointer<QNetworkReply> m_reply;
|
||||
std::shared_ptr<QNetworkReply> m_reply;
|
||||
|
||||
/// source URL
|
||||
QUrl m_url;
|
||||
@ -51,4 +51,4 @@ public slots:
|
||||
virtual void start() = 0;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<Download> DownloadPtr;
|
||||
typedef std::shared_ptr<Download> DownloadPtr;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "ByteArrayDownload.h"
|
||||
#include "CacheDownload.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
ByteArrayDownloadPtr DownloadJob::addByteArrayDownload(QUrl url)
|
||||
{
|
||||
@ -54,18 +54,18 @@ void DownloadJob::partSucceeded(int index)
|
||||
partProgress(index, slot.total_progress, slot.total_progress);
|
||||
|
||||
num_succeeded++;
|
||||
qDebug() << m_job_name.toLocal8Bit() << " progress: " << num_succeeded << "/"
|
||||
QLOG_INFO() << m_job_name.toLocal8Bit() << " progress: " << num_succeeded << "/"
|
||||
<< downloads.size();
|
||||
if (num_failed + num_succeeded == downloads.size())
|
||||
{
|
||||
if (num_failed)
|
||||
{
|
||||
qDebug() << m_job_name.toLocal8Bit() << " failed.";
|
||||
QLOG_ERROR() << m_job_name.toLocal8Bit() << " failed.";
|
||||
emit failed();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << m_job_name.toLocal8Bit() << " succeeded.";
|
||||
QLOG_INFO() << m_job_name.toLocal8Bit() << " succeeded.";
|
||||
emit succeeded();
|
||||
}
|
||||
}
|
||||
@ -76,17 +76,17 @@ void DownloadJob::partFailed(int index)
|
||||
auto &slot = parts_progress[index];
|
||||
if (slot.failures == 3)
|
||||
{
|
||||
qDebug() << "Part " << index << " failed 3 times (" << downloads[index]->m_url << ")";
|
||||
QLOG_ERROR() << "Part " << index << " failed 3 times (" << downloads[index]->m_url << ")";
|
||||
num_failed++;
|
||||
if (num_failed + num_succeeded == downloads.size())
|
||||
{
|
||||
qDebug() << m_job_name.toLocal8Bit() << " failed.";
|
||||
QLOG_ERROR() << m_job_name.toLocal8Bit() << " failed.";
|
||||
emit failed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Part " << index << " failed, restarting (" << downloads[index]->m_url
|
||||
QLOG_ERROR() << "Part " << index << " failed, restarting (" << downloads[index]->m_url
|
||||
<< ")";
|
||||
// restart the job
|
||||
slot.failures++;
|
||||
@ -110,12 +110,12 @@ void DownloadJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTota
|
||||
|
||||
void DownloadJob::start()
|
||||
{
|
||||
qDebug() << m_job_name.toLocal8Bit() << " started.";
|
||||
QLOG_INFO() << m_job_name.toLocal8Bit() << " started.";
|
||||
for (auto iter : downloads)
|
||||
{
|
||||
connect(iter.data(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int)));
|
||||
connect(iter.data(), SIGNAL(failed(int)), SLOT(partFailed(int)));
|
||||
connect(iter.data(), SIGNAL(progress(int, qint64, qint64)),
|
||||
connect(iter.get(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int)));
|
||||
connect(iter.get(), SIGNAL(failed(int)), SLOT(partFailed(int)));
|
||||
connect(iter.get(), SIGNAL(progress(int, qint64, qint64)),
|
||||
SLOT(partProgress(int, qint64, qint64)));
|
||||
iter->start();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "logic/tasks/ProgressProvider.h"
|
||||
|
||||
class DownloadJob;
|
||||
typedef QSharedPointer<DownloadJob> DownloadJobPtr;
|
||||
typedef std::shared_ptr<DownloadJob> DownloadJobPtr;
|
||||
|
||||
/**
|
||||
* A single file for the downloader/cache to process.
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "FileDownload.h"
|
||||
#include <pathutils.h>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
|
||||
FileDownload::FileDownload ( QUrl url, QString target_path )
|
||||
@ -28,7 +28,7 @@ void FileDownload::start()
|
||||
// skip this file if they match
|
||||
if ( m_check_md5 && hash == m_expected_md5 )
|
||||
{
|
||||
qDebug() << "Skipping " << m_url.toString() << ": md5 match.";
|
||||
QLOG_INFO() << "Skipping " << m_url.toString() << ": md5 match.";
|
||||
emit succeeded(index_within_job);
|
||||
return;
|
||||
}
|
||||
@ -43,7 +43,7 @@ void FileDownload::start()
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Downloading " << m_url.toString();
|
||||
QLOG_INFO() << "Downloading " << m_url.toString();
|
||||
QNetworkRequest request ( m_url );
|
||||
request.setRawHeader(QString("If-None-Match").toLatin1(), m_expected_md5.toLatin1());
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader,"MultiMC/5.0 (Uncached)");
|
||||
@ -51,7 +51,7 @@ void FileDownload::start()
|
||||
auto worker = MMC->qnam();
|
||||
QNetworkReply * rep = worker->get ( request );
|
||||
|
||||
m_reply = QSharedPointer<QNetworkReply> ( rep, &QObject::deleteLater );
|
||||
m_reply = std::shared_ptr<QNetworkReply> ( rep );
|
||||
connect ( rep, SIGNAL ( downloadProgress ( qint64,qint64 ) ), SLOT ( downloadProgress ( qint64,qint64 ) ) );
|
||||
connect ( rep, SIGNAL ( finished() ), SLOT ( downloadFinished() ) );
|
||||
connect ( rep, SIGNAL ( error ( QNetworkReply::NetworkError ) ), SLOT ( downloadError ( QNetworkReply::NetworkError ) ) );
|
||||
@ -79,7 +79,7 @@ void FileDownload::downloadFinished()
|
||||
m_status = Job_Finished;
|
||||
m_output_file.close();
|
||||
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit succeeded(index_within_job);
|
||||
return;
|
||||
}
|
||||
@ -87,7 +87,7 @@ void FileDownload::downloadFinished()
|
||||
else
|
||||
{
|
||||
m_output_file.close();
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
|
@ -32,4 +32,4 @@ public slots:
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<FileDownload> FileDownloadPtr;
|
||||
typedef std::shared_ptr<FileDownload> FileDownloadPtr;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QCryptographicHash>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
ForgeXzDownload::ForgeXzDownload(QUrl url, MetaEntryPtr entry)
|
||||
: Download()
|
||||
@ -32,7 +32,7 @@ void ForgeXzDownload::start()
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
qDebug() << "Downloading " << m_url.toString();
|
||||
QLOG_INFO() << "Downloading " << m_url.toString();
|
||||
QNetworkRequest request(m_url);
|
||||
request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1());
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader,"MultiMC/5.0 (Cached)");
|
||||
@ -40,7 +40,7 @@ void ForgeXzDownload::start()
|
||||
auto worker = MMC->qnam();
|
||||
QNetworkReply *rep = worker->get(request);
|
||||
|
||||
m_reply = QSharedPointer<QNetworkReply>(rep, &QObject::deleteLater);
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SLOT(downloadProgress(qint64, qint64)));
|
||||
connect(rep, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||
@ -78,7 +78,7 @@ void ForgeXzDownload::downloadFinished()
|
||||
{
|
||||
// something bad happened
|
||||
m_pack200_xz_file.remove();
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
@ -88,7 +88,7 @@ void ForgeXzDownload::downloadFinished()
|
||||
{
|
||||
m_pack200_xz_file.close();
|
||||
m_pack200_xz_file.remove();
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
}
|
||||
@ -198,38 +198,38 @@ void ForgeXzDownload::decompressAndInstall()
|
||||
break;
|
||||
|
||||
case XZ_MEM_ERROR:
|
||||
qDebug() << "Memory allocation failed\n";
|
||||
QLOG_ERROR() << "Memory allocation failed\n";
|
||||
xz_dec_end(s);
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
|
||||
case XZ_MEMLIMIT_ERROR:
|
||||
qDebug() << "Memory usage limit reached\n";
|
||||
QLOG_ERROR() << "Memory usage limit reached\n";
|
||||
xz_dec_end(s);
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
|
||||
case XZ_FORMAT_ERROR:
|
||||
qDebug() << "Not a .xz file\n";
|
||||
QLOG_ERROR() << "Not a .xz file\n";
|
||||
xz_dec_end(s);
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
|
||||
case XZ_OPTIONS_ERROR:
|
||||
qDebug() << "Unsupported options in the .xz headers\n";
|
||||
QLOG_ERROR() << "Unsupported options in the .xz headers\n";
|
||||
xz_dec_end(s);
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
|
||||
case XZ_DATA_ERROR:
|
||||
case XZ_BUF_ERROR:
|
||||
qDebug() << "File is corrupt\n";
|
||||
QLOG_ERROR() << "File is corrupt\n";
|
||||
xz_dec_end(s);
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
|
||||
default:
|
||||
qDebug() << "Bug!\n";
|
||||
QLOG_ERROR() << "Bug!\n";
|
||||
xz_dec_end(s);
|
||||
emit failed(index_within_job);
|
||||
return;
|
||||
@ -246,7 +246,7 @@ void ForgeXzDownload::decompressAndInstall()
|
||||
}
|
||||
catch(std::runtime_error & err)
|
||||
{
|
||||
qDebug() << "Error unpacking " << pack_name.toUtf8() << " : " << err.what();
|
||||
QLOG_ERROR() << "Error unpacking " << pack_name.toUtf8() << " : " << err.what();
|
||||
QFile f(m_target_path);
|
||||
if(f.exists())
|
||||
f.remove();
|
||||
@ -274,6 +274,6 @@ void ForgeXzDownload::decompressAndInstall()
|
||||
m_entry->stale = false;
|
||||
MMC->metacache()->updateEntry(m_entry);
|
||||
|
||||
m_reply.clear();
|
||||
m_reply.reset();
|
||||
emit succeeded(index_within_job);
|
||||
}
|
||||
|
@ -32,4 +32,4 @@ private:
|
||||
void decompressAndInstall();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<ForgeXzDownload> ForgeXzDownloadPtr;
|
||||
typedef std::shared_ptr<ForgeXzDownload> ForgeXzDownloadPtr;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include <QDebug>
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
@ -105,12 +105,12 @@ bool HttpMetaCache::updateEntry ( MetaEntryPtr stale_entry )
|
||||
{
|
||||
if(!m_entries.contains(stale_entry->base))
|
||||
{
|
||||
qDebug() << "Cannot add entry with unknown base: " << stale_entry->base.toLocal8Bit();
|
||||
QLOG_ERROR() << "Cannot add entry with unknown base: " << stale_entry->base.toLocal8Bit();
|
||||
return false;
|
||||
}
|
||||
if(stale_entry->stale)
|
||||
{
|
||||
qDebug() << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit();
|
||||
QLOG_ERROR() << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit();
|
||||
return false;
|
||||
}
|
||||
m_entries[stale_entry->base].entry_list[stale_entry->path] = stale_entry;
|
||||
|
@ -15,7 +15,7 @@ struct MetaEntry
|
||||
QString getFullPath();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<MetaEntry> MetaEntryPtr;
|
||||
typedef std::shared_ptr<MetaEntry> MetaEntryPtr;
|
||||
|
||||
class HttpMetaCache : public QObject
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ void LoginTask::legacyLogin()
|
||||
{
|
||||
setStatus(tr("Logging in..."));
|
||||
auto worker = MMC->qnam();
|
||||
connect(worker.data(), SIGNAL(finished(QNetworkReply *)), this,
|
||||
connect(worker.get(), SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(processLegacyReply(QNetworkReply *)));
|
||||
|
||||
QUrl loginURL("https://login.minecraft.net/");
|
||||
@ -134,7 +134,7 @@ void LoginTask::yggdrasilLogin()
|
||||
{
|
||||
setStatus(tr("Logging in..."));
|
||||
auto worker = MMC->qnam();
|
||||
connect(worker.data(), SIGNAL(finished(QNetworkReply *)), this,
|
||||
connect(worker.get(), SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(processYggdrasilReply(QNetworkReply *)));
|
||||
|
||||
/*
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "Task.h"
|
||||
#include <logger/QsLog.h>
|
||||
|
||||
Task::Task(QObject *parent) :
|
||||
ProgressProvider(parent)
|
||||
@ -55,6 +56,7 @@ void Task::start()
|
||||
void Task::emitFailed(QString reason)
|
||||
{
|
||||
m_running = false;
|
||||
QLOG_ERROR() << "Task failed: " << reason;
|
||||
emit failed(reason);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user