Merge pull request #254 from EdgeTX/credits-cleanup

Finish removal of `credits.txt` by removing `companion24` depenency
This commit is contained in:
Risto
2021-06-18 09:51:08 +02:00
committed by GitHub
8 changed files with 4 additions and 218 deletions
View File
-2
View File
@@ -223,7 +223,6 @@ set(companion_SRCS
burnconfigdialog.cpp
multimodelprinter.cpp
comparedialog.cpp
creditsdialog.cpp
releasenotesdialog.cpp
releasenotesfirmwaredialog.cpp
customizesplashdialog.cpp
@@ -257,7 +256,6 @@ set(companion_MOC_HDRS
comparedialog.h
printdialog.h
logsdialog.h
creditsdialog.h
releasenotesdialog.h
releasenotesfirmwaredialog.h
customizesplashdialog.h
-1
View File
@@ -2,7 +2,6 @@
<qresource prefix="/">
<file>images/customize.png</file>
<file alias="icon.png">images/icon.png</file>
<file>../../CREDITS.txt</file>
<file>../releasenotes.txt</file>
<file>images/screenshot.png</file>
<file>images/splash.png</file>
-135
View File
@@ -1,135 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "creditsdialog.h"
#include "ui_htmldialog.h"
#include "helpers.h"
#include <QFile>
CreditsDialog::CreditsDialog(QWidget * parent):
QDialog(parent),
ui(new Ui::HtmlDialog)
{
ui->setupUi(this);
setWindowTitle(tr("OpenTX Contributors"));
setWindowIcon(CompanionIcon("contributors.png"));
QString str = "<html>" \
"<head>" \
" <style type=\"text/css\">" \
" .normal { font-weight:normal;color:#000000;vertical-align:top;font-size:10px;text-align:left;font-family:arial,helvetica,sans-serif; }" \
" .bold { font-weight:bold;color:#C00000;vertical-align:top;font-size:10px;text-align:left;font-family:arial,helvetica,sans-serif; }" \
" .title { font-weight:bold;color:#000000;font-size:14px;text-align:left;font-family:arial,helvetica,sans-serif; }" \
" </style>" \
"</head>"
"<body class=\"normal\">";
foreach(CreditsSection section, readCredits()) {
str.append(formatTable(sectionTitle(section.title), section.names, 3));
}
str.append("<table><tr><td class=\"normal\">&nbsp;</td></tr>" \
" <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
"</table>");
#if 0
QFile blacklist(":/BLACKLIST.txt");
if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) {
QStringList names;
names << blacklist.readAll();
str.append(formatTable(tr("OpenTX Blacklist"), names, 1));
}
#endif
str.append("</body></html>");
ui->textEditor->setHtml(str);
ui->textEditor->scroll(0, 0);
ui->textEditor->setOpenExternalLinks(true);
}
CreditsDialog::~CreditsDialog()
{
delete ui;
}
QList<CreditsDialog::CreditsSection> CreditsDialog::readCredits()
{
QFile credits(":/CREDITS.txt");
QList<CreditsSection> result;
if (credits.open(QIODevice::ReadOnly | QIODevice::Text)) {
while (!credits.atEnd()) {
QByteArray line = credits.readLine().trimmed();
if (line.size() >= 2) {
if (line.startsWith("[") && line.endsWith("]")) {
result.push_back(CreditsSection(line.mid(1, line.size() - 2)));
} else {
result.back().addName(line);
}
}
}
}
return result;
}
QString CreditsDialog::sectionTitle(const QString & title)
{
if (title == "Main developers")
return tr("Main developers");
else if (title == "Translators")
return tr("Translators");
else if (title == "Companies and projects who have donated to OpenTX")
return tr("Companies and projects who have donated to OpenTX");
else if (title == "People who have donated to OpenTX")
return tr("People who have donated to OpenTX");
else
return tr("Other contributors");
}
QString CreditsDialog::formatTable(const QString & title, const QStringList & names, int columns)
{
const float cwidth = 100.0 / columns;
QString str = "<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>" \
" <tr><td class=\"normal\">&nbsp;</td></tr>" \
" <tr><td class=\"title\">" + title + "</td></tr>" \
"</table>";
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
int column = 0;
foreach(QString name, names) {
if (column == 0) {
str.append("<tr>");
}
QString trclass = name.contains("monthly") ? "bold" : "normal";
str.append(QString("<td width=\"%1%\" class=\"%2\">%3</td>").arg(cwidth).arg(trclass).arg(name.trimmed().replace("monthly", tr("monthly"))));
if (++column == columns) {
str.append("</tr>");
column = 0;
}
}
if (column != 0) {
str.append("</tr>");
}
str.append("</table>");
return str;
}
-62
View File
@@ -1,62 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _CREDITSDIALOG_H_
#define _CREDITSDIALOG_H_
#include <QDialog>
namespace Ui {
class HtmlDialog;
}
class CreditsDialog : public QDialog
{
Q_OBJECT
class CreditsSection
{
public:
CreditsSection(const QString & title):
title(title)
{
}
void addName(const QString & name)
{
names.push_back(name);
}
QString title;
QStringList names;
};
public:
explicit CreditsDialog(QWidget * parent = 0);
~CreditsDialog();
private:
Ui::HtmlDialog * ui;
QList<CreditsSection> readCredits();
QString sectionTitle(const QString & title);
QString formatTable(const QString & title, const QStringList & names, int colums);
};
#endif // _CREDITSDIALOG_H_
+3 -15
View File
@@ -29,7 +29,6 @@
#include "downloaddialog.h"
#include "printdialog.h"
#include "version.h"
#include "creditsdialog.h"
#include "releasenotesdialog.h"
#include "releasenotesfirmwaredialog.h"
#include "customizesplashdialog.h"
@@ -868,13 +867,6 @@ void MainWindow::fwPrefs()
dialog->deleteLater();
}
void MainWindow::contributors()
{
CreditsDialog * dialog = new CreditsDialog(this);
dialog->exec();
dialog->deleteLater();
}
void MainWindow::sdsync()
{
// remember user-selectable options for duration of session TODO: save to settings
@@ -1230,8 +1222,7 @@ void MainWindow::retranslateUi(bool showMsg)
trAct(burnConfigAct, tr("Configure Communications..."), tr("Configure software for communicating with the Radio"));
trAct(writeBUToRadioAct, tr("Write Backup to Radio"), tr("Write Backup from file to Radio"));
trAct(readBUToFileAct, tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"));
trAct(contributorsAct, tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"));
trAct(createProfileAct, tr("Add Radio Profile"), tr("Create a new Radio Settings Profile"));
trAct(copyProfileAct, tr("Copy Current Radio Profile"), tr("Duplicate current Radio Settings Profile"));
trAct(deleteProfileAct, tr("Delete Current Radio Profile..."), tr("Delete the current Radio Settings Profile"));
@@ -1306,8 +1297,7 @@ void MainWindow::createActions()
aboutAct = addAct("information.png", SLOT(about()));
openDocURLAct = addAct("changelog.png", SLOT(openDocURL()));
changelogAct = addAct("changelog.png", SLOT(changelog()));
contributorsAct = addAct("contributors.png", SLOT(contributors()));
// these two get assigned menus in createMenus()
recentFilesAct = addAct("recentdocument.png");
profilesMenuAct = addAct("profiles.png");
@@ -1315,7 +1305,6 @@ void MainWindow::createActions()
exitAct->setMenuRole(QAction::QuitRole);
aboutAct->setMenuRole(QAction::AboutRole);
appPrefsAct->setMenuRole(QAction::PreferencesRole);
contributorsAct->setMenuRole(QAction::ApplicationSpecificRole);
openDocURLAct->setMenuRole(QAction::ApplicationSpecificRole);
checkForUpdatesAct->setMenuRole(QAction::ApplicationSpecificRole);
changelogAct->setMenuRole(QAction::ApplicationSpecificRole);
@@ -1402,8 +1391,7 @@ void MainWindow::createMenus()
helpMenu->addSeparator();
helpMenu->addAction(changelogAct);
helpMenu->addSeparator();
helpMenu->addAction(contributorsAct);
recentFilesMenu = new QMenu(this);
recentFilesMenu->setToolTipsVisible(true);
for ( int i = 0; i < g.historySize(); ++i) {
-2
View File
@@ -111,7 +111,6 @@ class MainWindow : public QMainWindow
void readBackup();
void burnConfig();
void burnList();
void contributors();
void sdsync();
void changelog();
void customizeSplash();
@@ -200,7 +199,6 @@ class MainWindow : public QMainWindow
QAction *appPrefsAct;
QAction *fwPrefsAct;
QAction *checkForUpdatesAct;
QAction *contributorsAct;
QAction *sdsyncAct;
QAction *changelogAct;
QAction *compareAct;