tycho: add license window

master
an 2019-06-14 13:03:32 -04:00
parent 3086ff687d
commit 8ff9d466e1
5 changed files with 167 additions and 17 deletions

View File

@ -33,10 +33,12 @@ add_library(
cc_source/projectview.cc cc_source/projectview.cc
resources/resources.qrc resources/resources.qrc
ui/about.ui ui/about.ui
ui/license.ui
ui/mapprops.ui ui/mapprops.ui
ui/mapview.ui ui/mapview.ui
ui/menu.ui ui/menu.ui
ui/points.ui ui/points.ui
ui/projectview.ui
) )
set_target_properties( set_target_properties(

View File

@ -28,6 +28,7 @@ public slots:
protected: protected:
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;
void openLicense(QWidget *parent);
private: private:
ProjectView *activeProject() const; ProjectView *activeProject() const;

View File

@ -4,6 +4,7 @@
#include "project.h" #include "project.h"
#include "../ui/ui_menu.h" #include "../ui/ui_menu.h"
#include "../ui/ui_about.h" #include "../ui/ui_about.h"
#include "../ui/ui_license.h"
#include <QCloseEvent> #include <QCloseEvent>
#include <QFileDialog> #include <QFileDialog>
@ -56,11 +57,33 @@ void Menu::mapOpen()
void Menu::openAbout() void Menu::openAbout()
{ {
QDialog dlg{this}; QDialog dlg{this};
Ui::About about{}; Ui::About ui{};
about.setupUi(&dlg); ui.setupUi(&dlg);
about.labelVer->setText(tr(tychoVersion()));
about.labelAuthors->setText(tr(tychoAuthors()).replace(':', '\n')); ui.labelVer->setText(tr(tychoVersion()));
ui.labelAuthors->setText(tr(tychoAuthors()).replace(':', '\n'));
connect(ui.btnLicense, &QPushButton::clicked, this, [&](){
openLicense(&dlg);
});
dlg.exec();
}
void Menu::openLicense(QWidget *parent)
{
QDialog dlg{parent};
Ui::License ui{};
ui.setupUi(&dlg);
ui.text->setPlainText(tychoLicenseText());
connect(ui.btnCopy, &QPushButton::clicked, this, [&]() {
ui.text->selectAll();
ui.text->copy();
});
dlg.exec(); dlg.exec();
} }

View File

@ -9,13 +9,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>669</width> <width>675</width>
<height>281</height> <height>287</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>About Tycho</string> <string>About Tycho</string>
</property> </property>
<property name="windowIcon">
<iconset theme="dialog-information"/>
</property>
<property name="modal"> <property name="modal">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -66,11 +69,41 @@ Tycho is public domain software under the CC0 license.</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="standardButtons"> <item>
<set>QDialogButtonBox::Close</set> <spacer name="horizontalSpacer">
</property> <property name="orientation">
</widget> <enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnLicense">
<property name="text">
<string>License Info</string>
</property>
<property name="icon">
<iconset theme="help-about"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnClose">
<property name="text">
<string>Close</string>
</property>
<property name="icon">
<iconset theme="window-close"/>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@ -81,18 +114,18 @@ Tycho is public domain software under the CC0 license.</string>
</resources> </resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>btnClose</sender>
<signal>rejected()</signal> <signal>clicked()</signal>
<receiver>About</receiver> <receiver>About</receiver>
<slot>reject()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>479</x> <x>622</x>
<y>256</y> <y>256</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>334</x> <x>337</x>
<y>140</y> <y>143</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>License</class>
<widget class="QDialog" name="License">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPlainTextEdit" name="text">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="backgroundVisible">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnClose">
<property name="text">
<string>Close</string>
</property>
<property name="icon">
<iconset theme="window-close"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>btnClose</sender>
<signal>clicked()</signal>
<receiver>License</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>548</x>
<y>374</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>199</y>
</hint>
</hints>
</connection>
</connections>
</ui>