tycho: reorganize sources and fix some jank

master
an 2019-06-08 22:14:38 -04:00
parent 022ef81f38
commit 2d5e990cf0
29 changed files with 202 additions and 147 deletions

View File

@ -16,25 +16,6 @@ set(CMAKE_CXX_FLAGS_DEBUGOPT "-O2 -g")
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(Qt5Widgets CONFIG 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( add_custom_target(
maraiah-tycho-lib ALL maraiah-tycho-lib ALL
BYPRODUCTS "${RS_LIB}" BYPRODUCTS "${RS_LIB}"
@ -43,6 +24,23 @@ add_custom_target(
COMMENT "Building Rust library" 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( set_target_properties(
maraiah-tycho maraiah-tycho
PROPERTIES PROPERTIES
@ -50,6 +48,8 @@ set_target_properties(
CXX_STANDARD_REQUIRED ON CXX_STANDARD_REQUIRED ON
) )
target_include_directories(maraiah-tycho PUBLIC source/tycho-qt/headers)
target_link_libraries( target_link_libraries(
maraiah-tycho maraiah-tycho
"${RS_LIB}" "${RS_LIB}"

View File

@ -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

View File

@ -1,22 +1,20 @@
#pragma once #pragma once
#include "winmapprops.h"
#include <QMainWindow> #include <QMainWindow>
#include <memory> #include <memory>
namespace Ui namespace Ui
{ {
class WinMenu; class Menu;
} }
class WinMenu : public QMainWindow class Menu : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit WinMenu(QWidget *parent = nullptr); explicit Menu(QWidget *parent = nullptr);
~WinMenu(); ~Menu();
public slots: public slots:
void mapNew(); void mapNew();
@ -25,8 +23,7 @@ public slots:
void openMapProperties(); void openMapProperties();
private: private:
std::unique_ptr<Ui::WinMenu> ui; std::unique_ptr<Ui::Menu> ui;
WinMapProps *props;
}; };
// EOF // EOF

View File

@ -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>

View File

Before

Width:  |  Height:  |  Size: 805 B

After

Width:  |  Height:  |  Size: 805 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 343 B

After

Width:  |  Height:  |  Size: 343 B

View File

Before

Width:  |  Height:  |  Size: 972 B

After

Width:  |  Height:  |  Size: 972 B

View File

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -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>

View File

@ -1,11 +1,11 @@
#include "winmenu.h" #include "menu.h"
#include <QApplication> #include <QApplication>
#include <cstdio> #include <cstdio>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
WinMenu w; Menu w;
w.show(); w.show();
return a.exec(); return a.exec();
} }

View File

@ -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

View File

@ -1,32 +1,32 @@
#include "tycho.h" #include "tycho.h"
#include "winmenu.h" #include "mapprops.h"
#include "ui_winmenu.h" #include "menu.h"
#include "ui_winabout.h" #include "../ui/ui_menu.h"
#include "../ui/ui_about.h"
#include <QFileDialog> #include <QFileDialog>
#include <iostream> #include <iostream>
extern "C" void test_fn(char const *fname); extern "C" void test_fn(char const *fname);
WinMenu::WinMenu(QWidget *parent) : Menu::Menu(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::WinMenu), ui(new Ui::Menu)
props(new WinMapProps(this))
{ {
ui->setupUi(this); ui->setupUi(this);
} }
WinMenu::~WinMenu() Menu::~Menu()
{ {
dbgPrintFunc(); dbgPrintFunc();
} }
void WinMenu::mapNew() void Menu::mapNew()
{ {
// TODO // TODO
} }
void WinMenu::mapOpen() void Menu::mapOpen()
{ {
auto fname = auto fname =
QFileDialog::getOpenFileName( QFileDialog::getOpenFileName(
@ -38,19 +38,21 @@ void WinMenu::mapOpen()
test_fn(qUtf8Printable(fname)); test_fn(qUtf8Printable(fname));
} }
void WinMenu::openAbout() void Menu::openAbout()
{ {
QDialog dlg{this}; QDialog dlg{this};
Ui::WinAbout about{}; Ui::About about{};
about.setupUi(&dlg); about.setupUi(&dlg);
dlg.exec(); dlg.exec();
} }
void WinMenu::openMapProperties() void Menu::openMapProperties()
{ {
props->show(); MapProps props{this};
props.exec();
} }
// EOF // EOF

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>WinAbout</class> <class>About</class>
<widget class="QDialog" name="WinAbout"> <widget class="QDialog" name="About">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -13,11 +16,14 @@
<property name="windowTitle"> <property name="windowTitle">
<string>About Tycho</string> <string>About Tycho</string>
</property> </property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&lt;img src=&quot;qrc:///data/misc/tycho2.png&quot;/&gt;</string> <string>&lt;img src=&quot;qrc:///misc/tycho2.png&quot;/&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -71,14 +77,14 @@ Tycho is public domain software under the CC0 license.</string>
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="resources.qrc"/> <include location="../resources/resources.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>WinAbout</receiver> <receiver>About</receiver>
<slot>close()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>479</x> <x>479</x>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>WinMapProps</class> <class>MapProps</class>
<widget class="QDialog" name="WinMapProps"> <widget class="QDialog" name="MapProps">
<property name="windowModality"> <property name="windowModality">
<enum>Qt::WindowModal</enum> <enum>Qt::WindowModal</enum>
</property> </property>
@ -16,6 +16,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Map Properties</string> <string>Map Properties</string>
</property> </property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox_5"> <widget class="QGroupBox" name="groupBox_5">
@ -346,38 +349,6 @@
</widget> </widget>
<resources/> <resources/>
<connections> <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> <connection>
<sender>checkBox_24</sender> <sender>checkBox_24</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
@ -394,5 +365,37 @@
</hint> </hint>
</hints> </hints>
</connection> </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> </connections>
</ui> </ui>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ViewMap</class> <class>MapView</class>
<widget class="QWidget" name="ViewMap"> <widget class="QWidget" name="MapView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Map View</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>WinMenu</class> <class>Menu</class>
<widget class="QMainWindow" name="WinMenu"> <widget class="QMainWindow" name="Menu">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -120,7 +120,7 @@
<connection> <connection>
<sender>actionMapProps</sender> <sender>actionMapProps</sender>
<signal>triggered()</signal> <signal>triggered()</signal>
<receiver>WinMenu</receiver> <receiver>Menu</receiver>
<slot>openMapProperties()</slot> <slot>openMapProperties()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -136,7 +136,7 @@
<connection> <connection>
<sender>actionQuit</sender> <sender>actionQuit</sender>
<signal>triggered()</signal> <signal>triggered()</signal>
<receiver>WinMenu</receiver> <receiver>Menu</receiver>
<slot>close()</slot> <slot>close()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -152,7 +152,7 @@
<connection> <connection>
<sender>actionOpen</sender> <sender>actionOpen</sender>
<signal>triggered()</signal> <signal>triggered()</signal>
<receiver>WinMenu</receiver> <receiver>Menu</receiver>
<slot>mapOpen()</slot> <slot>mapOpen()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -168,7 +168,7 @@
<connection> <connection>
<sender>actionNew</sender> <sender>actionNew</sender>
<signal>triggered()</signal> <signal>triggered()</signal>
<receiver>WinMenu</receiver> <receiver>Menu</receiver>
<slot>mapNew()</slot> <slot>mapNew()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -184,7 +184,7 @@
<connection> <connection>
<sender>actionAbout</sender> <sender>actionAbout</sender>
<signal>triggered()</signal> <signal>triggered()</signal>
<receiver>WinMenu</receiver> <receiver>Menu</receiver>
<slot>openAbout()</slot> <slot>openAbout()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

View File

@ -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>

View File

@ -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

View File

@ -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