triage: small tweaks

This commit is contained in:
Daniel Marjamäki 2018-01-01 10:52:51 +01:00
parent 4c490b599b
commit 3b6fbd067e
3 changed files with 20 additions and 23 deletions

View File

@ -12,12 +12,11 @@ class QWidget;
class LineNumberArea; class LineNumberArea;
class CodeEditor : public QPlainTextEdit class CodeEditor : public QPlainTextEdit {
{
Q_OBJECT Q_OBJECT
public: public:
CodeEditor(QWidget *parent = 0); explicit CodeEditor(QWidget *parent = 0);
void lineNumberAreaPaintEvent(QPaintEvent *event); void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth(); int lineNumberAreaWidth();
@ -35,10 +34,9 @@ private:
}; };
class LineNumberArea : public QWidget class LineNumberArea : public QWidget {
{
public: public:
LineNumberArea(CodeEditor *editor) : QWidget(editor) { explicit LineNumberArea(CodeEditor *editor) : QWidget(editor) {
codeEditor = editor; codeEditor = editor;
} }

View File

@ -55,25 +55,25 @@ void MainWindow::showResult(QListWidgetItem *item)
QProcess process; QProcess process;
process.setWorkingDirectory(WORK_FOLDER); process.setWorkingDirectory(WORK_FOLDER);
// Download archive
if (!QFileInfo(WORK_FOLDER + '/' + archiveName).exists()) { if (!QFileInfo(WORK_FOLDER + '/' + archiveName).exists()) {
// Download archive
process.start("wget", QStringList()<<url); process.start("wget", QStringList()<<url);
if (!process.waitForFinished(-1)) if (!process.waitForFinished(-1))
return; return;
}
// Unpack archive // Unpack archive
QStringList args; QStringList args;
if (url.endsWith(".tar.gz")) if (url.endsWith(".tar.gz"))
args << "xzvf"; args << "xzvf";
else if (url.endsWith(".tar.bz2")) else if (url.endsWith(".tar.bz2"))
args << "xjvf"; args << "xjvf";
else if (url.endsWith(".tar.xz")) else if (url.endsWith(".tar.xz"))
args << "xJvf"; args << "xJvf";
args << archiveName; args << archiveName;
process.start("tar", args); process.start("tar", args);
if (!process.waitForFinished(-1)) if (!process.waitForFinished(-1))
return; return;
}
// Open file // Open file
ui->code->setFocus(); ui->code->setFocus();

View File

@ -5,11 +5,10 @@
#include <QListWidgetItem> #include <QListWidgetItem>
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
} }
class MainWindow : public QMainWindow class MainWindow : public QMainWindow {
{
Q_OBJECT Q_OBJECT
public: public: