Some cleaning

This commit is contained in:
jaime 2017-05-02 19:38:54 +00:00
parent 853e0cd4e5
commit efb22e0eb0
19 changed files with 5254 additions and 273 deletions

4
TODO
View File

@ -3,6 +3,10 @@ It is not fixed... new features may be prioritized or not added without any noti
Feel free to request any roadmap change if you have any suggestion.
Check:
If there is a sat seleted, the prop-mode should be satellite!
Working on

160
aboutdialog.cpp Normal file
View File

@ -0,0 +1,160 @@
#include "aboutdialog.h"
#include <QDebug>
//#include "coreicons.h"
//#include <app/app_version.h>
//#include <coreplugin/coreicons.h>
//#include <coreplugin/icore.h>
//#include <utils/algorithm.h>
//#include <utils/hostosinfo.h>
//#include <utils/qtcassert.h>
//#include <utils/utilsicons.h>
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QKeyEvent>
#include <QLabel>
#include <QPushButton>
AboutDialog::AboutDialog(const QString tversion, QWidget *parent)
: QDialog(parent)
{
//qDebug() << "AboutDialog::AboutDialog" << endl;
QPixmap pixmap(":/img/klog_256x256.png");
setWindowTitle(tr("About KLog"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
const QString br = QLatin1String("<br/>");
const QString description = "<center><h2>KLog " + tversion + "</h2><h4>" +tr("By")+ "<a href=\"https://www.qrz.com/db/ea4tv\">EA4TV</a> - 2002-2017</h4></center><br>" + tr("KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br>") + "<a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>" + tr("Author") + ": Jaime Robles, <a href=\"https://www.qrz.com/db/ea4tv\">EA4TV</a><br><a href=mailto:jaime@robles.es>jaime@robles.es</a>";
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject);
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(pixmap);
QLabel *logoLabel2 = new QLabel;
logoLabel2->setPixmap(pixmap);
QLabel *logoLabel3 = new QLabel;
logoLabel3->setPixmap(pixmap);
QLabel *logoLabel4 = new QLabel;
logoLabel4->setPixmap(pixmap);
QString author1 = QString("<tr><td>Jaime Robles</td>") + QString("<td><a href=\"https://www.qrz.com/db/ea4tv\">EA4TV</a></td>") + tr("<td>(2002-today) Main developer</td></tr>");
QString author2 = QString("<tr><td>Akihiro Koda</td>") + QString("<td><a href=\"https://www.qrz.com/db/jl3oxr\">JL3OXR</a></td>") + tr("<td>(2016)</td></tr>");
QString author3 = QString("<tr><td>Andrew Goldie</td>") + QString("<td><a href=\"https://www.qrz.com/db/zl2agc\">ZL2ACG</a></td>") + tr("<td>(2009-2010)</td></tr>");
QString authorText = tr("KLog is developed by a very small team and you are invited to join!<br><br>If you want to support you can join the <a href=\"https://lists.nongnu.org/mailman/listinfo/klog-devel\">KLog's development mailing list</a> and you will be welcome!<br><br>You can also help us sending bug reports or small code contributions, ideas or whatever you think it may improve KLog.");
QString authors = "<center><h2>" + tr("Authors") + "</h2></center><br>" + authorText + "<br><table>" + author1 + author2 + author3 + "</table>";
QString translator1 = QString("<tr><td>Catalan</td>") + QString("<td>Luis</td>") + QString("<td><a href=\"https://www.qrz.com/db/ea3nm\">EA3NM</a></td></tr>");
QString translator2 = QString("<tr><td>Croatian</td>") + QString("<td>Kristijan Conkas</td>") + QString("<td><a href=\"https://www.qrz.com/db/m0nkc\">M0NKC</a></td></tr>");
QString translator3 = QString("<tr><td>Japanese</td>") + QString("<td>Akihiro Koda</td>") + QString("<td><a href=\"https://www.qrz.com/db/jl3oxr\">JL3OXR</a></td></tr>");
QString translator4 = QString("<tr><td>Spanish</td>") + QString("<td>Jaime Robles</td>") + QString("<td><a href=\"https://www.qrz.com/db/ea4tv\">EA4TV</a></td></tr>");
QString translatorsText = tr("Translators bring KLog into your language. They are really an important part of the KLog development team.<br><br>If KLog is still not in your language and you want to help us, please contact us through the <a href=\"https://lists.nongnu.org/mailman/listinfo/klog-devel\">KLog's development mailing list</a> and you will be welcome!");
QString translators = "<center><h2>" + tr("Translators") + "</h2></center><br>" + translatorsText + "<br><table>" + translator1 + translator2 + translator3 + "</table>";
//<h4><ul><li>" + author1 + "</li><li>"+ author2 + "</li><li>" + author3 + "</li></ul></h4>";
//QString authors = "<center><h2>" + tr("Authors") + "</center><br><h4><ul><li>" + author1 + "</li><li>"+ author2 + "</li><li>" + author3 + "</li></ul></h4>";
//Estoy trabajando para poner los autores y traductores
QLabel *authorsLabel = new QLabel(authors);
authorsLabel->setWordWrap(true);
authorsLabel->setOpenExternalLinks(true);
authorsLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QLabel *translatorsLabel = new QLabel(translators);
translatorsLabel->setWordWrap(true);
translatorsLabel->setOpenExternalLinks(true);
translatorsLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QString privacy = "<center><h2>" + tr("Privacy advisory") + "</h2></h4></center><br>" +
tr("KLog developers have included a feature that reports to KLog's server some data of the user with the only purpose to identify the number of installed versions to focus the development in one or other direction taking into account the user's need.") +
"<br><br>" + tr("Today, the data that is provided is the following:") +
"<ul><li>" + tr("Callsign") + "</li><li>" + tr("KLog version") + "</li><li>" + tr("Operating system") + "</li></ul><br><br><b>" +
tr("Please know that you can enable/disable this feature from the Misc tab in the Setup page") + ".</b>";
QLabel *privacyLabel = new QLabel(privacy);
privacyLabel->setWordWrap(true);
privacyLabel->setOpenExternalLinks(true);
privacyLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
tab1 = new QWidget;
tab2 = new QWidget;
tab3 = new QWidget;
tab4 = new QWidget;
QGridLayout *layout1 = new QGridLayout;
layout1->addWidget(logoLabel , 0, 0, 1, 1);
layout1->addWidget(copyRightLabel, 0, 1, 4, 4);
layout1->addWidget(buttonBox, 4, 0, 1, 5);
tab1->setLayout(layout1);
QGridLayout *layout2 = new QGridLayout;
layout2->addWidget(logoLabel2 , 0, 0, 1, 1);
layout2->addWidget(authorsLabel, 0, 1, 4, 4);
//layout2->addWidget(buttonBox, 4, 0, 1, 5);
tab2->setLayout(layout2);
QGridLayout *layout3 = new QGridLayout;
layout3->addWidget(logoLabel3 , 0, 0, 1, 1);
layout3->addWidget(translatorsLabel, 0, 1, 4, 4);
tab3->setLayout(layout3);
QGridLayout *layout4 = new QGridLayout;
layout4->addWidget(logoLabel4 , 0, 0, 1, 1);
layout4->addWidget(privacyLabel, 0, 1, 4, 4);
tab4->setLayout(layout4);
tabw = new QTabWidget;
tabw->addTab(tab1, tr("KLog"));
tabw->addTab(tab2, tr("Authors"));
tabw->addTab(tab3, tr("Translators"));
tabw->addTab(tab4, tr("Privacy"));
layout->addWidget(tabw);
setLayout(layout);
//qDebug() << "AboutDialog::AboutDialog - END" << endl;
}
bool AboutDialog::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
ke->accept();
return true;
}
}
return QDialog::event(event);
}

27
aboutdialog.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
class QEvent;
#include <QDialog>
#include <QTabWidget>
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(const QString tversion, QWidget *parent = 0);
bool event(QEvent *event);
private:
QTabWidget *tabw;
QWidget *tab1, *tab2, *tab3, *tab4;
};
#endif // ABOUTDIALOG_H

View File

@ -1473,6 +1473,7 @@ bool Awards::setAwardDXCC(const int _dxcc, const int _band, const int _mode, con
bool isOK1 = false;
bool isOK2 = false;
QString stringQuery;
QString aux;
if (_dxcc<=0)
{
//qDebug() << "Awards::setAwardDXCC: DXCC < 0" << endl;
@ -1518,7 +1519,9 @@ bool Awards::setAwardDXCC(const int _dxcc, const int _band, const int _mode, con
// Second phase, the memory storage.
//TODO: Choose whether I use a DB or memory but both may not be optimal.
int value = (QString::number(_band) + QString::number(_mode)).toInt();
//int value = (QString::number(_band) + QString::number(_mode)).toInt();
aux = QString::number(_band) + QString::number(_mode);
int value = aux.toInt();
if (_workedOrConfirmed == -1)
{
@ -1560,6 +1563,7 @@ bool Awards::setAwardWAZ(const int _cqz, const int _band, const int _mode, const
//qDebug() << "Awards::setAwardWAZ: " << QString::number(_band) + QString::number(_mode) << endl;
bool isOK1 = false;
bool isOK2 = false;
QString aux;
/*
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
@ -1595,7 +1599,9 @@ bool Awards::setAwardWAZ(const int _cqz, const int _band, const int _mode, const
// Second phase, the memory storage.
//TODO: Choose whether I use a DB or memory but both may not be optimal.
int value = (QString::number(_band) + QString::number(_mode)).toInt();
//int value = (QString::number(_band) + QString::number(_mode)).toInt();
aux = QString::number(_band) + QString::number(_mode);
int value = aux.toInt();
if (_workedOrConfirmed == -1)
{

View File

@ -1826,7 +1826,7 @@ bool FileManager::adifLogExportToFile(const QString& _fileName, const int _logN,
if ( progress.wasCanceled() )
{
QMessageBox msgBox;
QString aux = QString(tr("You have cancelled the file export. The file will be removed and no data will be exported.\nDo you want to continue?"));
QString aux = QString(tr("You have cancelled the file export. The file will be removed and no data will be exported.\nDo you still want to cancel?"));
msgBox.setText(aux);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
@ -2567,7 +2567,7 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
{
QMessageBox msgBox;
aux = QString(tr("You have cancelled the file export. The file will be removed and no data will be exported.\nDo you want to continue?"));
aux = QString(tr("You have cancelled the file export. The file will be removed and no data will be exported.\nDo you still want to cancel?"));
msgBox.setText(aux);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);

View File

@ -1,74 +0,0 @@
#include "helpaboutdialog.h"
//#include <QDebug>
HelpAboutDialog::HelpAboutDialog(const QString tversion)
{
//qDebug() << "HelpAboutDialog::HelpAboutDialog" << endl;
QString text;
QString _version = tversion;
text = "<center><h2>KLog " + _version + "</h2><h4>By EA4TV - 2002-2016</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a>";
textBrowser = new QTextBrowser;
textBrowser->setOpenLinks(true);
textBrowser->setOpenExternalLinks(true);
textBrowser->setHtml(text);
QPushButton *acceptButton = new QPushButton(tr("Ok"));
textBrowser->setOpenExternalLinks(true);
//textBrowser->setHTML(url);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(acceptButton);
///
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(textBrowser);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("About KLog"));
///
connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked()));
}
HelpAboutDialog::~HelpAboutDialog()
{
//qDebug() << "HelpAboutDialog::~HelpAboutDialog" << endl;
}
void HelpAboutDialog::slotAcceptButtonClicked()
{
//qDebug() << "HelpAboutDialog::slotAcceptButtonClicked" << endl;
accept();
}
void HelpAboutDialog::keyPressEvent(QKeyEvent *event){
switch (event->key()) {
//case Qt::Key_Return:
// ENTER PRESSED
//slotQRZReturnPressed();
// break;
//case Qt::Key_Enter:
// ENTER PRESSED
// slotQRZReturnPressed();
break;
default:
//QFrame::keyPressEvent(event)
slotAcceptButtonClicked();
}
}

View File

@ -1,29 +0,0 @@
#ifndef HELPABOUTDIALOG_H
#define HELPABOUTDIALOG_H
//#include <QtWidgets>
#include <QtWidgets>
#include <QDialog>
#include <QTextBrowser>
class HelpAboutDialog : public QDialog
{
Q_OBJECT
public:
HelpAboutDialog(const QString tversion);
~HelpAboutDialog();
private slots:
void slotAcceptButtonClicked();
//void slotCancelButtonClicked();
private:
void keyPressEvent(QKeyEvent *event);
QTextBrowser *textBrowser;
};
#endif // HELPABOUTDIALOG_H

View File

@ -1,54 +0,0 @@
#include "helphelpdialog.h"
HelpHelpDialog::HelpHelpDialog(const QString tversion)
{
//http://www.gnu.org/licenses/gpl.txt
QString text;
QString _version = tversion;
text = "<center><h2>KLog " + _version + tr("</h2><h4>By EA4TV - 2002-2016</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a>");
textBrowser = new QTextBrowser;
textBrowser->setOpenLinks(true);
textBrowser->setOpenExternalLinks(true);
textBrowser->setHtml(text);
QPushButton *acceptButton = new QPushButton(tr("Ok"));
textBrowser->setOpenExternalLinks(true);
//textBrowser->setHTML(url);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(acceptButton);
///
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(textBrowser);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("Help"));
///
connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked()));
}
HelpHelpDialog::~HelpHelpDialog()
{
}
void HelpHelpDialog::slotAcceptButtonClicked()
{
accept();
}

View File

@ -1,28 +0,0 @@
#ifndef HELPHELPDIALOG_H
#define HELPHELPDIALOG_H
//#include <QtWidgets>
#include <QtWidgets>
#include <QDialog>
#include <QTextBrowser>
class HelpHelpDialog : public QDialog
{
Q_OBJECT
public:
HelpHelpDialog(const QString tversion);
~HelpHelpDialog();
private slots:
void slotAcceptButtonClicked();
//void slotCancelButtonClicked();
private:
//void keyPressEvent(QKeyEvent *event);
QTextBrowser *textBrowser;
};
#endif // HELPHELPDIALOG_H

177
klog.pro
View File

@ -1,39 +1,75 @@
# -------------------------------------------------
# Project created by QtCreator 2011-04-23T14:06:58
# -------------------------------------------------
CONFIG += app_bundle
CONFIG += static
#CONFIG += release
TEMPLATE = app
VERSION = 0.9.2.6
DEFINES += APP_VERSION="$$VERSION"
APP_NAME = KLog
DEFINES += APP_NAME="$$APP_NAME"
APP_UNIX_NAME = klog
DEFINES += APP_UNIX_NAME="$$APP_UNIX_NAME"
message(Building $${APP_NAME} $${VERSION})
message(Qt $$[QT_VERSION] in $$[QT_INSTALL_PREFIX])
#DEFINES *= QT_NO_DEBUG_OUTPUT
DEFINES *= QT_USE_QSTRINGBUILDER
DEFINES *= QT_STRICT_ITERATORS
TARGET = $${APP_UNIX_NAME}
QT += core \
gui \
sql \
network \
widgets
greaterThan(QT_MAJOR_VERSION, 4) {
QT *= printsupport
QT += widgets
}
unix:!macx {
TARGET = klog
}
macx {
ICON = klog.icns
TARGET = KLog
}
win32 {
RC_ICONS = klog.ico
TARGET = klog
}
else:TARGET = klog
# greaterThan(QT_MAJOR_VERSION, 4): QT += widgets core gui sql network
# TARGET = klog
CONFIG += app_bundle
CONFIG += static
TEMPLATE = app
RESOURCES = klog.qrc
HEADERS += setupdialog.h \
aboutdialog.h \
mainwindow.h \
world.h \
logwindow.h \
filemanager.h \
contest.h \
database.h \
setuppagebandsmodes.h \
setuppagemisc.h \
locator.h \
dxcluster.h \
awards.h \
setuppageuserdata.h \
setuppagedxcluster.h \
setuppagecolors.h \
contest_cqwwdxssb.h \
setuppagelogs.h \
setuppageworldeditor.h \
setupentitydialog.h \
startwizard.h \
downloadcty.h \
dataproxy.h \
dataproxy_sqlite.h \
mainwindowsattab.h \
awarddxmarathon.h \
setuppagelogsnew.h \
setuppageclublog.h \
elogclublog.h \
softwareupdate.h \
softwareupdatedialog.h \
utilities.h \
dxccstatuswidget.h \
mainwindowmydatatab.h \
mainwindowinputcomment.h \
mainwindowinputothers.h
SOURCES += main.cpp \
aboutdialog.cpp \
setupdialog.cpp \
mainwindow.cpp \
world.cpp \
@ -62,52 +98,17 @@ SOURCES += main.cpp \
setuppagelogsnew.cpp \
setuppageclublog.cpp \
elogclublog.cpp \
softwareupdate.cpp \
softwareupdatedialog.cpp \
utilities.cpp \
dxccstatuswidget.cpp \
mainwindowmydatatab.cpp \
mainwindowinputcomment.cpp \
mainwindowinputothers.cpp \
softwareupdate.cpp \
softwareupdatedialog.cpp \
aboutdialog.cpp
HEADERS += setupdialog.h \
mainwindow.h \
world.h \
logwindow.h \
filemanager.h \
contest.h \
database.h \
setuppagebandsmodes.h \
setuppagemisc.h \
locator.h \
dxcluster.h \
awards.h \
setuppageuserdata.h \
setuppagedxcluster.h \
setuppagecolors.h \
contest_cqwwdxssb.h \
setuppagelogs.h \
setuppageworldeditor.h \
setupentitydialog.h \
startwizard.h \
downloadcty.h \
dataproxy.h \
dataproxy_sqlite.h \
mainwindowsattab.h \
awarddxmarathon.h \
setuppagelogsnew.h \
setuppageclublog.h \
elogclublog.h \
utilities.h \
dxccstatuswidget.h \
mainwindowmydatatab.h \
mainwindowinputcomment.h \
mainwindowinputothers.h \
softwareupdate.h \
softwareupdatedialog.h \
aboutdialog.h
OTHER_FILES += TODO \
mainwindowinputothers.cpp
OTHER_FILES += \
README-DEVEL \
TODO \
tips-for-devel.txt \
INSTALL.txt \
INSTALL-linux \
@ -119,12 +120,46 @@ OTHER_FILES += TODO \
COPYING \
AUTHORS \
README
TRANSLATIONS = translations/klog_es.ts \
translations/klog_ca.ts \
translations/klog_it.ts \
translations/klog_hr.ts \
translations/klog_ja.ts
RESOURCES += klog.qrc
DESTDIR = build/target/
OBJECTS_DIR = build/obj/
MOC_DIR = build/moc/
RCC_DIR = build/rcc/
# Tell Qt Linguist that we use UTF-8 strings in our sources
CODECFORTR = UTF-8
FORMS +=
CODECFORSRC = UTF-8
include(translations/translations.pri)
# deploy
DISTFILES += CHANGES COPYING
unix:!mac {
DEFINES += APP_LINUX
CONFIG += c++11
# QT += dbus
isEmpty(PREFIX):PREFIX = /usr
BINDIR = $$PREFIX/bin
INSTALLS += target
target.path = $$BINDIR
DATADIR = $$PREFIX/share
PKGDATADIR = $$DATADIR/klog
DEFINES += DATADIR=\\\"$$DATADIR\\\" \
PKGDATADIR=\\\"$$PKGDATADIR\\\"
translations.path = $$PKGDATADIR
translations.files += $$DESTDIR/translations
INSTALLS += translations
}
macx: {
ICON = klog.icns
TARGET = KLog
}
win32: {
RC_ICONS = klog.ico
TARGET = klog
}
else:TARGET = klog

View File

@ -1,5 +1,9 @@
<RCC>
<qresource prefix="/">
<file>img/klog_512x512.png</file>
<file>img/klog_256x256.png</file>
<file>img/klog_logo.png</file>
<file>img/klog.ico</file>
<file>flags/ad.png</file>
<file>flags/ae.png</file>
<file>flags/af.png</file>

View File

@ -366,7 +366,7 @@ MainWindow::MainWindow(const QString _kontestDir, const QString tversion)
rxPowerSpinBox = new QDoubleSpinBox;
rxPowerSpinBox->setDecimals(2);
rxPowerSpinBox->setMaximum(9999);
rxPowerSpinBox->setSuffix(tr("W"));
rxPowerSpinBox->setSuffix(tr("Watt"));
txFreqSpinBox = new QDoubleSpinBox;
txFreqSpinBox->setDecimals(3);

112
moc_helphelpdialog.cpp Normal file
View File

@ -0,0 +1,112 @@
/****************************************************************************
** Meta object code from reading C++ file 'helphelpdialog.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.5.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "helphelpdialog.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'helphelpdialog.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.5.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_HelpHelpDialog_t {
QByteArrayData data[3];
char stringdata0[40];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_HelpHelpDialog_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_HelpHelpDialog_t qt_meta_stringdata_HelpHelpDialog = {
{
QT_MOC_LITERAL(0, 0, 14), // "HelpHelpDialog"
QT_MOC_LITERAL(1, 15, 23), // "slotAcceptButtonClicked"
QT_MOC_LITERAL(2, 39, 0) // ""
},
"HelpHelpDialog\0slotAcceptButtonClicked\0"
""
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_HelpHelpDialog[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 19, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
0 // eod
};
void HelpHelpDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
HelpHelpDialog *_t = static_cast<HelpHelpDialog *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->slotAcceptButtonClicked(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject HelpHelpDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_HelpHelpDialog.data,
qt_meta_data_HelpHelpDialog, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *HelpHelpDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *HelpHelpDialog::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_HelpHelpDialog.stringdata0))
return static_cast<void*>(const_cast< HelpHelpDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int HelpHelpDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE

224
softwareupdate.cpp Normal file
View File

@ -0,0 +1,224 @@
#include "softwareupdate.h"
SoftwareUpdate::SoftwareUpdate(const QString _klogVersion) : QObject(0)
{
//qDebug() << "SoftwareUpdate::SoftwareUpdate(): " << _klogDir << endl;
util = new Utilities;
updateDialog = new SoftwareUpdateDialog();
updateDialog->setVersion(_klogVersion);
toUpdate = false;
url = new QUrl;
//klogDir = _klogDir;
klogVersion = _klogVersion;
latestVersion = klogVersion;
callsign = QString();
result = -1; // Error unknown
//reply = new QNetworkReply;
manager = new QNetworkAccessManager(this);
//request = new QNetworkRequest(this);
//request.setUrl(QUrl("http://localhost"));
//request.setUrl(QUrl("https://download.savannah.gnu.org/releases/klog/"));
request.setUrl(QUrl("http://download.klog.xyz/redirect"));
setHeader();
}
SoftwareUpdate::~SoftwareUpdate()
{
}
void SoftwareUpdate::slotReadyRead()
{
//qDebug() << "SoftwareUpdate::slotReadyRead: " << endl;
}
void SoftwareUpdate::slotError(int _p)
{
//qDebug() << "SoftwareUpdate::slotError: " << endl;
}
void SoftwareUpdate::slotDownloadFinished(QNetworkReply *reply)
{
//qDebug() << "SoftwareUpdate::slotDownloadFinished" << endl;
QUrl url = reply->url();
//qDebug() << "SoftwareUpdate::slotDownloadFinished - URL: " << url.toString() << endl;
QMessageBox msgBox;
QString aux;
aux.clear();
if (reply->error()) {
/*
fprintf(stderr, "Updates %s failed: %s\n",
url.toEncoded().constData(),
qPrintable(reply->errorString()));
//errorCode = query.lastError().number();
msgBox.setIcon(QMessageBox::Warning);
aux = tr("The following error code was received when trying to check for updates: ");
msgBox.setText(aux + reply->errorString());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
*/
} else {
//QString filename = saveFileName(url);
if (checkUpdates(reply))
{
updateDialog->setVersion(latestVersion);
updateDialog->show();
latestVersion = klogVersion;
/*
msgBox.setIcon(QMessageBox::Information);
aux = tr("There is a new KLog version, please update!");
msgBox.setText(aux);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
*/
}
else
{
/*
msgBox.setIcon(QMessageBox::Information);
aux = tr("You already have the latest version of KLog!");
msgBox.setText(aux);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
*/
}
//printf("Download of %s succeeded (saved to %s)\n",
// url.toEncoded().constData(), qPrintable(filename));
}
reply->deleteLater();
//manager->deleteResource(request);
//emit done();
}
bool SoftwareUpdate::checkUpdates(QIODevice *data)
{
//qDebug() << "SoftwareUpdate::checkUpdates: " << endl;
QString line, release;
QStringList stringList, klogStringList;
QRegularExpression rx("href=\"klog-(\\d\\.)+tar.gz");
if (rx.isValid())
{
//qDebug() << "SoftwareUpdate::checkUpdates: RX is VALID"<< endl;
}
else
{
//qDebug() << "SoftwareUpdate::checkUpdates: RX is NOT VALID"<< endl;
}
while (!data->atEnd())
{
stringList.clear();
klogStringList.clear();
line.clear();
line = data->readLine();
if (line.contains("klog-"))
{
stringList << line.split(">", QString::SkipEmptyParts);
klogStringList << stringList.filter("klog");
foreach (const QString &str, klogStringList)
{
//qDebug() << "SoftwareUpdate::checkUpdates klog: " << str << endl;
if (rx.match(str).hasMatch())
{
release = str.section("-",1);
release = release.section("\.tar.gz", 0, 0);
updateNeeded(release);
}
else
{
//qDebug() << "SoftwareUpdate::checkUpdates: DOES NOT MATCH: " << str << endl;
}
}
//qDebug() << "SoftwareUpdate::checkUpdates: " << line << endl;
}
}
if (latestVersion > klogVersion)
{
emit updateNeededSignal (true);
return true;
}
else
{
emit updateNeededSignal (false);
return false;
}
emit updateNeededSignal (false);
return false;
}
void SoftwareUpdate::updateNeeded(QString _newVer)
{
//qDebug() << "SoftwareUpdate::updateNeeded: " << _newVer << endl;
if (klogVersion < _newVer)
{
//qDebug() << "SoftwareUpdate::updateNeeded TRUE: " << _newVer << endl;
if (latestVersion < _newVer)
{
latestVersion = _newVer;
}
}
else
{
//qDebug() << "SoftwareUpdate::updateNeeded - FALSE " << _newVer << endl;
}
}
void SoftwareUpdate::needToUpdate()
{
//qDebug() << "SoftwareUpdate::needToUpdate (current version: " << klogVersion << ")" << endl;
QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(slotDownloadFinished(QNetworkReply*)));
}
void SoftwareUpdate::setHeader()
{
QString ver = util->getAgent(klogVersion);
if (callsign.length()>2)
{
ver = ver + "-" + callsign;
}
QByteArray str;
str.clear();
str.append(ver);
request.setRawHeader("User-Agent", str);
}
void SoftwareUpdate::addCall(const QString _call)
{
if (_call.length()>2)
{
callsign = _call;
setHeader();
}
}

67
softwareupdate.h Normal file
View File

@ -0,0 +1,67 @@
#ifndef SOFTWAREUPDATE_H
#define SOFTWAREUPDATE_H
#include <QCoreApplication>
#include <QMessageBox>
#include <QUrl>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
//#include <QFile>
//#include <QDirIterator>
#include <QList>
#include <QRegularExpression>
#include <QDebug>
#include "utilities.h"
#include "softwareupdatedialog.h"
class QSslError;
class SoftwareUpdate: public QObject {
Q_OBJECT
public:
SoftwareUpdate(const QString _klogVersion);
~SoftwareUpdate();
void addCall(const QString _call);
void needToUpdate();
private slots:
void slotReadyRead();
void slotError(int _p);
//void slotSslErrors(QList _p);
//void replyFinished(QNetworkReply *data);
void slotDownloadFinished(QNetworkReply *reply);
signals:
void updateNeededSignal(const bool _q); // Will be TRUE if updated if needed and FALSE if we already have the latest version
private:
bool checkUpdates(QIODevice *data);
void updateNeeded(QString _newVer);
void setHeader();
Utilities *util;
QString klogVersion, latestVersion, callsign;
QString urld;
QUrl *url;
QNetworkAccessManager *manager;
QNetworkRequest request;
SoftwareUpdateDialog *updateDialog;
int result;
bool toUpdate;
};
#endif // SOFTWAREUPDATE_H

73
softwareupdatedialog.cpp Normal file
View File

@ -0,0 +1,73 @@
#include "softwareupdatedialog.h"
//#include <QDebug>
SoftwareUpdateDialog::SoftwareUpdateDialog()
{
//qDebug() << "SoftwareUpdateDialog::SoftwareUpdateDialog" << endl;
textBrowser = new QTextBrowser;
textBrowser->setOpenLinks(true);
textBrowser->setOpenExternalLinks(true);
QPushButton *acceptButton = new QPushButton(tr("Ok"));
textBrowser->setOpenExternalLinks(true);
//textBrowser->setHTML(url);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(acceptButton);
///
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(textBrowser);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("KLog update"));
///
connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked()));
}
void SoftwareUpdateDialog::setVersion(const QString tversion)
{
//qDebug() << "SoftwareUpdateDialog::setVersion: " << tversion << endl;
_version = tversion;
text = "<center><h2>KLog new version ("+ tversion + ") is available! </h2></center><br>There is a new version of KLog available.<br><br><b>You can get the new version from:<br><br><center><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a></center>";
textBrowser->setHtml(text);
}
SoftwareUpdateDialog::~SoftwareUpdateDialog()
{
//qDebug() << "SoftwareUpdateDialog::~SoftwareUpdateDialog" << endl;
}
void SoftwareUpdateDialog::slotAcceptButtonClicked()
{
//qDebug() << "SoftwareUpdateDialog::slotAcceptButtonClicked" << endl;
accept();
}
void SoftwareUpdateDialog::keyPressEvent(QKeyEvent *event){
switch (event->key()) {
break;
default:
//QFrame::keyPressEvent(event)
slotAcceptButtonClicked();
}
}

28
softwareupdatedialog.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef SOFTWAREUPDATEDIALOG_H
#define SOFTWAREUPDATEDIALOG_H
#include <QtWidgets>
#include <QDialog>
#include <QTextBrowser>
class SoftwareUpdateDialog: public QDialog
{
Q_OBJECT
public:
SoftwareUpdateDialog();
~SoftwareUpdateDialog();
void setVersion(const QString tversion);
private slots:
void slotAcceptButtonClicked();
private:
void keyPressEvent(QKeyEvent *event);
QTextBrowser *textBrowser;
QString text;
QString _version;
};
#endif // SOFTWAREUPDATEDIALOG_H

4421
translations/klog_hr.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,12 @@ DEPENDPATH += $$PWD
VPATH += $$PWD
# ls -1 *.ts | tr '\n' ' '
TRANSLATIONS += klog_ca.ts klog_es.ts klog_it.ts klog_ja.ts
TRANSLATIONS = klog_ca.ts \
klog_es.ts \
klog_hr.ts \
klog_it.ts \
klog_ja.ts
isEmpty(QMAKE_LRELEASE) {
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease