Compare commits

..

No commits in common. "1ac6b2df9d83408982f310ee95871c49521981cc" and "8889bcf1a460ac20d73fb5bcf0eb8aa0d4176c82" have entirely different histories.

14 changed files with 149 additions and 121 deletions

View File

@ -971,8 +971,8 @@ Static Map Info is 88 bytes.
one ended up being useless and the third was made into a map flag instead
which simply modifies the current physics model. This should always be set to
`1` by new editors.
- `LandscapeId` is a Landscape enumeration. It is the landscape number to use
for the sky. This starts at `0`, since it's an offset into the landscape
- `LandscapeId` is a Landscape enumeration. is the landscape number to use for
the sky. This starts at `0`, since it's an offset into the landscape
collections. If `DataVersion` is `DataM1` or the `Music` flag of `EnvFlags` is
set, then this is used as the music index instead.
- `MissionFlags` is a Mission Flags bit field.

View File

@ -29,6 +29,7 @@ add_library(
cc_source/main.cc
cc_source/mapprops.cc
cc_source/menu.cc
cc_source/projectmodel.cc
cc_source/projectview.cc
resources/resources.qrc
ui/about.ui

View File

@ -6,8 +6,8 @@
"implementationModule": "qimpl"
},
"objects": {
"ProjectModel": {
"type": "List",
"Project": {
"type": "Object",
"functions": {
"open": {
"return": "bool",
@ -16,27 +16,11 @@
"name": "fname",
"type": "QString"
}]
},
"save": {
"return": "void",
"mut": false
},
"isDirty": {
"return": "bool",
"mut": false
}
},
"properties": {
},
"itemProperties": {
"rowName": {
"type": "quint64",
"roles": [["display"]]
},
"someNumber": {
"type": "quint64",
"roles": [[], ["display"]]
}
}
}
}

View File

@ -2,11 +2,14 @@
#include <QDialog>
#include "../ui/ui_mapprops.h"
class ProjectModel;
class MapProps : public QDialog, private Ui::MapProps
namespace Ui
{
class MapProps;
}
class MapProps : public QDialog
{
Q_OBJECT
@ -17,6 +20,7 @@ public:
private:
QSharedPointer<ProjectModel> proj;
QSharedPointer<Ui::MapProps> ui;
};
// EOF

View File

@ -3,11 +3,15 @@
#include <QMainWindow>
#include <vector>
#include "../ui/ui_menu.h"
class ProjectView;
class QMdiSubWindow;
class Menu : public QMainWindow, private Ui::Menu
namespace Ui
{
class Menu;
}
class Menu : public QMainWindow
{
Q_OBJECT
@ -30,6 +34,8 @@ private:
ProjectView *activeProject() const;
QMdiSubWindow *activeSubWindow() const;
void addProject(ProjectView *view);
QSharedPointer<Ui::Menu> ui;
};
// EOF

View File

@ -1,11 +1,33 @@
#pragma once
#include "bindings.h"
#include <QMdiSubWindow>
#include "bindings.h"
#include "../ui/ui_projectview.h"
namespace Ui
{
class ProjectView;
}
class ProjectView : public QMdiSubWindow, private Ui::ProjectView
class ProjectModel : public QObject
{
Q_OBJECT
public:
explicit ProjectModel();
~ProjectModel();
bool isDirty() const;
public slots:
bool open(const QString &fname);
void save();
private:
Project data;
};
class ProjectView : public QMdiSubWindow
{
Q_OBJECT
@ -19,6 +41,7 @@ protected:
void closeEvent(QCloseEvent *event) override;
private:
QSharedPointer<Ui::ProjectView> ui;
QSharedPointer<ProjectModel> proj;
};

View File

@ -1,19 +1,21 @@
#include "tycho.h"
#include "mapprops.h"
#include "../ui/ui_mapprops.h"
#include <QDialogButtonBox>
MapProps::MapProps(QSharedPointer<ProjectModel> _proj, QWidget *parent) :
QDialog(parent),
ui(new Ui::MapProps),
proj(_proj)
{
setupUi(this);
ui->setupUi(this);
setModal(true);
auto bbox = new QDialogButtonBox(this);
bbox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
verticalLayout->addWidget(bbox);
ui->verticalLayout->addWidget(bbox);
connect(bbox, SIGNAL(accepted()), this, SLOT(accept()));
connect(bbox, SIGNAL(rejected()), this, SLOT(reject()));

View File

@ -2,6 +2,7 @@
#include "mapprops.h"
#include "menu.h"
#include "project.h"
#include "../ui/ui_menu.h"
#include "../ui/ui_about.h"
#include "../ui/ui_license.h"
@ -11,16 +12,17 @@
#include <iostream>
Menu::Menu(QWidget *parent) :
QMainWindow(parent)
QMainWindow(parent),
ui(new Ui::Menu)
{
setupUi(this);
ui->setupUi(this);
actionAbout->setShortcut(QKeySequence(QKeySequence::HelpContents));
actionClose->setShortcut(QKeySequence(QKeySequence::Close));
actionMapProps->setShortcut(QKeySequence(tr("Ctrl+P")));
actionNew->setShortcut(QKeySequence(QKeySequence::New));
actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));
ui->actionAbout->setShortcut(QKeySequence(QKeySequence::HelpContents));
ui->actionClose->setShortcut(QKeySequence(QKeySequence::Close));
ui->actionMapProps->setShortcut(QKeySequence(tr("Ctrl+P")));
ui->actionNew->setShortcut(QKeySequence(QKeySequence::New));
ui->actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
ui->actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));
dbgPrintFunc();
}
@ -109,15 +111,15 @@ void Menu::updateActions()
auto view = activeProject();
bool active = view != nullptr;
actionClose->setEnabled(active);
actionMapProps->setEnabled(active);
ui->actionClose->setEnabled(active);
ui->actionMapProps->setEnabled(active);
dbgPrintFunc();
}
void Menu::closeEvent(QCloseEvent *event)
{
for(auto *win : mdiArea->subWindowList()) {
for(auto *win : ui->mdiArea->subWindowList()) {
if(!win->close()) {
event->ignore();
return;
@ -134,13 +136,12 @@ ProjectView *Menu::activeProject() const
QMdiSubWindow *Menu::activeSubWindow() const
{
return mdiArea->activeSubWindow();
return ui->mdiArea->activeSubWindow();
}
void Menu::addProject(ProjectView *view)
{
auto win = mdiArea->addSubWindow(view);
auto win = ui->mdiArea->addSubWindow(view);
win->showMaximized();
}

View File

@ -0,0 +1,29 @@
#include "tycho.h"
#include "project.h"
ProjectModel::ProjectModel() :
data()
{
}
ProjectModel::~ProjectModel()
{
dbgPrintFunc();
}
bool ProjectModel::isDirty() const
{
return false;
}
bool ProjectModel::open(const QString &fname)
{
return data.open(fname);
}
void ProjectModel::save()
{
dbgPrintFunc();
}
// EOF

View File

@ -1,22 +1,22 @@
#include "tycho.h"
#include "project.h"
#include "../ui/ui_projectview.h"
#include <QCloseEvent>
#include <QMessageBox>
ProjectView::ProjectView(QWidget *parent) :
QMdiSubWindow(parent),
ui(new Ui::ProjectView),
proj(new ProjectModel)
{
auto widget = new QWidget(this);
setupUi(widget);
ui->setupUi(widget);
setWidget(widget);
setAttribute(Qt::WA_DeleteOnClose);
listView->setModel(proj.data());
dbgPrintFunc();
}

View File

@ -1,63 +1,47 @@
//! Project management.
use crate::qintr::*;
//use memmap::Mmap;
use std::{cell::RefCell, fs};
use memmap::Mmap;
use maraiah::map;
pub struct ProjectModel
pub struct Project
{
emit: ProjectModelEmitter,
emit: ProjectEmitter,
wad: RefCell<Option<map::Wad>>,
}
impl Drop for ProjectModel
impl Drop for Project
{
fn drop(&mut self)
{
if cfg!(debug_assertions) {
eprintln!("drop ProjectModel");
eprintln!("drop Project");
}
}
}
impl ProjectModelTrait for ProjectModel
impl ProjectTrait for Project
{
fn new(emit: ProjectModelEmitter, _: ProjectModelList) -> ProjectModel
fn new(emit: ProjectEmitter) -> Project
{
if cfg!(debug_assertions) {
eprintln!("new ProjectModel");
eprintln!("new Project");
}
ProjectModel{emit}
Project{emit, wad: RefCell::new(None)}
}
fn emit(&mut self) -> &mut ProjectModelEmitter
fn emit(&mut self) -> &mut ProjectEmitter
{
&mut self.emit
}
fn row_count(&self) -> usize
{
7
}
fn row_name(&self, row: usize) -> u64
{
row as u64 + 1
}
fn some_number(&self, row: usize) -> u64
{
69420
}
fn open(&mut self, path: String) -> bool
{
if cfg!(debug_assertions) {
eprintln!("opening project: {}", &path);
}
/*
let fp = std::fs::File::open(path);
let fp = fs::File::open(path);
let fp = if let Ok(fp) = fp {fp} else {return false;};
let mm = unsafe {Mmap::map(&fp)};
@ -67,22 +51,9 @@ impl ProjectModelTrait for ProjectModel
self.wad.replace(Some(wad));
return true;
}
*/
false
}
fn save(&self)
{
if cfg!(debug_assertions) {
eprintln!("saving project");
}
}
fn is_dirty(&self) -> bool
{
false
}
}
// EOF

View File

@ -37,6 +37,9 @@
<layout class="QFormLayout" name="formLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="toolTip">
<string>The name of the map. This is used in the level selection menu.</string>
</property>
<property name="text">
<string>Map Name</string>
</property>
@ -44,12 +47,6 @@
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="toolTip">
<string>The name of the map. This is used in the level selection menu.</string>
</property>
<property name="whatsThis">
<string>The map name can be up to 65 characters, and a limited set of special characters may be used. The text encoding is actually Macintosh Roman, although in this program it is encoded as Unicode, and will be translated accordingly.</string>
</property>
<property name="maxLength">
<number>65</number>
</property>
@ -57,6 +54,10 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>The texture set to use. This determines every texture that will be used, and all of the liquids.
Because of this, the texture sets are named after the liquids primarily.</string>
</property>
<property name="text">
<string>Texture Set</string>
</property>
@ -70,12 +71,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>This determines the set of textures and liquids that will be used.</string>
</property>
<property name="whatsThis">
<string>This is an offset from the first texture collection in the Shapes file. The kind of liquid the level uses is also determined by this field due to the way the engine is programmed.</string>
</property>
<item>
<property name="text">
<string>Water</string>
@ -105,6 +100,9 @@
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>The sky texture to use.</string>
</property>
<property name="text">
<string>Landscape</string>
</property>
@ -118,12 +116,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The sky texture to use.</string>
</property>
<property name="whatsThis">
<string>This is an offset from the first landscape collection in the Shapes file.</string>
</property>
<item>
<property name="text">
<string>Lh'owon Day</string>
@ -148,6 +140,10 @@
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="toolTip">
<string>The ID of the music to use. This is generally unused since Marathon 2 and Infinity don't have music.
Aleph One allows for adding music to levels, although you will need to check the &quot;Music&quot; flag to use this field.</string>
</property>
<property name="text">
<string>Music No.</string>
</property>
@ -164,12 +160,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The ID of the music to use. This replaces the Landscape field.</string>
</property>
<property name="whatsThis">
<string>This is generally unused since Marathon 2 and Infinity don't have music. Aleph One allows for adding music to levels, although you will need to check the &quot;Music&quot; flag to use this field.</string>
</property>
</widget>
</item>
</layout>
@ -189,7 +179,7 @@
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_3">
<property name="toolTip">
<string>The map can be played in the Carnage game mode.</string>
<string>The map can be played in the Carnage game mode, often known as Deathmatch.</string>
</property>
<property name="text">
<string>Carnage</string>

View File

@ -2,8 +2,16 @@
<ui version="4.0">
<class>Points</class>
<widget class="QWidget" name="Points">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>150</width>
<height>82</height>
</rect>
</property>
<property name="windowTitle">
<string>Point Inspector</string>
<string>Point Editor</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">

View File

@ -15,12 +15,21 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListView" name="listView">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
<widget class="QCheckBox" name="checkBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
<property name="text">
<string>gay</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>