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
resources/resources.qrc
ui/about.ui
ui/license.ui
ui/mapprops.ui
ui/mapview.ui
ui/menu.ui
ui/points.ui
ui/projectview.ui
)
set_target_properties(

View File

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

View File

@ -4,6 +4,7 @@
#include "project.h"
#include "../ui/ui_menu.h"
#include "../ui/ui_about.h"
#include "../ui/ui_license.h"
#include <QCloseEvent>
#include <QFileDialog>
@ -56,11 +57,33 @@ void Menu::mapOpen()
void Menu::openAbout()
{
QDialog dlg{this};
Ui::About about{};
Ui::About ui{};
about.setupUi(&dlg);
about.labelVer->setText(tr(tychoVersion()));
about.labelAuthors->setText(tr(tychoAuthors()).replace(':', '\n'));
ui.setupUi(&dlg);
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();
}

View File

@ -9,13 +9,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>669</width>
<height>281</height>
<width>675</width>
<height>287</height>
</rect>
</property>
<property name="windowTitle">
<string>About Tycho</string>
</property>
<property name="windowIcon">
<iconset theme="dialog-information"/>
</property>
<property name="modal">
<bool>true</bool>
</property>
@ -66,11 +69,41 @@ Tycho is public domain software under the CC0 license.</string>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<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="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>
</layout>
</item>
@ -81,18 +114,18 @@ Tycho is public domain software under the CC0 license.</string>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<sender>btnClose</sender>
<signal>clicked()</signal>
<receiver>About</receiver>
<slot>reject()</slot>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>479</x>
<x>622</x>
<y>256</y>
</hint>
<hint type="destinationlabel">
<x>334</x>
<y>140</y>
<x>337</x>
<y>143</y>
</hint>
</hints>
</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>