Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::LicenseDialog Class Reference

The LicenseDialog class models the UI for the software license text and notices. More...

#include <licensedialog.h>

Inheritance diagram for geometrize::dialog::LicenseDialog:
Inheritance graph
[legend]
Collaboration diagram for geometrize::dialog::LicenseDialog:
Collaboration graph
[legend]

Public Member Functions

 LicenseDialog (QWidget *parent=nullptr)
 
virtual ~LicenseDialog ()
 

Protected Member Functions

void changeEvent (QEvent *) override
 

Private Member Functions

void populateUi ()
 

Private Attributes

Ui::LicenseDialog * ui
 

Detailed Description

The LicenseDialog class models the UI for the software license text and notices.

Constructor & Destructor Documentation

geometrize::dialog::LicenseDialog::LicenseDialog ( QWidget *  parent = nullptr)
explicit
16  :
17  QDialog(parent),
18  ui(new Ui::LicenseDialog)
19 {
20  setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove question mark from title bar
21  ui->setupUi(this);
22  populateUi();
23 
24  const auto readLicenseFile = [](const QString& resourcePath) -> QString {
25  QFile file{resourcePath};
26  if(!file.exists()) {
27  assert(0 && "Bad license file path");
28  return "";
29  }
30 
31  if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
32  assert(0 && "Failed to open license file for reading");
33  return "";
34  }
35 
36  const QByteArray data{file.readAll()};
37 
38  if(file.error()) {
39  assert(0 && "Failed to read license file");
40  return "";
41  }
42 
43  QString text{QString::fromUtf8(data)};
44  if(text.toUtf8() != data) {
45  assert(0 && "Possible conversion failure reading license file");
46  return "";
47  }
48 
49  return text;
50  };
51 
52  const auto setLicenseText = [&readLicenseFile](QTextBrowser* textBrowser, const char* licenseFilePath) {
53  textBrowser->setText(readLicenseFile(":/licenses/" + QString(licenseFilePath)));
54  };
55 
56 #ifdef MAC_APPSTORE_LICENSE
57  // Special license for Mac appstore builds
58  setLicenseText(ui->geometrizeLicense, "geometrize_mac_appstore_build_license.txt");
59 #else
60  setLicenseText(ui->geometrizeLicense, "geometrize_license.txt");
61 #endif
62 
63  setLicenseText(ui->geometrizeLibraryLicense, "geometrize_library_license.txt");
64  setLicenseText(ui->qtLicense, "qt_license.txt");
65  setLicenseText(ui->chaiScriptLicense, "chaiscript_license.txt");
66  setLicenseText(ui->chaiScriptExtrasLicense, "chaiscript_extras_license.txt");
67  setLicenseText(ui->cerealLicense, "cereal_license.txt");
68  setLicenseText(ui->rapidJSONLicense, "rapidjson_license.txt");
69  setLicenseText(ui->rapidXmlLicense, "rapidxml_license.txt");
70  setLicenseText(ui->burstLinkerLicense, "burstlinker_license.txt");
71  setLicenseText(ui->GIFLIBLicense, "giflib_license.txt");
72  setLicenseText(ui->flowLayoutLicense, "flowlayout_license.txt");
73  setLicenseText(ui->elidedLabelLicense, "elidedlabel_license.txt");
74  setLicenseText(ui->iconAssetsLicense, "fatcow_icon_license.txt");
75  setLicenseText(ui->templateAssetsLicense, "template_assets_license.txt");
76 }
void populateUi()
Definition: licensedialog.cpp:92
Ui::LicenseDialog * ui
Definition: licensedialog.h:35

Here is the call graph for this function:

geometrize::dialog::LicenseDialog::~LicenseDialog ( )
virtual
79 {
80  delete ui;
81 }
Ui::LicenseDialog * ui
Definition: licensedialog.h:35

Member Function Documentation

void geometrize::dialog::LicenseDialog::changeEvent ( QEvent *  event)
overrideprotected
84 {
85  if (event->type() == QEvent::LanguageChange) {
86  ui->retranslateUi(this);
87  populateUi();
88  }
89  QDialog::changeEvent(event);
90 }
void populateUi()
Definition: licensedialog.cpp:92
Ui::LicenseDialog * ui
Definition: licensedialog.h:35

Here is the call graph for this function:

void geometrize::dialog::LicenseDialog::populateUi ( )
private
93 {
94 
95 }

Here is the caller graph for this function:

Member Data Documentation

Ui::LicenseDialog* geometrize::dialog::LicenseDialog::ui
private

The documentation for this class was generated from the following files: