~saiko/mcrestool

741b79b020d916ce9bb17ffe5564cd97fc6ff51b — 2xsaiko 5 months ago d4f6e2f
changes
M src/project/langtblc.cpp => src/project/langtblc.cpp +5 -0
@@ 3,6 3,7 @@
LanguageTableContainer::LanguageTableContainer(ProjectSource* src, QObject* parent) : QObject(parent),
                                                                                      src(src), lt(new LanguageTable(this)) {
    _persistent = false;
    _changed = false;
    _deleted = false;
}



@@ 16,6 17,10 @@ bool LanguageTableContainer::persistent() const {
    return _persistent;
}

bool LanguageTableContainer::changed() const {
    return _changed;
}

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

M src/project/langtblc.h => src/project/langtblc.h +6 -0
@@ 8,6 8,7 @@
#include "projsrc.h"

class LanguageTableContainer : public QObject {
Q_OBJECT

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


@@ 18,6 19,8 @@ public:

    bool persistent() const;

    bool changed() const;

    bool read_only() const;

    void delete_file();


@@ 28,11 31,14 @@ signals:

    void on_deleted();

    void on_changed();

private:
    ProjectSource* src;
    LanguageTable* lt;

    bool _persistent;
    bool _changed;
    bool _deleted;

};

M src/project/projsrc.h => src/project/projsrc.h +2 -0
@@ 18,6 18,8 @@ public:

    bool read_only();

    bool changed();

private:
    QString name;


M src/ui/mainwin.cpp => src/ui/mainwin.cpp +13 -6
@@ 16,11 16,14 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
    connect(ui->action_open, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->action_save, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->action_save_as, SIGNAL(triggered()), this, SLOT(save_as()));
    connect(ui->action_add_res_file, SIGNAL(triggered()), this, SLOT(add_res_file()));
    connect(ui->action_add_res_folder, SIGNAL(triggered()), this, SLOT(add_res_folder()));
    connect(ui->action_about_qt, &QAction::triggered, &QApplication::aboutQt);

    connect(ui->action_resource_tree, SIGNAL(triggered(bool)), this, SLOT(show_resource_tree(bool)));
    connect(ui->res_tree, SIGNAL(visibilityChanged(bool)), this, SLOT(show_resource_tree(bool)));
    connect(ui->action_game_objects, SIGNAL(triggered(bool)), this, SLOT(show_game_objects(bool)));
    connect(ui->game_objects, SIGNAL(visibilityChanged(bool)), this, SLOT(show_game_objects(bool)));
    connect(ui->action_about_qt, &QAction::triggered, &QApplication::aboutQt);

    auto* ltw = new LanguageTableWindow(this);
    ui->mdi_area->addSubWindow(ltw);


@@ 47,10 50,6 @@ void MainWindow::quit() {
}

void MainWindow::open() {
    const QString& string = QFileDialog::getExistingDirectory(this, tr("Open Language File"), QString());
    if (!string.isNull()) {
        std::cout << "Selected " << string.toStdString() << '\n';
    }
}

void MainWindow::save() {


@@ 58,7 57,7 @@ void MainWindow::save() {
}

void MainWindow::save_as() {

    QString filename = QFileDialog::getSaveFileName(this, tr("Save Project"), QString(), "mcrestool Project(*.rtp)");
}

void MainWindow::show_resource_tree(bool shown) {


@@ 79,4 78,12 @@ void MainWindow::show_game_objects(bool shown) {
    }
}

void MainWindow::add_res_file() {
    QStringList sources = QFileDialog::getOpenFileNames(this, tr("Add Resource Pack/Mod"));
}

void MainWindow::add_res_folder() {
    QString source = QFileDialog::getExistingDirectory(this, tr("Add Resource Folder"));
}

MainWindow::~MainWindow() = default;

M src/ui/mainwin.h => src/ui/mainwin.h +4 -0
@@ 30,6 30,10 @@ private slots:

    void save_as();

    void add_res_file();

    void add_res_folder();

    void show_resource_tree(bool shown);

    void show_game_objects(bool shown);

M src/ui/mainwin.ui => src/ui/mainwin.ui +19 -0
@@ 66,6 66,9 @@
    <addaction name="action_save"/>
    <addaction name="action_save_as"/>
    <addaction name="separator"/>
    <addaction name="action_add_res_file"/>
    <addaction name="action_add_res_folder"/>
    <addaction name="separator"/>
    <addaction name="action_quit"/>
   </widget>
   <widget class="QMenu" name="menu_edit">


@@ 250,6 253,22 @@
    <string>Ctrl+M</string>
   </property>
  </action>
  <action name="action_add_res_file">
   <property name="icon">
    <iconset theme="document-import"/>
   </property>
   <property name="text">
    <string>&amp;Add Resource Pack/Mod…</string>
   </property>
  </action>
  <action name="action_add_res_folder">
   <property name="icon">
    <iconset theme="document-import"/>
   </property>
   <property name="text">
    <string>Add Resource &amp;Folder…</string>
   </property>
  </action>
 </widget>
 <resources/>
 <connections/>