Browse Source

Reconfigure project structure

basic-view
Ali Hatami Tajik 6 months ago
parent
commit
2316c2ead6
  1. 3
      LoggerShark.pro
  2. 5
      gui/gui.pro
  3. 13
      gui/main.cpp
  4. 6
      gui/view/MainWindow.cpp
  5. 5
      model/include/LogWarehouse.h
  6. 2
      model/include/parser/IParser.h
  7. 2
      model/include/parser/JsonParser.h
  8. 6
      model/include/type/Log.h
  9. 2
      model/include/type/MessagePart.h
  10. 4
      model/model.pro
  11. 2
      model/src/LogWarehouse.cpp
  12. 2
      model/src/parser/JsonParser.cpp
  13. 4
      test/main.cpp
  14. 4
      test/test.pro

3
LoggerShark.pro

@ -1,2 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = model gui test
test.depends += model
gui.depends += model

5
gui/gui.pro

@ -2,7 +2,7 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
CONFIG += c++17
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
@ -25,6 +25,9 @@ HEADERS += \
FORMS += \
view/MainWindow.ui
LIBS += -L$$OUT_PWD/../model/ -lmodel
PRE_TARGETDEPS += $$OUT_PWD/../model/libmodel.a
INCLUDEPATH += $$PWD/../model/include
RESOURCES += \

13
gui/main.cpp

@ -1,11 +1,24 @@
#include "view/MainWindow.h"
#include <QApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QFile>
#include <QVector>
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
MainWindow w;
QString jsonString =
R"(
[{"id":"stderr","level":1,"location":{"file":"../../../host-projects/sono/logic/src/viewModel/factory/ApplicationStarter.cpp","func":"init","lineno":69},"msg":["FUCK\n"],"scope":"global","threadId":124330260010752,"timestamp":1716911725703}]
)";
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonString.toUtf8());
QJsonArray jsonArray = jsonDoc.array();
w.show();
return a.exec();

6
gui/view/MainWindow.cpp

@ -1,6 +1,7 @@
#include "MainWindow.h"
#include "ui_MainWindow.h"
/*************************************************************************************************/
MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
@ -19,14 +20,13 @@ MainWindow::~MainWindow()
void MainWindow::setTable(QAbstractTableModel* model)
{
ui->tableView->setModel(model);
ui->tableView->horizontalHeader()->hideSection(2);
ui->tableView->horizontalHeader()->hideSection(3);
}
/*************************************************************************************************/
void MainWindow::prepareTableView()
{
ui->tableView->verticalHeader()->setVisible(false);
ui->tableView->horizontalHeader()->setSectionResizeMode(
QHeaderView::ResizeMode::Interactive);
QHeaderView::ResizeMode::Stretch);
ui->tableView->horizontalHeader()->setSectionsMovable(true);
}

5
model/include/LogWarehouse.h

@ -1,8 +1,9 @@
#ifndef LOGWAREHOUSE
#define LOGWAREHOUSE
#include <memory>
#include <QObject>
#include "include/type/Log.h"
#include "type/Log.h"
class LogWarehouse : public QObject
{
@ -24,4 +25,6 @@ private:
QList<Log_ptr> _data;
};
using LogWarehouse_ptr = std::shared_ptr<LogWarehouse>;
#endif //LOGWAREHOUSE

2
model/include/parser/IParser.h

@ -2,7 +2,7 @@
#define IPARSER
#include <QString>
#include "include/type/Log.h"
#include "type/Log.h"
class IParser
{

2
model/include/parser/JsonParser.h

@ -1,7 +1,7 @@
#ifndef JSONPARSER
#define JSONPARSER
#include "include/parser/IParser.h"
#include "parser/IParser.h"
#include <QJsonValue>
class JsonParser : public IParser

6
model/include/type/Log.h

@ -8,9 +8,9 @@
#include <QString>
#include <QDateTime>
#include "include/type/ELogLevel.h"
#include "include/type/MessagePart.h"
#include "include/type/SourceLocationDto.h"
#include "type/ELogLevel.h"
#include "type/MessagePart.h"
#include "type/SourceLocationDto.h"
struct Log
{

2
model/include/type/MessagePart.h

@ -2,7 +2,7 @@
#define MESSAGEPART
#include <optional>
#include <include/type/LoggedObjectDto.h>
#include <type/LoggedObjectDto.h>
struct MessagePart
{

4
model/model.pro

@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += c++17
CONFIG += staticlib
TARGET = logic
TARGET = model
HEADERS += \
include/LogWarehouse.h \
@ -18,3 +18,5 @@ HEADERS += \
SOURCES += \
src/LogWarehouse.cpp \
src/parser/JsonParser.cpp
INCLUDEPATH += $$PWD/include

2
model/src/LogWarehouse.cpp

@ -1,4 +1,4 @@
#include "include/LogWarehouse.h"
#include "LogWarehouse.h"
/*************************************************************************************************/
Log_ptr LogWarehouse::getItem(int index)

2
model/src/parser/JsonParser.cpp

@ -1,4 +1,4 @@
#include "include/parser/JsonParser.h"
#include "parser/JsonParser.h"
#include <QJsonObject>
#include <QJsonDocument>

4
test/main.cpp

@ -1,5 +1,9 @@
#include <QtTest/QtTest>
#include <QtGlobal>
int main(int argc, char* argv[])
{
Q_UNUSED(argc)
Q_UNUSED(argv)
}

4
test/test.pro

@ -9,3 +9,7 @@ TEMPLATE = app
SOURCES += \
main.cpp
LIBS += -L$$OUT_PWD/../model/ -lmodel
PRE_TARGETDEPS += $$OUT_PWD/../model/libmodel.a
INCLUDEPATH += $$PWD/../model/include

Loading…
Cancel
Save