Merge from Git repository

--HG--
branch : develop
hg/develop
NO-BREAK SPACE OÜ 5 years ago
commit 8cbadfbbcc

@ -0,0 +1,11 @@
#include "main.h"
int main(int argc, char * argv[])
{
QApplication application(argc, argv);
MainWindow window;
window.show();
return application.exec();
}

@ -0,0 +1,8 @@
#ifndef MAIN_H
#define MAIN_H
#include <QApplication>
#include "mainwindow.h"
#endif // MAIN_H

@ -0,0 +1,253 @@
#include "mainwindow.h"
MainWindow::MainWindow(QWidget * parent) :
QMainWindow(parent),
uiMainWindow_(new Ui::MainWindow),
processList_(new QProcess(this)),
processSearch_(new QProcess(this)),
processPack_(new QProcess(this)),
processUnpack_(new QProcess(this))
{
uiMainWindow_->setupUi(this);
settings_ = new QSettings("bnp_make_frontend.cfg", QSettings::IniFormat);
bnpMakeBinary_ = settings_->value("BnpMakeBinary").toString();
dataPath_ = settings_->value("DataPath").toString();
uiMainWindow_->lineEditSearchPath->setText(dataPath_);
uiMainWindow_->lineEditBnpMake->setText(bnpMakeBinary_);
uiMainWindow_->lineEditDataPath->setText(dataPath_);
connect(uiMainWindow_->pushButtonListBrowse, SIGNAL(clicked()), this, SLOT(onButtonListBrowseClicked()));
connect(uiMainWindow_->pushButtonList, SIGNAL(clicked()), this, SLOT(onButtonListClicked()));
connect(processList_, SIGNAL(finished(int)), this, SLOT(onProcessListComplete()));
connect(uiMainWindow_->pushButtonSearchBrowse, SIGNAL(clicked()), this, SLOT(onButtonSearchBrowseClicked()));
connect(uiMainWindow_->pushButtonSearch, SIGNAL(clicked()), this, SLOT(onButtonSearchClicked()));
connect(processSearch_, SIGNAL(finished(int)), this, SLOT(onProcessSearchComplete()));
connect(uiMainWindow_->pushButtonPackBrowse, SIGNAL(clicked()), this, SLOT(onButtonPackBrowseClicked()));
connect(uiMainWindow_->pushButtonPack, SIGNAL(clicked()), this, SLOT(onButtonPackClicked()));
connect(processPack_, SIGNAL(finished(int)), this, SLOT(onProcessPackComplete()));
connect(uiMainWindow_->pushButtonUnpackBrowse, SIGNAL(clicked()), this, SLOT(onButtonUnpackBrowseClicked()));
connect(uiMainWindow_->pushButtonUnpack, SIGNAL(clicked()), this, SLOT(onButtonUnpackClicked()));
connect(processUnpack_, SIGNAL(finished(int)), this, SLOT(onProcessUnpackComplete()));
connect(uiMainWindow_->pushButtonBnpMakeBrowse, SIGNAL(clicked()), this, SLOT(onButtonBnpMakeBrowseClicked()));
connect(uiMainWindow_->pushButtonDataPathBrowse, SIGNAL(clicked()), this, SLOT(onButtonDataPathBrowseClicked()));
}
MainWindow::~MainWindow()
{
delete uiMainWindow_;
}
void MainWindow::onButtonListBrowseClicked()
{
QString fileName;
fileName = QFileDialog::getOpenFileName(this, "Choose a BNP file", dataPath_, "BNP file (*.bnp)");
uiMainWindow_->lineEditList->setText(fileName);
}
void MainWindow::onButtonListClicked()
{
QStringList arguments;
uiMainWindow_->textEditList->clear();
if (bnpMakeBinary_ != "")
if (uiMainWindow_->lineEditList->text() != "")
{
arguments << "/l" << uiMainWindow_->lineEditList->text();
processList_->start(bnpMakeBinary_, arguments);
}
else
uiMainWindow_->textEditList->append("Choose a BNP file.");
else
uiMainWindow_->textEditList->append("Check bnp_make path.");
}
void MainWindow::onProcessListComplete()
{
QString output;
output = processList_->readAllStandardOutput();
uiMainWindow_->textEditList->append(output);
uiMainWindow_->textEditList->append("List complete.");
}
void MainWindow::onButtonSearchBrowseClicked()
{
QString directory;
directory = QFileDialog::getExistingDirectory(this, tr("Choose a directory"), dataPath_, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
uiMainWindow_->lineEditSearchPath->setText(directory);
}
void MainWindow::onButtonSearchClicked()
{
QDir dir;
QStringList nameFilters;
uiMainWindow_->textEditSearch->clear();
if (bnpMakeBinary_ != "")
if (uiMainWindow_->lineEditSearchPath->text() != "")
{
dir.cd(uiMainWindow_->lineEditSearchPath->text());
nameFilters << "*.bnp";
dir.setNameFilters(nameFilters);
dir.setFilter(QDir::Files);
fileInfoList_ = dir.entryInfoList();
fileInfoListIndex_ = 0;
onProcessSearchComplete();
}
else
uiMainWindow_->textEditSearch->append("Choose a directory.");
else
uiMainWindow_->textEditSearch->append("Check bnp_make path.");
}
void MainWindow::onProcessSearchComplete()
{
QFileInfo fileInfo;
QStringList arguments;
QString output;
QStringList outputList;
QString line;
if (fileInfoListIndex_ > 0)
{
output = processSearch_->readAllStandardOutput();
if (uiMainWindow_->lineEditSearchString->text() == "")
uiMainWindow_->textEditSearch->append(output);
else
{
outputList = output.split("\n");
foreach (line, outputList)
if (line.contains(uiMainWindow_->lineEditSearchString->text()))
uiMainWindow_->textEditSearch->append(line.trimmed());
}
}
if (fileInfoListIndex_ < fileInfoList_.count())
{
fileInfo = fileInfoList_.at(fileInfoListIndex_++);
uiMainWindow_->textEditSearch->append("===> " + uiMainWindow_->lineEditSearchPath->text() + "/" + fileInfo.fileName() + ":");
arguments << "/l" << uiMainWindow_->lineEditSearchPath->text() + "/" + fileInfo.fileName();
processSearch_->start(bnpMakeBinary_, arguments);
}
else
{
uiMainWindow_->textEditSearch->append("Search complete.");
}
}
void MainWindow::onButtonPackBrowseClicked()
{
QString directory;
directory = QFileDialog::getExistingDirectory(this, tr("Choose the source directory"), dataPath_, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
uiMainWindow_->lineEditPack->setText(directory);
}
void MainWindow::onButtonPackClicked()
{
QStringList arguments;
uiMainWindow_->textEditPack->clear();
if (bnpMakeBinary_ != "")
if (uiMainWindow_->lineEditPack->text() != "")
{
uiMainWindow_->textEditPack->append("Pack in progress...");
arguments << "/p" << uiMainWindow_->lineEditPack->text();
processPack_->start(bnpMakeBinary_, arguments);
}
else
uiMainWindow_->textEditPack->append("Choose the source directory.");
else
uiMainWindow_->textEditPack->append("Check bnp_make path.");
}
void MainWindow::onProcessPackComplete()
{
QString output;
output = processPack_->readAllStandardOutput();
uiMainWindow_->textEditPack->append(output);
uiMainWindow_->textEditPack->append("Pack complete.");
}
void MainWindow::onButtonUnpackBrowseClicked()
{
QString fileName;
fileName = QFileDialog::getOpenFileName(this, "Choose a BNP file", dataPath_, "BNP file (*.bnp)");
uiMainWindow_->lineEditUnpack->setText(fileName);
}
void MainWindow::onButtonUnpackClicked()
{
QStringList arguments;
uiMainWindow_->textEditUnpack->clear();
if (bnpMakeBinary_ != "")
if (uiMainWindow_->lineEditUnpack->text() != "")
{
uiMainWindow_->textEditUnpack->append("Unpack in progress...");
arguments << "/u" << uiMainWindow_->lineEditUnpack->text();
processUnpack_->start(bnpMakeBinary_, arguments);
}
else
uiMainWindow_->textEditUnpack->append("Choose a BNP file.");
else
uiMainWindow_->textEditUnpack->append("Check bnp_make path.");
}
void MainWindow::onProcessUnpackComplete()
{
uiMainWindow_->textEditUnpack->append("Unpack complete.");
}
void MainWindow::onButtonBnpMakeBrowseClicked()
{
QString fileName;
fileName = QFileDialog::getOpenFileName(this, "Locate the bnp_make binary", dataPath_);
uiMainWindow_->lineEditBnpMake->setText(fileName);
bnpMakeBinary_ = fileName;
settings_->setValue("BnpMakeBinary", fileName);
uiMainWindow_->textEditSettings->clear();
if (fileName != "")
uiMainWindow_->textEditSettings->append("bnp_make path changed.");
else
uiMainWindow_->textEditSettings->append("Locate the bnp_make binary.");
}
void MainWindow::onButtonDataPathBrowseClicked()
{
QString directory;
directory = QFileDialog::getExistingDirectory(this, tr("Choose a directory"), dataPath_, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
uiMainWindow_->lineEditDataPath->setText(directory);
dataPath_ = directory;
settings_->setValue("DataPath", directory);
uiMainWindow_->lineEditSearchPath->setText(directory);
uiMainWindow_->textEditSettings->clear();
uiMainWindow_->textEditSettings->append("Data path changed.");
}

@ -0,0 +1,61 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSettings>
#include <QProcess>
#include <QFileDialog>
#include "ui_mainwindow.h"
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget * parent = 0);
~MainWindow();
public slots:
void onButtonListBrowseClicked();
void onButtonListClicked();
void onProcessListComplete();
void onButtonSearchBrowseClicked();
void onButtonSearchClicked();
void onProcessSearchComplete();
void onButtonPackBrowseClicked();
void onButtonPackClicked();
void onProcessPackComplete();
void onButtonUnpackBrowseClicked();
void onButtonUnpackClicked();
void onProcessUnpackComplete();
void onButtonBnpMakeBrowseClicked();
void onButtonDataPathBrowseClicked();
private:
Ui::MainWindow * uiMainWindow_;
QSettings * settings_;
QString bnpMakeBinary_;
QString dataPath_;
QProcess * processList_;
QProcess * processSearch_;
int fileInfoListIndex_;
QFileInfoList fileInfoList_;
QProcess * processPack_;
QProcess * processUnpack_;
};
#endif // MAINWINDOW_H

@ -0,0 +1,322 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>bnp-make-frontend</string>
</property>
<property name="windowIcon">
<iconset resource="bnp-make-frontend.qrc">
<normaloff>:/images/bnp-make-frontend.ico</normaloff>:/images/bnp-make-frontend.ico</iconset>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidgetMenu">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabList">
<attribute name="title">
<string>List</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayoutList">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutList">
<item>
<widget class="QLabel" name="labelList">
<property name="text">
<string>BNP file:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditList">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonListBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButtonList">
<property name="text">
<string>List</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEditList">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSearch">
<attribute name="title">
<string>Search</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayoutSearch">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutSearchPath">
<item>
<widget class="QLabel" name="labelSearchPath">
<property name="text">
<string>Search path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditSearchPath">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSearchBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutSearchString">
<item>
<widget class="QLabel" name="labelSearchString">
<property name="text">
<string>Search string:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditSearchString"/>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButtonSearch">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEditSearch">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabPack">
<attribute name="title">
<string>Pack</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QVBoxLayout" name="verticalLayoutPack">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutPack">
<item>
<widget class="QLabel" name="labelPack">
<property name="text">
<string>Source path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditPack">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonPackBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButtonPack">
<property name="text">
<string>Pack</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEditPack">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabUnpack">
<attribute name="title">
<string>Unpack</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayoutUnpack">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutUnpack">
<item>
<widget class="QLabel" name="labelUnpack">
<property name="text">
<string>BNP file:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditUnpack">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonUnpackBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButtonUnpack">
<property name="text">
<string>Unpack</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEditUnpack">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSettings">
<attribute name="title">
<string>Settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayoutSettings">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutBnpMake">
<item>
<widget class="QLabel" name="labelSettingsBnpMake">
<property name="text">
<string>bnp_make path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditBnpMake">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonBnpMakeBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutDataPath">
<item>
<widget class="QLabel" name="labelDataPath">
<property name="text">
<string>Data path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditDataPath">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDataPathBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEditSettings">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="bnp-make-frontend.qrc"/>
</resources>
<connections/>
</ui>
Loading…
Cancel
Save