Remove some duplicate code
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
e4a801fdf7
commit
ef3bf75715
7 changed files with 31 additions and 50 deletions
|
@ -53,6 +53,23 @@
|
|||
#include "Commandline.h"
|
||||
#include "FileSystem.h"
|
||||
|
||||
int getConsoleMaxLines(SettingsObjectPtr settings)
|
||||
{
|
||||
auto lineSetting = settings->getSetting("ConsoleMaxLines");
|
||||
bool conversionOk = false;
|
||||
int maxLines = lineSetting->get().toInt(&conversionOk);
|
||||
if (!conversionOk) {
|
||||
maxLines = lineSetting->defValue().toInt();
|
||||
qWarning() << "ConsoleMaxLines has nonsensical value, defaulting to" << maxLines;
|
||||
}
|
||||
return maxLines;
|
||||
}
|
||||
|
||||
bool shouldStopOnConsoleOverflow(SettingsObjectPtr settings)
|
||||
{
|
||||
return settings->get("ConsoleOverflowStop").toBool();
|
||||
}
|
||||
|
||||
BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString& rootDir) : QObject()
|
||||
{
|
||||
m_settings = settings;
|
||||
|
@ -184,23 +201,6 @@ void BaseInstance::copyManagedPack(BaseInstance& other)
|
|||
}
|
||||
}
|
||||
|
||||
int BaseInstance::getConsoleMaxLines() const
|
||||
{
|
||||
auto lineSetting = m_settings->getSetting("ConsoleMaxLines");
|
||||
bool conversionOk = false;
|
||||
int maxLines = lineSetting->get().toInt(&conversionOk);
|
||||
if (!conversionOk) {
|
||||
maxLines = lineSetting->defValue().toInt();
|
||||
qWarning() << "ConsoleMaxLines has nonsensical value, defaulting to" << maxLines;
|
||||
}
|
||||
return maxLines;
|
||||
}
|
||||
|
||||
bool BaseInstance::shouldStopOnConsoleOverflow() const
|
||||
{
|
||||
return m_settings->get("ConsoleOverflowStop").toBool();
|
||||
}
|
||||
|
||||
QStringList BaseInstance::getLinkedInstances() const
|
||||
{
|
||||
auto setting = m_settings->get("linkedInstances").toString();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue