Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
arbtttrn6 authored May 7, 2023
1 parent ef109e5 commit eeb5d15
Show file tree
Hide file tree
Showing 9 changed files with 719 additions and 0 deletions.
26 changes: 26 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "mainwindow.h"

#include <QApplication>
#include <QTranslator>
#include <QFile>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setApplicationName("qstudiomdl");
QCoreApplication::setOrganizationName("arbtttrn6");
QLocale systemLocale = QLocale::system();
QTranslator translator;
QString translationFileName = QCoreApplication::applicationName() + "_" + systemLocale.name() + ".qm";
if (QFile::exists(translationFileName)) {
translator.load(translationFileName);
a.installTranslator(&translator);
} else {
translator.load(QCoreApplication::applicationName() + "_eo.qm");
a.installTranslator(&translator);
}

MainWindow w;
w.show();
return a.exec();
}
107 changes: 107 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLineEdit>
#include <QFileDialog>
#include <QDebug>
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);

if (settings.contains("GameInfoVojo")) {
gameinfotxtvojo = settings.value("GameInfoVojo").toString();
ui->tekst_gameinfotxtvojo->setPlainText(gameinfotxtvojo);
};
if (settings.contains("StudiomdlVojo")) {
studiomdlavojo = settings.value("StudiomdlVojo").toString();
ui->tekst_studiomdlvojo->setPlainText(studiomdlavojo);
}
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_pushButton_clicked()
{
studiomdlavojo = QFileDialog::getOpenFileName(this, "Malfermi dosieron", "", "Ĉiuj dosieroj (*)");
ui->tekst_studiomdlvojo->setPlainText(studiomdlavojo);
settings.setValue("StudiomdlVojo", studiomdlavojo);
}

void MainWindow::on_pushButton_4_clicked()
{
gameinfotxtvojo = QFileDialog::getOpenFileName(this, "Malfermi dosieron", "", "Necesaj (*.txt)");
ui->tekst_gameinfotxtvojo->setPlainText(gameinfotxtvojo);
settings.setValue("GameInfoVojo", gameinfotxtvojo);
}

void MainWindow::on_actionMalfermi_qc_dosieron_triggered()
{
qcdosiervojo = QFileDialog::getOpenFileName(this, "Malfermi dosieron", "", "Necesaj (*.qc)");
qcdosiernomo = "./" + QFileInfo(qcdosiervojo).fileName();
processarg << qcdosiernomo;
SetupWindowTitle(this, "Qstudiomdl @ " + qcdosiervojo);
}

void MainWindow::on_actionEliri_triggered()
{
QApplication::quit();
}

void MainWindow::on_actionPri_QT_triggered()
{
QApplication::aboutQt();
}

void MainWindow::on_pushButton_5_clicked()
{
QString dosierujo = QFileInfo(qcdosiervojo).absolutePath();
process.setWorkingDirectory(dosierujo);
//qDebug() << "Nun dosierujo: " << dosierujo;
process.setProcessChannelMode(QProcess::MergedChannels);
process.start(studiomdlavojo, processarg);
process.waitForStarted();
process.waitForFinished(-1);
if (!process.waitForFinished()) {
qDebug() << "Failed to run process";
};
if (process.exitStatus() == QProcess::CrashExit) {
qDebug() << "Process crashed";
};
if (process.exitCode() != 0) {
qDebug() << "Process exited with error code" << process.exitCode();
};
QString eligo = process.readAll();
ui->tekst_studiomdleligo->setPlainText(eligo);
//qDebug() << "qc nomo: " << qcdosiernomo;
//qDebug() << "studiomdl vojo: " << studiomdlavojo;
//qDebug() << "proces erero: "<< process.error();
process.terminate();
}

void MainWindow::on_pushButton_6_clicked()
{
ui->tekst_studiomdleligo->setPlainText("");
}

void MainWindow::on_tekst_studiomdlvojo_textChanged()
{
studiomdlavojo = ui->tekst_studiomdlvojo->toPlainText();
settings.setValue("StudiomdlVojo", studiomdlavojo);
}

void MainWindow::on_actionPri_la_programo_triggered()
{
QMessageBox prila(this);
prila.setWindowTitle(tr("Informaĵo"));
prila.setTextFormat(Qt::RichText);
prila.setText("<h2>qstudiomdl</h2><p>Autoro: arbtttrn6 (arturaiwasan[@]gmail.com)</p>\
<br><a href='https://vk.com/btttrn6'>\
VK</a>");
prila.exec();
}
53 changes: 53 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QProcess>
#include <QSettings>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
QString studiomdlavojo;
QString qcdosiernomo;
QString gameinfotxtvojo;
QString qcdosiervojo;
void SetupWindowTitle(QMainWindow *MainWindow, QString title)
{
MainWindow->setWindowTitle(title);
};
QProcess process;
QStringList processarg {};
QSettings settings;

private slots:
void on_pushButton_clicked();

void on_pushButton_4_clicked();

void on_actionMalfermi_qc_dosieron_triggered();

void on_actionEliri_triggered();

void on_actionPri_QT_triggered();

void on_pushButton_5_clicked();

void on_pushButton_6_clicked();

void on_tekst_studiomdlvojo_textChanged();

void on_actionPri_la_programo_triggered();

private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
Loading

0 comments on commit eeb5d15

Please sign in to comment.