tycho: add project test things
parent
24ad25257b
commit
629d0a70db
|
@ -8,6 +8,16 @@
|
||||||
"objects": {
|
"objects": {
|
||||||
"Project": {
|
"Project": {
|
||||||
"type": "Object",
|
"type": "Object",
|
||||||
|
"functions": {
|
||||||
|
"open": {
|
||||||
|
"return": "void",
|
||||||
|
"mut": true,
|
||||||
|
"arguments": [{
|
||||||
|
"name": "fname",
|
||||||
|
"type": "QString"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
},
|
},
|
||||||
"itemProperties": {
|
"itemProperties": {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -17,7 +16,7 @@ public:
|
||||||
~MapProps();
|
~MapProps();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::MapProps> ui;
|
QSharedPointer<Ui::MapProps> ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <memory>
|
#include <vector>
|
||||||
|
|
||||||
|
class Project;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -23,7 +25,8 @@ public slots:
|
||||||
void openMapProperties();
|
void openMapProperties();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::Menu> ui;
|
QSharedPointer<Ui::Menu> ui;
|
||||||
|
std::vector<QSharedPointer<Project>> projects;
|
||||||
};
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
@ -7,6 +7,7 @@ MapProps::MapProps(QWidget *parent) :
|
||||||
ui(new Ui::MapProps)
|
ui(new Ui::MapProps)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
dbgPrintFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
MapProps::~MapProps()
|
MapProps::~MapProps()
|
||||||
|
|
|
@ -8,13 +8,12 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
extern "C" void Ma_test_fn(char const *fname);
|
|
||||||
|
|
||||||
Menu::Menu(QWidget *parent) :
|
Menu::Menu(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::Menu)
|
ui(new Ui::Menu)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
dbgPrintFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu::~Menu()
|
Menu::~Menu()
|
||||||
|
@ -24,7 +23,7 @@ Menu::~Menu()
|
||||||
|
|
||||||
void Menu::mapNew()
|
void Menu::mapNew()
|
||||||
{
|
{
|
||||||
Project obj{this};
|
auto proj = projects.emplace_back(new Project);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::mapOpen()
|
void Menu::mapOpen()
|
||||||
|
@ -36,7 +35,8 @@ void Menu::mapOpen()
|
||||||
QString(),
|
QString(),
|
||||||
tr("Marathon Map files (*.scen *.sceA Map)"));
|
tr("Marathon Map files (*.scen *.sceA Map)"));
|
||||||
|
|
||||||
Ma_test_fn(qUtf8Printable(fname));
|
auto proj = projects.emplace_back(new Project);
|
||||||
|
proj->open(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::openAbout()
|
void Menu::openAbout()
|
||||||
|
|
|
@ -7,13 +7,6 @@ extern "C" {
|
||||||
fn main_cc(app_name: *mut ffi::c_char);
|
fn main_cc(app_name: *mut ffi::c_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
unsafe extern "C" fn Ma_test_fn(fname: *const ffi::c_char)
|
|
||||||
{
|
|
||||||
let fname = ffi::CStr::from_ptr(fname);
|
|
||||||
println!("hello, world! from rust: {}", fname.to_str().unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() -> ResultS<()>
|
fn main() -> ResultS<()>
|
||||||
{
|
{
|
||||||
println!("rust entry");
|
println!("rust entry");
|
||||||
|
|
|
@ -9,7 +9,7 @@ impl Drop for Project
|
||||||
{
|
{
|
||||||
fn drop(&mut self)
|
fn drop(&mut self)
|
||||||
{
|
{
|
||||||
println!("drop Project");
|
eprintln!("drop Project");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ impl ProjectTrait for Project
|
||||||
{
|
{
|
||||||
fn new(emit: ProjectEmitter) -> Project
|
fn new(emit: ProjectEmitter) -> Project
|
||||||
{
|
{
|
||||||
println!("new Project");
|
eprintln!("new Project");
|
||||||
Project{emit}
|
Project{emit}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,11 @@ impl ProjectTrait for Project
|
||||||
{
|
{
|
||||||
&mut self.emit
|
&mut self.emit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn open(&mut self, fname: String)
|
||||||
|
{
|
||||||
|
println!("opening project: {}", fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
Loading…
Reference in New Issue