MinetestLauncher/profile.cpp

48 lines
900 B
C++
Raw Normal View History

2016-02-05 18:32:20 -08:00
#include "profile.h"
Profile::Profile(QString n, QString v)
{
name = n;
version = v;
}
2016-05-16 20:28:44 -07:00
Profile Profile::fromJson(QJsonValue val)
2016-02-05 18:32:20 -08:00
{
2016-05-16 20:28:44 -07:00
QJsonObject obj = val.toObject();
2016-02-05 18:32:20 -08:00
return Profile(obj.value("name").toString(), obj.value("version").toString());
}
2016-05-16 14:42:05 -07:00
QJsonObject Profile::toJson()
{
QJsonObject object;
2016-05-16 20:28:44 -07:00
object.insert("name", name);
object.insert("version", version);
2016-05-16 14:42:05 -07:00
return object;
}
2016-02-05 18:32:20 -08:00
QDir Profile::getPath()
{
return QDir(prefix.filePath(name));
}
2016-05-16 14:42:05 -07:00
void Profile::play(QTabWidget *widget)
{
QString cmd = "/bin/bash -c \"/home/myself/Code/C++/MinetestLauncher/scripts/linux.sh create %1 %2\"";
ProcessUi* process = new ProcessUi(widget, cmd.arg(name, version));
widget->addTab(process, name);
process->start();
widget->setCurrentIndex(widget->indexOf(process));
}
void Profile::build()
{
2016-05-29 19:45:20 -07:00
#ifdef _WIN32
#else
#endif
2016-05-16 14:42:05 -07:00
}
void Profile::start()
{
}