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