Example #1
0
void UASActionsWidget::setRTLMode()
{
    if(!activeUas())
        return;

    QLOG_INFO() << "UASActionsWidget::setRTLMode()";

    switch (m_uas->getAutopilotType()) {
        case MAV_AUTOPILOT_ARDUPILOTMEGA: {

            int idx = ui.modeComboBox->findText("RTL");
            int mode = ui.modeComboBox->itemData(idx).toInt();
            m_uas->setMode(MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
                           mode);
        } break;

        case MAV_AUTOPILOT_PX4: {
            // [TODO] PX4 flight controller go here
        }

        case MAV_AUTOPILOT_GENERIC:
        default: {
            // [TODO] Generic, and other flight controllers here (or own sections as above)
        }
    }
}
Example #2
0
void UASActionsWidget::goToWaypointClicked()
{
    if(!activeUas())
        return;
    QLOG_INFO() << "Go to Waypoint" << ui.waypointListComboBox->currentIndex();
    m_uas->getWaypointManager()->setCurrentWaypoint(ui.waypointListComboBox->currentIndex());
}
void UASActionsWidget::setShortcutMode()
{
    QLOG_INFO() << "    UASActionsWidget::setShortcutMode()";

    if(!activeUas())
        return;

    QLOG_INFO() << "Set Mode to "
                << ui.shortcutButtonGroup->checkedButton()->text();
    int index = ui.modeComboBox->findText(ui.shortcutButtonGroup->checkedButton()->text());
    QLOG_DEBUG() << "index: "
                << index;
    ui.modeComboBox->setCurrentIndex(index);
    m_uas->setMode(MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
                   ui.modeComboBox->itemData(ui.modeComboBox->currentIndex()).toInt());
}
TerminalWidget::TerminalWidget(QWidget *parent)
    : SamaelDockWidget(parent, QStringLiteral("TerminalWidget"), QStringLiteral("Terminal"))
{
    this->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);

    // configure the text edit
    m_Terminal = new Terminal(m_ContentWidget);
    m_Terminal->setFont(QFont("Courier",9));
    m_Terminal->setLineWrapMode(QPlainTextEdit::NoWrap);
    m_Terminal->setMaximumBlockCount(100);

    // background & text color
    auto p = m_Terminal->palette();
    p.setColor(QPalette::Base,QColor(qRgb(28,32,36)));
    p.setColor(QPalette::Text,QColor(qRgb(186,200,198)));
    m_Terminal->setPalette(p);

    // configure the text highlighter
    m_Highlighter = new SamaelHighlighter(m_Terminal->document());
    m_Highlighter->setContext(SamaelHighlighter::CONTEXT_TERMINAL);

    // script system? anyone? the entry point is over here!
    connect(m_Terminal, SIGNAL(command(QString)), this, SLOT(result(QString)));

    // configure the layout of this widget
    m_Layout = new QVBoxLayout(m_ContentWidget);
    m_Layout->setContentsMargins(0,0,0,0);
    m_Layout->addWidget(m_Terminal);
    finalise(m_Layout);

    QLOG_INFO() << "TerminalWidget - Ready!";
}
Example #5
0
bool OcDbManager::openDB()
{
    db = QSqlDatabase::addDatabase("QSQLITE");

    QString path(QDir::homePath());
    path.append(BASE_PATH).append("/database.sqlite");
    path = QDir::toNativeSeparators(path);

    QLOG_DEBUG() << "Database file path: " << path;

    // check if database file exists before database will be opened
    QFile dbfile(path);

    while(!dbfile.exists()) {
        QLOG_WARN() << "Database file does not exist. Waiting for it's creation by the engine...";
        QEventLoop loop;
        QTimer::singleShot(1000, &loop, SLOT(quit()));
        loop.exec();
    }

    db.setDatabaseName(path);
    db.setConnectOptions("QSQLITE_OPEN_READONLY");

    bool dbOpen = db.open();

    if (!dbOpen) {
        QLOG_FATAL() << "Can not open sqlite database";
    } else {
        QLOG_INFO() << "Opened sqlite database";
    }

    return dbOpen;
}
Example #6
0
void UmlClass::generate_def(QTextStream & f, WrapperStr indent, bool h,
                            WrapperStr templates, WrapperStr cl_names,
                            WrapperStr, WrapperStr)
{
    QLOG_INFO() << "generating definition";

    //QsLogging::Logger::instance().
    if (! cppDecl().isEmpty()) {
        WrapperStr template1;
        WrapperStr template2;
        WrapperStr templates_tmplop;
        WrapperStr cl_names_tmplop;

        get_template_prefixes(template1, template2);
        templates_tmplop = templates + "template<>\n";
        templates += template1;
        cl_names_tmplop = cl_names + "::" + name()/* true_name */;
        cl_names = cl_names_tmplop + template2;

        QVector<UmlItem*> ch = children();

        for (int index = 0; index != ch.size(); index += 1)
            if (ch[index]->kind() != aNcRelation)
                ((UmlClassItem *) ch[index])
                ->generate_def(f, indent, h, templates, cl_names,
                               templates_tmplop, cl_names_tmplop);
    }
}
Example #7
0
void PasswordVault::initializeVaultKey()
{
   QString info("Setting the key for the Password Vault.\n"
                "Note: If you have server passwords saved in the Vault,\n"
                "these will no longer be valid and you will need to \n"
                "re-enter them in order to encrypt them with the new \n"
                "Vault Key.\n\n"
                "The Password Vault key is used to encrypt server\n"
                "passwords before being stored.  The key is not\n"
                "stored on file and must therefore be entered each\n"
                "time you restart IQmol.  If you forget your vault\n" 
                "key, you must reconfigure all the server settings\n"
                "saved in IQmol\n");

   SetPasswordDialog dialog(info, "Set Password Vault Key", "Vault Key" ); 

   if (dialog.exec() == QDialog::Accepted) {
      QString key(dialog.password());
      QLOG_INFO() << "Vault key accepted";

      delete m_enigmaMachine;
      m_enigmaMachine = new EnigmaMachine(key.toStdString());
      std::string hash(m_enigmaMachine->mdHash(key.toStdString()));
      OverwriteString(key);

      Preferences::ClearPasswordVaultContents();
      Preferences::PasswordVaultKey(QString::fromStdString(hash));
      Preferences::PasswordVaultSeed(m_enigmaMachine->seed());
   }
}
Example #8
0
QList<QString> Parser::parseFeatures(QNetworkReply *reply)
{
    // Empfangene Nachricht auslesen und als JSON interpretieren
    QByteArray response(reply->readAll());
    QJsonDocument document = QJsonDocument::fromJson(response);
    QJsonObject object = document.object();

    QList<QString> activeFeatures;

    if(object.isEmpty())
    {
        QLOG_INFO() << tr("Featureinformationen leer bzw. nicht lesbar.") <<":"<<reply->url();
        return activeFeatures;
    }

    if(!object["Status"].toBool())
    {
        QLOG_ERROR() << tr("Status der Featureinformationen nicht ok: ") <<
                        QString(document.toJson());
        return activeFeatures;
    }

    // Array mit allen einzelnen Vorlesungen/Veranstaltungen
    QJsonArray courses = object["active"].toArray();

    // Für jede Veranstaltung ein neues Strukturelement anlegen
    foreach(QJsonValue element, courses)
    {
        activeFeatures << element.toString();
    }

    return activeFeatures;
}
Example #9
0
void OcFeedsModelNew::feedCreated(const QString &name, const int &id)
{
    QSqlQuery query;

    if (!query.exec(QString("SELECT id, localUnreadCount, iconSource, iconWidth, iconHeight, folderId FROM feeds WHERE id = %1").arg(id))) {
        QLOG_ERROR() << "Feeds model: failed to select data of newly created feed from database: " << query.lastError().text();
    }

    query.next();

    if (query.value(5).toInt() == folderId()) {

        QLOG_INFO() << "Feeds model: adding newly created feed";

        beginInsertRows(QModelIndex(), rowCount(), rowCount());

        OcFeedObject *fobj = new OcFeedObject(query.value(0).toInt(),
                                              0,
                                              name,
                                              query.value(1).toInt(),
                                              query.value(2).toString(),
                                              query.value(3).toInt(),
                                              query.value(4).toInt());

        m_items.append(fobj);

        endInsertRows();

        queryAndSetTotalUnread();
    }
}
Example #10
0
void UASActionsWidget::setupApmRoverModes()
{
    QLOG_INFO() << "UASActionWidget: Set for Rover";
    ApmUiHelpers::addRoverModes(ui.modeComboBox);

    ui.armDisarmButton->setVisible(false);
    ui.armedStatuslabel->setVisible(false);

    // Setup configurable shortcut action
    ui.opt1ModeButton->setText("Learn");
    ui.opt2ModeButton->setText("Steer");
    ui.opt3ModeButton->setText("Hold");
    ui.opt4ModeButton->setText("none");
    configureModeButtonEnableDisable();

    // Setup Action Combo Box
    ui.actionComboBox->clear();
    ui.actionComboBox->addItem("Loiter Unlimited", MAV_CMD_NAV_LOITER_UNLIM);
    ui.actionComboBox->addItem("Return To Launch", MAV_CMD_NAV_RETURN_TO_LAUNCH);
    ui.actionComboBox->addItem("Preflight Calibration", MAV_CMD_PREFLIGHT_CALIBRATION);
    ui.actionComboBox->addItem("Mission Start", MAV_CMD_MISSION_START);
    ui.actionComboBox->addItem("Preflight Reboot", MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN);
    ui.actionComboBox->addItem("Trigger Camera", MAV_CMD_DO_DIGICAM_CONTROL);

}
Example #11
0
void VersionBuilder::buildFromMultilayer()
{
	QLOG_INFO() << "Building version from multilayered sources.";
	// just the builtin stuff for now
	auto minecraftList = MMC->minecraftlist();
	auto mcversion = minecraftList->findVersion(m_instance->intendedVersionId());
	auto minecraftPatch = std::dynamic_pointer_cast<VersionPatch>(mcversion);
	if (!minecraftPatch)
	{
		throw VersionIncomplete("net.minecraft");
	}
	minecraftPatch->setOrder(-2);
	m_version->VersionPatches.append(minecraftPatch);

	// TODO: this is obviously fake.
	QResource LWJGL(":/versions/LWJGL/2.9.1.json");
	auto lwjgl = parseJsonFile(LWJGL.absoluteFilePath(), false, false);
	auto lwjglPatch = std::dynamic_pointer_cast<VersionPatch>(lwjgl);
	if (!lwjglPatch)
	{
		throw VersionIncomplete("org.lwjgl");
	}
	lwjglPatch->setOrder(-1);
	m_version->VersionPatches.append(lwjglPatch);

	// load all patches, put into map for ordering, apply in the right order
	readInstancePatches();

	m_version->finalize();
}
Example #12
0
void UASActionsWidget::uasDisconnected()
{
    QLOG_INFO() << "UASActionsWidget::disconnected()" << m_uas;
    ui.actionsGroupBox->setDisabled(true);
    ui.missionGroupBox->setDisabled(true);
    ui.shortcutGroupBox->setDisabled(true);
}
Example #13
0
void UASActionsWidget::setupApmPlaneModes()
{
    QLOG_INFO() << "UASActionWidget: Set for Plane";
    ApmUiHelpers::addPlaneModes(ui.modeComboBox);

    // Hide arming buttons unless we the the ARM_REQUIRE parameter
    ui.armDisarmButton->setVisible(false);
    ui.armedStatuslabel->setVisible(false);

    // Setup configurable shortcut action
    ui.opt1ModeButton->setText("FBW A");
    ui.opt2ModeButton->setText("FBW B");
    ui.opt3ModeButton->setText("Circle");
    ui.opt4ModeButton->setText("Manual");

    // Setup Action Combo Box
    ui.actionComboBox->clear();
    ui.actionComboBox->addItem("Loiter Unlimited", MAV_CMD_NAV_LOITER_UNLIM);
    ui.actionComboBox->addItem("Return To Launch", MAV_CMD_NAV_RETURN_TO_LAUNCH);
    ui.actionComboBox->addItem("Preflight Calibration", MAV_CMD_PREFLIGHT_CALIBRATION);
    ui.actionComboBox->addItem("Mission Start", MAV_CMD_MISSION_START);
    ui.actionComboBox->addItem("Preflight Reboot", MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN);
    ui.actionComboBox->addItem("Trigger Camera", MAV_CMD_DO_DIGICAM_CONTROL);

}
void ItemsManagerWorker::Update() {
    if (updating_) {
        QLOG_WARN() << "ItemsManagerWorker::Update called while updating";
        return;
    }

    QLOG_INFO() << "Updating stash tabs";
    updating_ = true;
    // remove all mappings (from previous requests)
    if (signal_mapper_)
        delete signal_mapper_;
    signal_mapper_ = new QSignalMapper;
    // remove all pending requests
    queue_ = std::queue<ItemsRequest>();
    queue_id_ = 0;
    replies_.clear();
    items_.clear();
    tabs_as_string_ = "";
    items_as_string_ = "[ "; // space here is important, see ParseItems and OnTabReceived when all requests are completed
    selected_character_ = "";

    CurrentStatusUpdate status = CurrentStatusUpdate();
    status.state = ProgramState::ItemsUpdating;
    status.progress = 0;
    status.total = 100;
    emit StatusUpdate(status);

    // first, download the main page because it's the only way to know which character is selected
    QNetworkReply *main_page = network_manager_.get(QNetworkRequest(QUrl(kMainPage)));
    connect(main_page, &QNetworkReply::finished, this, &ItemsManagerWorker::OnMainPageReceived);
}
Example #15
0
int InputCEC::CecLogMessage(void* cbParam, const cec_log_message message)
{
    InputCEC *cec = (InputCEC*)cbParam;
    switch (message.level)
    {
    case CEC_LOG_ERROR:
        QLOG_ERROR() << "libCEC ERROR:" << message.message;
        break;

    case CEC_LOG_WARNING:
        QLOG_WARN() << "libCEC WARNING:" << message.message;
        break;

    case CEC_LOG_NOTICE:
        QLOG_INFO() << "libCEC NOTICE:" << message.message;
        break;

    case CEC_LOG_DEBUG:
        if (cec->m_verboseLogging)
        {
            QLOG_DEBUG() << "libCEC DEBUG:" << message.message;
        }
        break;

    case CEC_LOG_TRAFFIC:
        break;

    default:
        break;
    }

    return 0;
}
Example #16
0
QString RelationData::get_name(BrowserRelation * cl) const
{
    static QString result;

    if (cl == start) {
        if (!a.role.isEmpty()) {
            const char * role = a.role;
            QString tName = get_name();
            result = QString(role + QString(" (") + tName + ")");
            return result;
        }
    }
    else if (cl == end) {
        if (!b.role.isEmpty()) {
            QLOG_INFO() << "Returning name for relation: " << QString((const char *) b.role) + " (" + get_name() + ")";
            const char * role = b.role;
            QString tName = get_name();
            result = QString(role + QString(" (") + tName + ")");
            return QString(role + QString(" (") + tName + ")");
        }
    }

    bool nameIsNotADefaultType = this->name != default_name(type);

    if (nameIsNotADefaultType)
        result = ("(" + this->name + ")").operator QString();
    else
        result = this->name.operator QString();

    //QLOG_INFO() << "Returning name for relation: " << relationName;
    return result;
}
void SystemComponent::runUserScript(QString script)
{
  // We take the path the user supplied and run it through fileInfo and
  // look for the fileName() part, this is to avoid people sharing keymaps
  // that tries to execute things like ../../ etc. Note that this function
  // is still not safe, people can do nasty things with it, so users needs
  // to be careful with their keymaps.
  //
  QFileInfo fi(script);
  QString scriptPath = Paths::dataDir("scripts/" + fi.fileName());

  QFile scriptFile(scriptPath);
  if (scriptFile.exists())
  {
    if (!QFileInfo(scriptFile).isExecutable())
    {
      QLOG_WARN() << "Script:" << script << "is not executable";
      return;
    }

    QLOG_INFO() << "Running script:" << scriptPath;

    if (QProcess::startDetached(scriptPath, QStringList()))
      QLOG_DEBUG() << "Script started successfully";
    else
      QLOG_WARN() << "Error running script:" << scriptPath;
  }
  else
  {
    QLOG_WARN() << "Could not find script:" << scriptPath;
  }
}
void DisplayManagerRPI::resetRendering()
{
  QGuiApplication *guiApp = (QGuiApplication*)QGuiApplication::instance();
  QQuickWindow *window = (QQuickWindow*)guiApp->focusWindow();
  if (window)
  {
    QLOG_INFO() << "Recreating Qt UI renderer";

    // destroy the window to reset  OpenGL context
    window->setPersistentOpenGLContext(false);
    window->setPersistentSceneGraph(false);
    window->destroy();

    // Grab the Platform integration private object and recreate it
    // this allows to clean / recreate the dispmanx objects
    QGuiApplicationPrivate *privateApp = (QGuiApplicationPrivate *)QGuiApplicationPrivate::get(guiApp);
    QPlatformIntegration *integration = privateApp->platformIntegration();

    if (integration)
    {
      integration->destroy();
      QThread::msleep(500);
      integration->initialize();
    }
    else
    {
      QLOG_ERROR() << "Failed to retrieve platform integration";
    }

    // now recreate the window OpenGL context
    window->setScreen(QGuiApplication::primaryScreen());
    window->create();
  }
}
Example #19
0
void CProxy::slotDisconnected()
{
    QLOG_INFO() << "disconnected";
    QTcpSocket * s = qobject_cast<QTcpSocket *>( sender() );
    if ( s )
        removePair( s );
}
Example #20
0
void PlcSrConfig::delPlcConfig()
{//获取当前传感器名字及位置
    plcName=this->ui->nameCbBox->currentText();
    int index=this->ui->nameCbBox->currentIndex();
    while(true==plcList.contains(plcName))
    {//简单判断输入
        if(QMessageBox::Yes==QMessageBox::question(this,"请选择",QString("是否删除%1传感器?").arg(plcName),QMessageBox::Yes|QMessageBox::No|QMessageBox::Yes))
        {//清除所有PLC传感器参数
            plcList.removeAt(index);
            plcNameMap[plcName].clear();
            portIdMap[plcName].clear();
            baudRateMap[plcName].clear();
            dataBitsMap[plcName].clear();
            parityMap[plcName].clear();
            stopBitsMap[plcName].clear();
            rwDelayMap[plcName].clear();
            typeMap[plcName].clear();
            rwLenMap[plcName].clear();
            this->ui->nameCbBox->removeItem(index);
            return;
        }else
            QLOG_INFO()<<"已放弃删除"<<plcName<<"传感器";
        return;
    }
}
Example #21
0
void PlcSrConfig::savePlcConfig()
{
    QString fileName = "PlcSrConfig.xml";
    QFile file(fileName);
    if(false==file.open(QIODevice::ReadWrite|QIODevice::Truncate))
    {
        return;
    }
    else
    {
        QXmlStreamWriter writer(&file);
        writer.setAutoFormatting(true);
        writer.writeStartDocument();// 写文档头
        writer.writeStartElement("PlcSensorConfig_List");
        for (int i = 0; i <plcList.count(); i++)
        {
            QString pid=plcList.at(i);
            //先取出对应键值
            plcName=plcNameMap[pid];
            portId=portIdMap[pid];
            baudRate=baudRateMap[pid];
            parity=parityMap[pid];
            dataBits=dataBitsMap[pid];
            stopBits=stopBitsMap[pid];
            type=typeMap[pid];
            rwDelay=rwDelayMap[pid];
            rwLen=rwLenMap[pid];
            QLOG_INFO()<<portId<<baudRate<<parity<<dataBits<<stopBits<<type<<rwDelay<<rwLen;
            //再写入保存
            writer.writeStartElement("plc");
            writer.writeAttribute("ID", pid);
            writer.writeTextElement("name", plcName);
            writer.writeTextElement("portId",portId);
            writer.writeTextElement("baudRate",baudRate);
            writer.writeTextElement("dataBits",dataBits);
            writer.writeTextElement("parity",parity);
            writer.writeTextElement("stopBits",stopBits);
            writer.writeTextElement("rwDelay",rwDelay);
            writer.writeTextElement("type",type);
            writer.writeTextElement("rwLen",rwLen);
            writer.writeEndElement();
        }
        writer.writeEndDocument();
        QLOG_INFO()<<"本地配置保存完成";
        file.close();
    }
}
Example #22
0
void TSBrowserApplication::startApp()
{
	QWidget *_mw = this->mainWindow();
	
	_mw->show();

	QLOG_INFO() << QString("Program starting: Show main window.");
}
Example #23
0
void initDBus(const QString &dbusAddress)
{
	VBusItems::setDBusAddress(dbusAddress);

	QLOG_INFO() << "Wait for local settings on DBus... ";
	VBusItem settings;
	settings.consume("com.victronenergy.settings", "/Settings/Vrmlogger/Url");
	for (;;) {
		QVariant reply = settings.getValue();
		QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
		if (reply.isValid())
			break;
		usleep(500000);
		QLOG_INFO() << "Waiting...";
	}
	QLOG_INFO() << "Local settings found";
}
void ItemsManagerWorker::QueueRequest(const QNetworkRequest &request, const ItemLocation &location) {
    QLOG_INFO() << "Queued" << location.GetHeader().c_str();
    ItemsRequest items_request;
    items_request.network_request = request;
    items_request.id = queue_id_++;
    items_request.location = location;
    queue_.push(items_request);
}
Example #25
0
Core::Core( void )
{
	QLOG_INFO( "Core created successfully." );

	// Seed the random number generator.
	QLib::Timing::QTime time;
	time.SetToCurrentTime();
	srand( time.GetDouble() );
}
Example #26
0
void MainWindow::clientConnected() {  
  QTcpSocket *client_connection = tcp_server_->nextPendingConnection();
  QLOG_INFO() << QString("Client connected: %1:%2").arg(client_connection->peerAddress().toString()).arg(client_connection->peerPort());
  
  connect(client_connection, SIGNAL(disconnected()),
          this, SLOT(clientDisconnected()));
  connect(client_connection, SIGNAL(readyRead()),
          this, SLOT(clientDataAvailable()));
}
void UASActionsWidget::currentWaypointChanged(quint16 wpid)
{
    if (m_last_wpid != wpid) {
        m_last_wpid = wpid;
        QLOG_INFO() << "Waypoint Changed to: " << wpid;
        ui.currentWaypointLabel->setText("Current: " + QString::number(wpid));
        ui.waypointListComboBox->setCurrentIndex(ui.waypointListComboBox->findData(QString::number(wpid)));
    }
}
void UpdaterComponent::downloadUpdate(const QVariantMap& updateInfo)
{
  if (isDownloading())
    return;

  QLOG_INFO() << updateInfo;

  if (!updateInfo.contains("version") ||
      !updateInfo.contains("manifestURL") || !updateInfo.contains("manifestHash") ||
      !updateInfo.contains("fileURL") || !updateInfo.contains("fileHash") || !updateInfo.contains("fileName"))
  {
    QLOG_ERROR() << "updateInfo was missing fields required to carry out this action.";
    return;
  }

  m_version = updateInfo["version"].toString();

  m_manifest = new Update(updateInfo["manifestURL"].toString(),
                          UpdateManager::GetPath("manifest.xml.bz2", m_version, false),
                          updateInfo["manifestHash"].toString(), this);

  // determine if we have a manifest (some distros don't like OE)
  m_hasManifest = ((!m_manifest->m_url.isEmpty()) && (!m_manifest->m_hash.isEmpty()));

  m_file = new Update(updateInfo["fileURL"].toString(),
                      UpdateManager::GetPath(updateInfo["fileName"].toString(), m_version, true),
                      updateInfo["fileHash"].toString(), this);


  if (m_hasManifest)
    connect(m_manifest, &Update::fileDone, this, &UpdaterComponent::fileComplete);

  connect(m_file, &Update::fileDone, this, &UpdaterComponent::fileComplete);

  // create directories we need
  QDir dr(QFileInfo(m_file->m_localPath).dir());
  if (!dr.exists())
  {
    if (!dr.mkpath("."))
    {
      QLOG_ERROR() << "Failed to create update directory:" << dr.absolutePath();
      emit downloadError("Failed to create download directory");
      return;
    }
  }

  // this will first check if the files are done
  // and in that case emit the done signal.
  if (fileComplete(NULL))
    return;

  if (!m_manifest->isReady() && m_hasManifest)
    downloadFile(m_manifest);

  if (!m_file->isReady())
    downloadFile(m_file);
}
Example #29
0
void VersionBuilder::buildFromExternalPatches()
{
	QLOG_INFO() << "Building version from external files.";
	int externalOrder = -1;
	for (auto fileName : external_patches)
	{
		QLOG_INFO() << "Reading" << fileName;
		auto file = parseJsonFile(QFileInfo(fileName), false, fileName.endsWith("pack.json"));
		file->name = QFileInfo(fileName).fileName();
		file->fileId = "org.multimc.external." + file->name;
		file->order = (externalOrder += 1);
		file->version = QString();
		file->mcVersion = QString();
		m_version->VersionPatches.append(file);
	}
	// some final touches
	m_version->finalize();
}
Example #30
0
void VersionBuilder::buildFromVersionJson()
{
	QLOG_INFO() << "Building version from version.json and patches within the instance.";
	QLOG_INFO() << "Reading version.json";
	auto file = parseJsonFile(QFileInfo(instance_root.absoluteFilePath("version.json")), false);
	file->name = "Minecraft";
	file->fileId = "org.multimc.version.json";
	file->order = -1;
	file->version = m_instance->intendedVersionId();
	file->mcVersion = m_instance->intendedVersionId();
	m_version->VersionPatches.append(file);

	// load all patches, put into map for ordering, apply in the right order
	readInstancePatches();

	// some final touches
	m_version->finalize();
}