Starting to add config stuff.

This commit is contained in:
Ernst 2018-09-05 20:41:34 -07:00
parent d5a04e7795
commit 1cccc4ed75
6 changed files with 120 additions and 43 deletions

0
bin/data/declare1.di Normal file
View File

0
bin/data/define1.d Normal file
View File

4
bin/projectName.json Normal file
View File

@ -0,0 +1,4 @@
{
"defines" : "bin/data/*.d",
"declarations" : "bin/data/*.di"
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.6.2, 2018-09-01T18:17:36. -->
<!-- Written by QtCreator 4.6.2, 2018-09-05T17:56:36. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -292,7 +292,7 @@
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">data.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/Users/bernst/Documents/build-data-Desktop-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

View File

@ -6,50 +6,13 @@
#include <QApplication>
#include <QBitmap>
#include <QComboBox>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QJsonDocument>
#include <QJsonObject>
#include <QTextStream>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
/*connect( comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
ui->stackedWidget_2->setCurrentIndex(index);
});
const int currentIndex = 0;
comboBox->setCurrentIndex(currentIndex);
ui->stackedWidget_2->setCurrentIndex(currentIndex);*/
/*const auto pOutputDock = new OutputDock();
pOutputDock->setMinimumHeight(50);
this->addDockWidget(Qt::BottomDockWidgetArea, pOutputDock->GetDock());
pOutputDock->setMinimumHeight(0);*/
const auto pDefineList = new AssetList();
pDefineList->setMinimumWidth(150);
this->addDockWidget(Qt::LeftDockWidgetArea, pDefineList);
pDefineList->setMinimumHeight(0);
pDefineList->setWindowTitle("Define");
const auto pDeclareList = new AssetList();
pDeclareList->setMinimumWidth(150);
this->addDockWidget(Qt::LeftDockWidgetArea, pDeclareList);
pDeclareList->setMinimumHeight(0);
pDeclareList->setWindowTitle("Declare");
QMainWindow::tabifyDockWidget(pDefineList, pDeclareList);
connect( ui->actionToggleDark, &QAction::triggered, [=](bool checked){
if( checked ) {
EnableThemeDark();
} else {
EnableThemeLight();
}
});
}
void MainWindow::EnableThemeDark()
{
@ -120,3 +83,104 @@ MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::SetupDefineList()
{
}
void MainWindow::SetupDeclareList()
{
}
void MainWindow::LoadDefines( const QJsonDocument& document )
{
const QJsonValue& value = document.object()["defines"];
if( value.isArray()) {
} else {
}
}
void MainWindow::LoadDeclarations( const QJsonDocument& document )
{
const QJsonValue& value = document.object()["declarations"];
if( value.isArray()) {
} else {
}
}
void MainWindow::LoadConfigFile( const QString& configPath )
{
// If no initial config should run through a setup process.
// configPath should be stored in a project location, so shouldn't be created into a user specific directory.
QFileInfo fileInfo( configPath );
QFile file( configPath );
if( /*file.exists()*/ fileInfo.exists() && fileInfo.isFile() ) {
file.open(QFile::ReadOnly);
QJsonDocument document(QJsonDocument::fromJson(file.readAll()));
//QJsonObject object = document.object();
LoadDefines( document );
LoadDeclarations( document );
} else {
}
}
void MainWindow::SaveConfigFile( const QJsonDocument& jsonDocument, const QString& configPath )
{
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
/*connect( comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
ui->stackedWidget_2->setCurrentIndex(index);
});
const int currentIndex = 0;
comboBox->setCurrentIndex(currentIndex);
ui->stackedWidget_2->setCurrentIndex(currentIndex);*/
/*const auto pOutputDock = new OutputDock();
pOutputDock->setMinimumHeight(50);
this->addDockWidget(Qt::BottomDockWidgetArea, pOutputDock->GetDock());
pOutputDock->setMinimumHeight(0);*/
//const QDir& dir = QDir::current();
const QString& path = QCoreApplication::applicationDirPath();
if( path.length() ) {
}
LoadConfigFile("bin/projectName.json");
const auto pDefineList = new AssetList();
pDefineList->setMinimumWidth(150);
this->addDockWidget(Qt::LeftDockWidgetArea, pDefineList);
pDefineList->setMinimumHeight(0);
pDefineList->setWindowTitle("Define");
const auto pDeclareList = new AssetList();
pDeclareList->setMinimumWidth(150);
this->addDockWidget(Qt::LeftDockWidgetArea, pDeclareList);
pDeclareList->setMinimumHeight(0);
pDeclareList->setWindowTitle("Declare");
QMainWindow::tabifyDockWidget(pDefineList, pDeclareList);
connect( ui->actionToggleDark, &QAction::triggered, [=](bool checked){
if( checked ) {
EnableThemeDark();
} else {
EnableThemeLight();
}
});
}

View File

@ -20,6 +20,15 @@ public:
private:
Ui::MainWindow *ui;
void SetupDefineList();
void SetupDeclareList();
void LoadDefines( const QJsonDocument& jsonDocument );
void LoadDeclarations( const QJsonDocument& jsonDocument );
void LoadConfigFile( const QString& configPath );
void SaveConfigFile( const QJsonDocument& jsonDocument, const QString& configPath );
};
#endif // MAINWINDOW_H