mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-04 15:55:51 +00:00
Fixes with in-app console
This commit is contained in:
parent
3f2f8f6b35
commit
f29e44209e
@ -1,5 +1,6 @@
|
|||||||
#include "Common.hpp"
|
#include "Common.hpp"
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <csignal>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -134,8 +135,13 @@ QString URDEVersion::fileString(bool withExtension) const
|
|||||||
VectorISAToString(m_vectorISA));
|
VectorISAToString(m_vectorISA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HUPHandler(int) {}
|
||||||
|
|
||||||
void InitializePlatform()
|
void InitializePlatform()
|
||||||
{
|
{
|
||||||
|
/* This can happen when terminating hecl - do nothing */
|
||||||
|
signal(SIGHUP, HUPHandler);
|
||||||
|
|
||||||
#if ZEUS_ARCH_X86_64
|
#if ZEUS_ARCH_X86_64
|
||||||
const_cast<Architecture&>(CurArchitecture) = Architecture::X86_64;
|
const_cast<Architecture&>(CurArchitecture) = Architecture::X86_64;
|
||||||
#elif ZEUS_ARCH_X86
|
#elif ZEUS_ARCH_X86
|
||||||
|
@ -167,37 +167,38 @@ void ParseEscapeSequence(int attribute, QListIterator<QString>& i, QTextCharForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* Normally dark colors, but forced to light colors for visibility */
|
||||||
switch (colorIndex) {
|
switch (colorIndex) {
|
||||||
case 0 : {
|
case 0 : {
|
||||||
color = Qt::black;
|
color = Qt::darkGray;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1 : {
|
case 1 : {
|
||||||
color = Qt::darkRed;
|
color = Qt::red;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2 : {
|
case 2 : {
|
||||||
color = Qt::darkGreen;
|
color = Qt::green;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3 : {
|
case 3 : {
|
||||||
color = Qt::darkYellow;
|
color = Qt::yellow;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4 : {
|
case 4 : {
|
||||||
color = Qt::darkBlue;
|
color = Qt::blue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5 : {
|
case 5 : {
|
||||||
color = Qt::darkMagenta;
|
color = Qt::magenta;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6 : {
|
case 6 : {
|
||||||
color = Qt::darkCyan;
|
color = Qt::cyan;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7 : {
|
case 7 : {
|
||||||
color = Qt::lightGray;
|
color = Qt::white;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default : {
|
default : {
|
||||||
@ -448,9 +449,9 @@ void ParseEscapeSequence(int attribute, QListIterator<QString>& i, QTextCharForm
|
|||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color.setRedF(color.redF() * 0.8);
|
//color.setRedF(color.redF() * 0.8);
|
||||||
color.setGreenF(color.greenF() * 0.8);
|
//color.setGreenF(color.greenF() * 0.8);
|
||||||
color.setBlueF(color.blueF() * 0.8);
|
//color.setBlueF(color.blueF() * 0.8);
|
||||||
textCharFormat.setForeground(color);
|
textCharFormat.setForeground(color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -502,9 +503,9 @@ void ParseEscapeSequence(int attribute, QListIterator<QString>& i, QTextCharForm
|
|||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color.setRedF(color.redF() * 0.8);
|
//color.setRedF(color.redF() * 0.8);
|
||||||
color.setGreenF(color.greenF() * 0.8);
|
//color.setGreenF(color.greenF() * 0.8);
|
||||||
color.setBlueF(color.blueF() * 0.8);
|
//color.setBlueF(color.blueF() * 0.8);
|
||||||
textCharFormat.setBackground(color);
|
textCharFormat.setBackground(color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "MainWindow.hpp"
|
#include "MainWindow.hpp"
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
#include <QMessageBox>
|
||||||
#include "EscapeSequenceParser.hpp"
|
#include "EscapeSequenceParser.hpp"
|
||||||
#include "FileDirDialog.hpp"
|
#include "FileDirDialog.hpp"
|
||||||
|
|
||||||
@ -18,7 +19,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
m_ui->splitter->setSizes({0,100});
|
|
||||||
|
|
||||||
m_ui->aboutIcon->setPixmap(QApplication::windowIcon().pixmap(256, 256));
|
m_ui->aboutIcon->setPixmap(QApplication::windowIcon().pixmap(256, 256));
|
||||||
|
|
||||||
@ -28,6 +28,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
m_ui->recommendedBinaryLabel->setFont(mFont);
|
m_ui->recommendedBinaryLabel->setFont(mFont);
|
||||||
mFont.setPointSize(10);
|
mFont.setPointSize(10);
|
||||||
m_ui->processOutput->setFont(mFont);
|
m_ui->processOutput->setFont(mFont);
|
||||||
|
m_cursor = QTextCursor(m_ui->processOutput->document());
|
||||||
|
|
||||||
m_updateURDEButton = new QPushButton(QStringLiteral("Update URDE"), m_ui->centralwidget);
|
m_updateURDEButton = new QPushButton(QStringLiteral("Update URDE"), m_ui->centralwidget);
|
||||||
m_ui->gridLayout->addWidget(m_updateURDEButton, 2, 3, 1, 1);
|
m_ui->gridLayout->addWidget(m_updateURDEButton, 2, 3, 1, 1);
|
||||||
@ -60,15 +61,20 @@ void MainWindow::onExtract()
|
|||||||
{
|
{
|
||||||
if (m_path.isEmpty())
|
if (m_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
QString imgPath = QFileDialog::getOpenFileName(this, QStringLiteral("Extract Image"), {},
|
QString imgPath = QFileDialog::getOpenFileName(this, QStringLiteral("Extract Image"), m_path,
|
||||||
QStringLiteral("Images (*.iso *.wbfs *.gcm)"));
|
QStringLiteral("Images (*.iso *.wbfs *.gcm)"));
|
||||||
m_ansiString.clear();
|
if (imgPath.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
m_ui->processOutput->clear();
|
m_ui->processOutput->clear();
|
||||||
m_heclProc.close();
|
m_heclProc.close();
|
||||||
m_heclProc.terminate();
|
m_heclProc.terminate();
|
||||||
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
||||||
m_heclProc.setWorkingDirectory(m_path);
|
m_heclProc.setWorkingDirectory(m_path);
|
||||||
m_heclProc.start(m_heclPath, {"extract", "-y", imgPath, m_path});
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
env.insert("TERM", "xterm-color");
|
||||||
|
m_heclProc.setProcessEnvironment(env);
|
||||||
|
m_heclProc.start(m_heclPath, {"extract", "-y", "-o", m_path, imgPath});
|
||||||
|
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
|
|
||||||
@ -93,12 +99,14 @@ void MainWindow::onPackage()
|
|||||||
{
|
{
|
||||||
if (m_path.isEmpty())
|
if (m_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
m_ansiString.clear();
|
|
||||||
m_ui->processOutput->clear();
|
m_ui->processOutput->clear();
|
||||||
m_heclProc.close();
|
m_heclProc.close();
|
||||||
m_heclProc.terminate();
|
m_heclProc.terminate();
|
||||||
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
||||||
m_heclProc.setWorkingDirectory(m_path);
|
m_heclProc.setWorkingDirectory(m_path);
|
||||||
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
env.insert("TERM", "xterm-color");
|
||||||
|
m_heclProc.setProcessEnvironment(env);
|
||||||
m_heclProc.start(m_heclPath, {"package", "-y"});
|
m_heclProc.start(m_heclPath, {"package", "-y"});
|
||||||
|
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
@ -124,12 +132,14 @@ void MainWindow::onLaunch()
|
|||||||
{
|
{
|
||||||
if (m_path.isEmpty())
|
if (m_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
m_ansiString.clear();
|
|
||||||
m_ui->processOutput->clear();
|
m_ui->processOutput->clear();
|
||||||
m_heclProc.close();
|
m_heclProc.close();
|
||||||
m_heclProc.terminate();
|
m_heclProc.terminate();
|
||||||
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
||||||
m_heclProc.setWorkingDirectory(m_path);
|
m_heclProc.setWorkingDirectory(m_path);
|
||||||
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
env.insert("TERM", "xterm-color");
|
||||||
|
m_heclProc.setProcessEnvironment(env);
|
||||||
m_heclProc.start(m_urdePath, {"--no-shader-warmup", m_path + "/out"});
|
m_heclProc.start(m_urdePath, {"--no-shader-warmup", m_path + "/out"});
|
||||||
|
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
@ -148,6 +158,8 @@ void MainWindow::onLaunchFinished(int returnCode)
|
|||||||
void MainWindow::doHECLTerminate()
|
void MainWindow::doHECLTerminate()
|
||||||
{
|
{
|
||||||
m_heclProc.terminate();
|
m_heclProc.terminate();
|
||||||
|
m_cursor.movePosition(QTextCursor::End);
|
||||||
|
m_cursor.insertText("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReturnPressed()
|
void MainWindow::onReturnPressed()
|
||||||
@ -235,14 +247,22 @@ void MainWindow::disableOperations()
|
|||||||
m_ui->extractBtn->setEnabled(false);
|
m_ui->extractBtn->setEnabled(false);
|
||||||
m_ui->packageBtn->setEnabled(false);
|
m_ui->packageBtn->setEnabled(false);
|
||||||
m_ui->launchBtn->setEnabled(false);
|
m_ui->launchBtn->setEnabled(false);
|
||||||
|
m_ui->pathEdit->setEnabled(false);
|
||||||
|
m_ui->browseBtn->setEnabled(false);
|
||||||
|
m_ui->downloadButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::enableOperations()
|
void MainWindow::enableOperations()
|
||||||
{
|
{
|
||||||
disableOperations();
|
disableOperations();
|
||||||
|
m_ui->pathEdit->setEnabled(true);
|
||||||
|
m_ui->browseBtn->setEnabled(true);
|
||||||
|
|
||||||
if (m_path.isEmpty())
|
if (m_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_ui->downloadButton->setEnabled(true);
|
||||||
|
|
||||||
m_ui->extractBtn->setText(QStringLiteral("Extract"));
|
m_ui->extractBtn->setText(QStringLiteral("Extract"));
|
||||||
m_ui->packageBtn->setText(QStringLiteral("Package"));
|
m_ui->packageBtn->setText(QStringLiteral("Package"));
|
||||||
m_ui->launchBtn->setText(QStringLiteral("Launch"));
|
m_ui->launchBtn->setText(QStringLiteral("Launch"));
|
||||||
@ -348,10 +368,29 @@ bool MainWindow::checkDownloadedBinary()
|
|||||||
|
|
||||||
void MainWindow::setPath(const QString& path)
|
void MainWindow::setPath(const QString& path)
|
||||||
{
|
{
|
||||||
m_path = path;
|
QFileInfo finfo(path);
|
||||||
|
QString usePath = finfo.absoluteFilePath();
|
||||||
|
if (!finfo.exists())
|
||||||
|
{
|
||||||
|
if (QMessageBox::question(this, QStringLiteral("Make Directory"),
|
||||||
|
QStringLiteral("%1 does not exist. Create it now?").arg(usePath)) == QMessageBox::Yes)
|
||||||
|
QDir().mkpath(usePath);
|
||||||
|
else
|
||||||
|
usePath = QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!usePath.isEmpty() && !finfo.isDir())
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, QStringLiteral("Directory Error"),
|
||||||
|
QStringLiteral("%1 is not a directory").arg(usePath),
|
||||||
|
QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
|
usePath = QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_path = usePath;
|
||||||
m_settings.setValue(QStringLiteral("working_dir"), m_path);
|
m_settings.setValue(QStringLiteral("working_dir"), m_path);
|
||||||
|
|
||||||
if (!path.isEmpty())
|
if (!m_path.isEmpty())
|
||||||
{
|
{
|
||||||
m_ui->pathEdit->setText(m_path);
|
m_ui->pathEdit->setText(m_path);
|
||||||
m_ui->downloadButton->setToolTip(QString());
|
m_ui->downloadButton->setToolTip(QString());
|
||||||
@ -373,8 +412,7 @@ void MainWindow::initSlots()
|
|||||||
m_heclProc.setEnvironment(QProcessEnvironment::systemEnvironment().toStringList() + QStringList("ConEmuANSI=ON"));
|
m_heclProc.setEnvironment(QProcessEnvironment::systemEnvironment().toStringList() + QStringList("ConEmuANSI=ON"));
|
||||||
#endif
|
#endif
|
||||||
connect(&m_heclProc, &QProcess::readyRead, [=](){
|
connect(&m_heclProc, &QProcess::readyRead, [=](){
|
||||||
m_ansiString = m_heclProc.readAll();
|
setTextTermFormatting(m_heclProc.readAll());
|
||||||
setTextTermFormatting(m_ansiString);
|
|
||||||
m_ui->processOutput->ensureCursorVisible();
|
m_ui->processOutput->ensureCursorVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -384,15 +422,15 @@ void MainWindow::initSlots()
|
|||||||
|
|
||||||
connect(m_ui->browseBtn, &QPushButton::clicked, [=]() {
|
connect(m_ui->browseBtn, &QPushButton::clicked, [=]() {
|
||||||
FileDirDialog dialog(this);
|
FileDirDialog dialog(this);
|
||||||
|
dialog.setDirectory(m_path);
|
||||||
dialog.setWindowTitle("Select Working Directory");
|
dialog.setWindowTitle("Select Working Directory");
|
||||||
int res = dialog.exec();//QFileDialog::getOpenFileName(this, "Select ISO or Directory");
|
int res = dialog.exec();
|
||||||
if (res == QFileDialog::Rejected)
|
if (res == QFileDialog::Rejected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dialog.selectedFiles().size() <= 0)
|
if (dialog.selectedFiles().size() <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* TODO: Add beacon detection */
|
|
||||||
setPath(dialog.selectedFiles().at(0));
|
setPath(dialog.selectedFiles().at(0));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -401,32 +439,74 @@ void MainWindow::initSlots()
|
|||||||
|
|
||||||
static void ReturnInsert(QTextCursor& cur, const QString& text)
|
static void ReturnInsert(QTextCursor& cur, const QString& text)
|
||||||
{
|
{
|
||||||
QStringList list = text.split('\r');
|
auto DoLine = [&](const QString& line)
|
||||||
if (!list.front().isEmpty())
|
|
||||||
cur.insertText(list.front());
|
|
||||||
if (list.size() > 1)
|
|
||||||
{
|
{
|
||||||
for (auto it = list.begin() + 1; it != list.end(); ++it)
|
auto DoReturn = [&](const QString& ret)
|
||||||
{
|
{
|
||||||
cur.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
|
if (!ret.isEmpty())
|
||||||
if (!it->isEmpty())
|
{
|
||||||
cur.insertText(*it);
|
cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ret.size());
|
||||||
|
cur.insertText(ret);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
QStringList list = line.split('\r');
|
||||||
|
DoReturn(list.front());
|
||||||
|
if (list.size() > 1)
|
||||||
|
{
|
||||||
|
for (auto it = list.begin() + 1; it != list.end(); ++it)
|
||||||
|
{
|
||||||
|
cur.movePosition(QTextCursor::StartOfLine);
|
||||||
|
DoReturn(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
QStringList lineSplit = text.split('\n');
|
||||||
|
DoLine(lineSplit.front());
|
||||||
|
if (lineSplit.size() > 1)
|
||||||
|
{
|
||||||
|
for (auto it = lineSplit.begin() + 1; it != lineSplit.end(); ++it)
|
||||||
|
{
|
||||||
|
cur.movePosition(QTextCursor::EndOfLine);
|
||||||
|
cur.insertText("\n");
|
||||||
|
DoLine(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ReturnInsert(QTextCursor& cur, const QString& text, const QTextCharFormat& format)
|
static void ReturnInsert(QTextCursor& cur, const QString& text, const QTextCharFormat& format)
|
||||||
{
|
{
|
||||||
QStringList list = text.split('\r');
|
auto DoLine = [&](const QString& line)
|
||||||
if (!list.front().isEmpty())
|
|
||||||
cur.insertText(list.front(), format);
|
|
||||||
if (list.size() > 1)
|
|
||||||
{
|
{
|
||||||
for (auto it = list.begin() + 1; it != list.end(); ++it)
|
auto DoReturn = [&](const QString& ret)
|
||||||
{
|
{
|
||||||
cur.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
|
if (!ret.isEmpty())
|
||||||
if (!it->isEmpty())
|
{
|
||||||
cur.insertText(*it, format);
|
cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ret.size());
|
||||||
|
cur.insertText(ret, format);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
QStringList list = line.split('\r');
|
||||||
|
DoReturn(list.front());
|
||||||
|
if (list.size() > 1)
|
||||||
|
{
|
||||||
|
for (auto it = list.begin() + 1; it != list.end(); ++it)
|
||||||
|
{
|
||||||
|
cur.movePosition(QTextCursor::StartOfLine);
|
||||||
|
DoReturn(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
QStringList lineSplit = text.split('\n');
|
||||||
|
DoLine(lineSplit.front());
|
||||||
|
if (lineSplit.size() > 1)
|
||||||
|
{
|
||||||
|
for (auto it = lineSplit.begin() + 1; it != lineSplit.end(); ++it)
|
||||||
|
{
|
||||||
|
cur.movePosition(QTextCursor::EndOfLine);
|
||||||
|
cur.insertText("\n", format);
|
||||||
|
DoLine(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,36 +515,32 @@ void MainWindow::setTextTermFormatting(const QString& text)
|
|||||||
{
|
{
|
||||||
m_inContinueNote = false;
|
m_inContinueNote = false;
|
||||||
|
|
||||||
QTextDocument* document = m_ui->processOutput->document();
|
QRegExp const escapeSequenceExpression(R"(\x1B\[([\d;\?]+)([mlh]))");
|
||||||
QRegExp const escapeSequenceExpression(R"(\x1B\[([\d;]+)m)");
|
QTextCharFormat defaultTextCharFormat = m_cursor.charFormat();
|
||||||
QTextCursor cursor(document);
|
|
||||||
cursor.movePosition(QTextCursor::End);
|
|
||||||
QTextCharFormat defaultTextCharFormat = cursor.charFormat();
|
|
||||||
cursor.beginEditBlock();
|
|
||||||
int offset = escapeSequenceExpression.indexIn(text);
|
int offset = escapeSequenceExpression.indexIn(text);
|
||||||
ReturnInsert(cursor, text.mid(0, offset));
|
ReturnInsert(m_cursor, text.mid(0, offset));
|
||||||
QTextCharFormat textCharFormat = defaultTextCharFormat;
|
QTextCharFormat textCharFormat = defaultTextCharFormat;
|
||||||
while (!(offset < 0)) {
|
while (offset >= 0) {
|
||||||
int previousOffset = offset + escapeSequenceExpression.matchedLength();
|
int previousOffset = offset + escapeSequenceExpression.matchedLength();
|
||||||
QStringList capturedTexts = escapeSequenceExpression.capturedTexts().back().split(';');
|
if (escapeSequenceExpression.capturedTexts()[2] == "m")
|
||||||
QListIterator< QString > i(capturedTexts);
|
{
|
||||||
while (i.hasNext()) {
|
QStringList capturedTexts = escapeSequenceExpression.capturedTexts()[1].split(';');
|
||||||
bool ok = false;
|
QListIterator<QString> i(capturedTexts);
|
||||||
int attribute = i.next().toInt(&ok);
|
while (i.hasNext()) {
|
||||||
Q_ASSERT(ok);
|
bool ok = false;
|
||||||
ParseEscapeSequence(attribute, i, textCharFormat, defaultTextCharFormat);
|
int attribute = i.next().toInt(&ok);
|
||||||
|
Q_ASSERT(ok);
|
||||||
|
ParseEscapeSequence(attribute, i, textCharFormat, defaultTextCharFormat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
offset = escapeSequenceExpression.indexIn(text, previousOffset);
|
offset = escapeSequenceExpression.indexIn(text, previousOffset);
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
ReturnInsert(cursor, text.mid(previousOffset), textCharFormat);
|
ReturnInsert(m_cursor, text.mid(previousOffset), textCharFormat);
|
||||||
} else {
|
} else {
|
||||||
ReturnInsert(cursor, text.mid(previousOffset, offset - previousOffset), textCharFormat);
|
ReturnInsert(m_cursor, text.mid(previousOffset, offset - previousOffset), textCharFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor.setCharFormat(defaultTextCharFormat);
|
m_cursor.setCharFormat(defaultTextCharFormat);
|
||||||
cursor.endEditBlock();
|
|
||||||
cursor.movePosition(QTextCursor::End);
|
|
||||||
m_ui->processOutput->setTextCursor(cursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::insertContinueNote(const QString& text)
|
void MainWindow::insertContinueNote(const QString& text)
|
||||||
@ -473,14 +549,8 @@ void MainWindow::insertContinueNote(const QString& text)
|
|||||||
return;
|
return;
|
||||||
m_inContinueNote = true;
|
m_inContinueNote = true;
|
||||||
|
|
||||||
QTextDocument* document = m_ui->processOutput->document();
|
m_cursor.movePosition(QTextCursor::End);
|
||||||
QTextCursor cursor(document);
|
QTextCharFormat textCharFormat = m_cursor.charFormat();
|
||||||
cursor.movePosition(QTextCursor::End);
|
|
||||||
QTextCharFormat textCharFormat = cursor.charFormat();
|
|
||||||
textCharFormat.setForeground(QColor(0,255,0));
|
textCharFormat.setForeground(QColor(0,255,0));
|
||||||
cursor.beginEditBlock();
|
m_cursor.insertText(text + '\n', textCharFormat);
|
||||||
cursor.insertText(text + '\n', textCharFormat);
|
|
||||||
cursor.endEditBlock();
|
|
||||||
cursor.movePosition(QTextCursor::End);
|
|
||||||
m_ui->processOutput->setTextCursor(cursor);
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QTextCursor>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "DownloadManager.hpp"
|
#include "DownloadManager.hpp"
|
||||||
#include "Common.hpp"
|
#include "Common.hpp"
|
||||||
@ -18,7 +19,7 @@ class MainWindow : public QMainWindow
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Ui::MainWindow* m_ui;
|
Ui::MainWindow* m_ui;
|
||||||
QString m_ansiString;
|
QTextCursor m_cursor;
|
||||||
QString m_path;
|
QString m_path;
|
||||||
QString m_urdePath;
|
QString m_urdePath;
|
||||||
QString m_heclPath;
|
QString m_heclPath;
|
||||||
|
@ -34,204 +34,88 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QPushButton" name="extractBtn">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Extract</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QPushButton" name="packageBtn">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Package</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QPushButton" name="launchBtn">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Launch</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="4">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>167</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="5">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Wor&king Directory:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>pathEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="pathEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement">
|
|
||||||
<size>
|
|
||||||
<width>1</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="browseBtn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="5">
|
<item row="1" column="0" colspan="5">
|
||||||
<widget class="QTabWidget" name="heclTabs">
|
<widget class="QTabWidget" name="heclTabs">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dataTab">
|
<widget class="QWidget" name="dataTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Data</string>
|
<string>Data</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<property name="leftMargin">
|
<item row="0" column="0">
|
||||||
<number>2</number>
|
<widget class="QTextEdit" name="processOutput">
|
||||||
</property>
|
<property name="palette">
|
||||||
<property name="topMargin">
|
<palette>
|
||||||
<number>2</number>
|
<active>
|
||||||
</property>
|
<colorrole role="Text">
|
||||||
<property name="rightMargin">
|
<brush brushstyle="SolidPattern">
|
||||||
<number>2</number>
|
<color alpha="255">
|
||||||
</property>
|
<red>255</red>
|
||||||
<property name="bottomMargin">
|
<green>255</green>
|
||||||
<number>2</number>
|
<blue>255</blue>
|
||||||
</property>
|
</color>
|
||||||
<item>
|
</brush>
|
||||||
<widget class="QSplitter" name="splitter">
|
</colorrole>
|
||||||
<property name="orientation">
|
<colorrole role="Base">
|
||||||
<enum>Qt::Vertical</enum>
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>29</red>
|
||||||
|
<green>29</green>
|
||||||
|
<blue>29</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="Text">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
<colorrole role="Base">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>29</red>
|
||||||
|
<green>29</green>
|
||||||
|
<blue>29</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="Text">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>120</red>
|
||||||
|
<green>120</green>
|
||||||
|
<blue>120</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
<colorrole role="Base">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>240</red>
|
||||||
|
<green>240</green>
|
||||||
|
<blue>240</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QListView" name="pakList"/>
|
|
||||||
<widget class="QTextEdit" name="processOutput">
|
|
||||||
<property name="palette">
|
|
||||||
<palette>
|
|
||||||
<active>
|
|
||||||
<colorrole role="Text">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>255</red>
|
|
||||||
<green>255</green>
|
|
||||||
<blue>255</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
<colorrole role="Base">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</active>
|
|
||||||
<inactive>
|
|
||||||
<colorrole role="Text">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>255</red>
|
|
||||||
<green>255</green>
|
|
||||||
<blue>255</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
<colorrole role="Base">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</inactive>
|
|
||||||
<disabled>
|
|
||||||
<colorrole role="Text">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>120</red>
|
|
||||||
<green>120</green>
|
|
||||||
<blue>120</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
<colorrole role="Base">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>240</red>
|
|
||||||
<green>240</green>
|
|
||||||
<blue>240</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</disabled>
|
|
||||||
</palette>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -776,6 +660,104 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="extractBtn">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Extract</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="packageBtn">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Package</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QPushButton" name="launchBtn">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Launch</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>167</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="5">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wor&king Directory:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>pathEdit</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="pathEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>1</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="browseBtn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user