~saiko/mcrestool

d4f6e2f2f41b11b8f4db0592d80b3aaa12025e7f — 2xsaiko 5 months ago 59b49b5
Actually, let's not have all this stuff
16 files changed, 104 insertions(+), 58 deletions(-)

M CMakeLists.txt
R src/model/{langtbl.cpp => langtabl.cpp}
R src/model/{langtbl.h => langtabl.h}
D src/project/datapack.cpp
D src/project/datapack.h
A src/project/langtblc.cpp
A src/project/langtblc.h
A src/project/project.h
M src/project/projsrc.cpp
M src/project/projsrc.h
D src/project/resdom.cpp
D src/project/resdom.h
D src/project/respack.cpp
D src/project/respack.h
M src/ui/langtblw.h
M src/ui/mainwin.h
M CMakeLists.txt => CMakeLists.txt +5 -4
@@ 21,7 21,7 @@ find_package(KF5 REQUIRED

set(mcrestool_SRC
        src/main.cpp
        src/model/langtbl.cpp src/model/langtbl.h
        src/model/langtabl.cpp src/model/langtabl.h
        src/table.h
        src/identifr.cpp src/identifr.h
        src/model/restree.cpp src/model/restree.h


@@ 35,13 35,14 @@ set(mcrestool_SRC
        src/fs/langfile.cpp src/fs/langfile.h
        src/result.h
        src/except.h
        src/ui/recpsmel.cpp
        src/ui/recpsmel.h
        src/ui/recpsmel.cpp src/ui/recpsmel.h
        src/model/restritm.cpp src/model/restritm.h
        src/project/projsrc.cpp src/project/projsrc.h
        src/fs/datasrc.cpp src/fs/datasrc.h
        src/fs/dirdtsrc.cpp src/fs/dirdtsrc.h
        src/fs/arcdtsrc.cpp src/fs/arcdtsrc.h src/project/datapack.cpp src/project/datapack.h src/project/respack.cpp src/project/respack.h src/project/resdom.cpp src/project/resdom.h)
        src/fs/arcdtsrc.cpp src/fs/arcdtsrc.h
        src/project/langtblc.cpp src/project/langtblc.h
        src/project/project.h)

add_executable(mcrestool ${mcrestool_SRC})


R src/model/langtbl.cpp => src/model/langtabl.cpp +1 -1
@@ 2,7 2,7 @@
#include <QUrl>
#include <QSet>
#include <QSharedPointer>
#include "langtbl.h"
#include "langtabl.h"

using std::optional;


R src/model/langtbl.h => src/model/langtabl.h +3 -3
@@ 1,5 1,5 @@
#ifndef MCRESTOOL_LANGTBL_H
#define MCRESTOOL_LANGTBL_H
#ifndef MCRESTOOL_LANGTABL_H
#define MCRESTOOL_LANGTABL_H

#include <QObject>
#include <QMap>


@@ 47,4 47,4 @@ private:

};

#endif //MCRESTOOL_LANGTBL_H
#endif //MCRESTOOL_LANGTABL_H

D src/project/datapack.cpp => src/project/datapack.cpp +0 -1
@@ 1,1 0,0 @@
#include "datapack.h"

D src/project/datapack.h => src/project/datapack.h +0 -8
@@ 1,8 0,0 @@
#ifndef MCRESTOOL_DATAPACK_H
#define MCRESTOOL_DATAPACK_H

class DataPack {

};

#endif //MCRESTOOL_DATAPACK_H

A src/project/langtblc.cpp => src/project/langtblc.cpp +34 -0
@@ 0,0 1,34 @@
#include "langtblc.h"

LanguageTableContainer::LanguageTableContainer(ProjectSource* src, QObject* parent) : QObject(parent),
                                                                                      src(src), lt(new LanguageTable(this)) {
    _persistent = false;
    _deleted = false;
}

LanguageTableContainer::~LanguageTableContainer() = default;

LanguageTable* LanguageTableContainer::language_table() {
    return lt;
}

bool LanguageTableContainer::persistent() const {
    return _persistent;
}

bool LanguageTableContainer::read_only() const {
    return src->read_only();
}

void LanguageTableContainer::delete_file() {
    if (read_only()) return;

    // TODO
    _deleted = true;
}

void LanguageTableContainer::save() {
    if (read_only()) return;


}

A src/project/langtblc.h => src/project/langtblc.h +40 -0
@@ 0,0 1,40 @@
#ifndef MCRESTOOL_LANGTBLC_H
#define MCRESTOOL_LANGTBLC_H

#include "project.h"

#include <QObject>
#include "src/model/langtabl.h"
#include "projsrc.h"

class LanguageTableContainer : public QObject {

public:
    explicit LanguageTableContainer(ProjectSource* src, QObject* parent = nullptr);

    ~LanguageTableContainer() override;

    LanguageTable* language_table();

    bool persistent() const;

    bool read_only() const;

    void delete_file();

    void save();

signals:

    void on_deleted();

private:
    ProjectSource* src;
    LanguageTable* lt;

    bool _persistent;
    bool _deleted;

};

#endif //MCRESTOOL_LANGTBLC_H

A src/project/project.h => src/project/project.h +9 -0
@@ 0,0 1,9 @@
#ifndef MCRESTOOL_PROJECT_H
#define MCRESTOOL_PROJECT_H

// these two store pointers to each other so we define them beforehand
class LanguageTableContainer;

class ProjectSource;

#endif //MCRESTOOL_PROJECT_H

M src/project/projsrc.cpp => src/project/projsrc.cpp +2 -2
@@ 1,9 1,9 @@
#include "projsrc.h"

ProjectSource::ProjectSource(DataSource* src, const QString& name, QObject* parent) {
ProjectSource::ProjectSource(DataSource& src, const QString& name, QObject* parent) : QObject(parent), name(name), src(src) {

}

bool ProjectSource::read_only() {
    return src->read_only();
    return src.read_only();
}

M src/project/projsrc.h => src/project/projsrc.h +8 -7
@@ 1,28 1,29 @@
#ifndef MCRESTOOL_PROJSRC_H
#define MCRESTOOL_PROJSRC_H

#include "project.h"

#include "src/fs/datasrc.h"
#include "datapack.h"
#include "respack.h"
#include "langtblc.h"
#include <QObject>
#include <QMap>

// use QFileSystemWatcher?

class ProjectSource : public QObject {
Q_OBJECT

public:
    explicit ProjectSource(DataSource* src, const QString& name, QObject* parent = nullptr);

    explicit ProjectSource(DataSource& src, const QString& name, QObject* parent = nullptr);

    bool read_only();

private:
    QString name;

    QMap<QString, DataPack> data_packs;
    QMap<QString, ResourcePack> resource_packs;
    DataSource& src;

    DataSource* src;
    QMap<QString, LanguageTableContainer*> languages;

};


D src/project/resdom.cpp => src/project/resdom.cpp +0 -1
@@ 1,1 0,0 @@
#include "resdom.h"

D src/project/resdom.h => src/project/resdom.h +0 -20
@@ 1,20 0,0 @@
#ifndef MCRESTOOL_RESDOM_H
#define MCRESTOOL_RESDOM_H

#include <optional>
#include <QString>
#include "datapack.h"
#include "respack.h"

using std::optional;

class ResourceDomain {

private:
    QString domain;
    optional<DataPack> data;
    optional<ResourcePack> resources;

};

#endif //MCRESTOOL_RESDOM_H

D src/project/respack.cpp => src/project/respack.cpp +0 -1
@@ 1,1 0,0 @@
#include "respack.h"

D src/project/respack.h => src/project/respack.h +0 -8
@@ 1,8 0,0 @@
#ifndef MCRESTOOL_RESPACK_H
#define MCRESTOOL_RESPACK_H

class ResourcePack {

};

#endif //MCRESTOOL_RESPACK_H

M src/ui/langtblw.h => src/ui/langtblw.h +1 -1
@@ 3,7 3,7 @@

#include <QScopedPointer>
#include <QWidget>
#include "src/model/langtbl.h"
#include "src/model/langtabl.h"

namespace Ui {
    class LanguageTableWindow;

M src/ui/mainwin.h => src/ui/mainwin.h +1 -1
@@ 4,7 4,7 @@
#include <QMainWindow>
#include <QScopedPointer>
#include "src/model/restree.h"
#include "src/model/langtbl.h"
#include "src/model/langtabl.h"

namespace Ui {
    class MainWindow;