tycho: reorganize sources and fix some jank
|
@ -16,25 +16,6 @@ set(CMAKE_CXX_FLAGS_DEBUGOPT "-O2 -g")
|
|||
find_package(Threads REQUIRED)
|
||||
find_package(Qt5Widgets CONFIG REQUIRED)
|
||||
|
||||
add_executable(
|
||||
maraiah-tycho
|
||||
WIN32
|
||||
source/tycho-qt/resources.qrc
|
||||
|
||||
source/tycho-qt/viewmap.ui
|
||||
source/tycho-qt/winabout.ui
|
||||
source/tycho-qt/winmapprops.ui
|
||||
source/tycho-qt/winmenu.ui
|
||||
|
||||
source/tycho-qt/tycho.h
|
||||
source/tycho-qt/winmapprops.h
|
||||
source/tycho-qt/winmenu.h
|
||||
|
||||
source/tycho-qt/winmapprops.cc
|
||||
source/tycho-qt/winmenu.cc
|
||||
source/tycho-qt/main.cc
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
maraiah-tycho-lib ALL
|
||||
BYPRODUCTS "${RS_LIB}"
|
||||
|
@ -43,6 +24,23 @@ add_custom_target(
|
|||
COMMENT "Building Rust library"
|
||||
)
|
||||
|
||||
add_executable(
|
||||
maraiah-tycho
|
||||
WIN32
|
||||
source/tycho-qt/headers/mapprops.h
|
||||
source/tycho-qt/headers/menu.h
|
||||
source/tycho-qt/headers/tycho.h
|
||||
source/tycho-qt/resources/resources.qrc
|
||||
source/tycho-qt/source/main.cc
|
||||
source/tycho-qt/source/mapprops.cc
|
||||
source/tycho-qt/source/menu.cc
|
||||
source/tycho-qt/ui/about.ui
|
||||
source/tycho-qt/ui/mapprops.ui
|
||||
source/tycho-qt/ui/mapview.ui
|
||||
source/tycho-qt/ui/menu.ui
|
||||
source/tycho-qt/ui/points.ui
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
maraiah-tycho
|
||||
PROPERTIES
|
||||
|
@ -50,6 +48,8 @@ set_target_properties(
|
|||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
target_include_directories(maraiah-tycho PUBLIC source/tycho-qt/headers)
|
||||
|
||||
target_link_libraries(
|
||||
maraiah-tycho
|
||||
"${RS_LIB}"
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MapProps;
|
||||
}
|
||||
|
||||
class MapProps : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MapProps(QWidget *parent = nullptr);
|
||||
~MapProps();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::MapProps> ui;
|
||||
};
|
||||
|
||||
// EOF
|
|
@ -1,22 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include "winmapprops.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class WinMenu;
|
||||
class Menu;
|
||||
}
|
||||
|
||||
class WinMenu : public QMainWindow
|
||||
class Menu : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WinMenu(QWidget *parent = nullptr);
|
||||
~WinMenu();
|
||||
explicit Menu(QWidget *parent = nullptr);
|
||||
~Menu();
|
||||
|
||||
public slots:
|
||||
void mapNew();
|
||||
|
@ -25,8 +23,7 @@ public slots:
|
|||
void openMapProperties();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::WinMenu> ui;
|
||||
WinMapProps *props;
|
||||
std::unique_ptr<Ui::Menu> ui;
|
||||
};
|
||||
|
||||
// EOF
|
|
@ -1,14 +0,0 @@
|
|||
<RCC>
|
||||
<qresource>
|
||||
<file>data/color/lines.png</file>
|
||||
<file>data/color/map.png</file>
|
||||
<file>data/color/points.png</file>
|
||||
<file>data/color/polygons.png</file>
|
||||
<file>data/hc/lines.png</file>
|
||||
<file>data/hc/map.png</file>
|
||||
<file>data/hc/points.png</file>
|
||||
<file>data/hc/polygons.png</file>
|
||||
<file>data/misc/tycho1.png</file>
|
||||
<file>data/misc/tycho2.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 805 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 761 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 972 B After Width: | Height: | Size: 972 B |
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
@ -0,0 +1,14 @@
|
|||
<RCC>
|
||||
<qresource>
|
||||
<file>color/lines.png</file>
|
||||
<file>color/map.png</file>
|
||||
<file>color/points.png</file>
|
||||
<file>color/polygons.png</file>
|
||||
<file>hc/lines.png</file>
|
||||
<file>hc/map.png</file>
|
||||
<file>hc/points.png</file>
|
||||
<file>hc/polygons.png</file>
|
||||
<file>misc/tycho1.png</file>
|
||||
<file>misc/tycho2.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,11 +1,11 @@
|
|||
#include "winmenu.h"
|
||||
#include "menu.h"
|
||||
#include <QApplication>
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
WinMenu w;
|
||||
Menu w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#include "tycho.h"
|
||||
#include "mapprops.h"
|
||||
#include "../ui/ui_mapprops.h"
|
||||
|
||||
MapProps::MapProps(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MapProps)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MapProps::~MapProps()
|
||||
{
|
||||
dbgPrintFunc();
|
||||
}
|
||||
|
||||
// EOF
|
|
@ -1,32 +1,32 @@
|
|||
#include "tycho.h"
|
||||
#include "winmenu.h"
|
||||
#include "ui_winmenu.h"
|
||||
#include "ui_winabout.h"
|
||||
#include "mapprops.h"
|
||||
#include "menu.h"
|
||||
#include "../ui/ui_menu.h"
|
||||
#include "../ui/ui_about.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <iostream>
|
||||
|
||||
extern "C" void test_fn(char const *fname);
|
||||
|
||||
WinMenu::WinMenu(QWidget *parent) :
|
||||
Menu::Menu(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::WinMenu),
|
||||
props(new WinMapProps(this))
|
||||
ui(new Ui::Menu)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
WinMenu::~WinMenu()
|
||||
Menu::~Menu()
|
||||
{
|
||||
dbgPrintFunc();
|
||||
}
|
||||
|
||||
void WinMenu::mapNew()
|
||||
void Menu::mapNew()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void WinMenu::mapOpen()
|
||||
void Menu::mapOpen()
|
||||
{
|
||||
auto fname =
|
||||
QFileDialog::getOpenFileName(
|
||||
|
@ -38,19 +38,21 @@ void WinMenu::mapOpen()
|
|||
test_fn(qUtf8Printable(fname));
|
||||
}
|
||||
|
||||
void WinMenu::openAbout()
|
||||
void Menu::openAbout()
|
||||
{
|
||||
QDialog dlg{this};
|
||||
Ui::WinAbout about{};
|
||||
QDialog dlg{this};
|
||||
Ui::About about{};
|
||||
|
||||
about.setupUi(&dlg);
|
||||
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void WinMenu::openMapProperties()
|
||||
void Menu::openMapProperties()
|
||||
{
|
||||
props->show();
|
||||
MapProps props{this};
|
||||
|
||||
props.exec();
|
||||
}
|
||||
|
||||
// EOF
|
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WinAbout</class>
|
||||
<widget class="QDialog" name="WinAbout">
|
||||
<class>About</class>
|
||||
<widget class="QDialog" name="About">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
@ -13,11 +16,14 @@
|
|||
<property name="windowTitle">
|
||||
<string>About Tycho</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><img src="qrc:///data/misc/tycho2.png"/></string>
|
||||
<string><img src="qrc:///misc/tycho2.png"/></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -71,14 +77,14 @@ Tycho is public domain software under the CC0 license.</string>
|
|||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
<include location="../resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>WinAbout</receiver>
|
||||
<slot>close()</slot>
|
||||
<receiver>About</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>479</x>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WinMapProps</class>
|
||||
<widget class="QDialog" name="WinMapProps">
|
||||
<class>MapProps</class>
|
||||
<widget class="QDialog" name="MapProps">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
|
@ -16,6 +16,9 @@
|
|||
<property name="windowTitle">
|
||||
<string>Map Properties</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
|
@ -346,38 +349,6 @@
|
|||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>WinMapProps</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>WinMapProps</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkBox_24</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
|
@ -394,5 +365,37 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>MapProps</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>345</x>
|
||||
<y>645</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>287</x>
|
||||
<y>-12</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>MapProps</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>315</x>
|
||||
<y>648</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>324</x>
|
||||
<y>-6</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ViewMap</class>
|
||||
<widget class="QWidget" name="ViewMap">
|
||||
<class>MapView</class>
|
||||
<widget class="QWidget" name="MapView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Map View</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WinMenu</class>
|
||||
<widget class="QMainWindow" name="WinMenu">
|
||||
<class>Menu</class>
|
||||
<widget class="QMainWindow" name="Menu">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
@ -120,7 +120,7 @@
|
|||
<connection>
|
||||
<sender>actionMapProps</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>WinMenu</receiver>
|
||||
<receiver>Menu</receiver>
|
||||
<slot>openMapProperties()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -136,7 +136,7 @@
|
|||
<connection>
|
||||
<sender>actionQuit</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>WinMenu</receiver>
|
||||
<receiver>Menu</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -152,7 +152,7 @@
|
|||
<connection>
|
||||
<sender>actionOpen</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>WinMenu</receiver>
|
||||
<receiver>Menu</receiver>
|
||||
<slot>mapOpen()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -168,7 +168,7 @@
|
|||
<connection>
|
||||
<sender>actionNew</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>WinMenu</receiver>
|
||||
<receiver>Menu</receiver>
|
||||
<slot>mapNew()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -184,7 +184,7 @@
|
|||
<connection>
|
||||
<sender>actionAbout</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>WinMenu</receiver>
|
||||
<receiver>Menu</receiver>
|
||||
<slot>openAbout()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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 Editor</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string>The horizontal position. Lower numbers represent positions further to the left.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="toolTip">
|
||||
<string>The vertical position. Lower numbers represent positions further upwards.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Y Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,17 +0,0 @@
|
|||
#include "tycho.h"
|
||||
#include "winmapprops.h"
|
||||
#include "ui_winmapprops.h"
|
||||
|
||||
WinMapProps::WinMapProps(QWidget *parent) :
|
||||
QDialog(parent, Qt::Window),
|
||||
ui(new Ui::WinMapProps)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
WinMapProps::~WinMapProps()
|
||||
{
|
||||
dbgPrintFunc();
|
||||
}
|
||||
|
||||
// EOF
|
|
@ -1,23 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class WinMapProps;
|
||||
}
|
||||
|
||||
class WinMapProps : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WinMapProps(QWidget *parent = nullptr);
|
||||
~WinMapProps();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::WinMapProps> ui;
|
||||
};
|
||||
|
||||
// EOF
|