File: tipsdialog.cpp

package info (click to toggle)
klog 2.4.2-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 12,228 kB
  • sloc: cpp: 51,678; makefile: 15
file content (264 lines) | stat: -rw-r--r-- 12,387 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/***************************************************************************
                          tipsdialog.cpp  -  description
                             -------------------
    begin                : sept 2019
    copyright            : (C) 2019 by Jaime Robles
    email                : jaime@robles.es
 ***************************************************************************/

/*****************************************************************************
 * This file is part of KLog.                                                *
 *                                                                           *
 *    KLog is free software: you can redistribute it and/or modify           *
 *    it under the terms of the GNU General Public License as published by   *
 *    the Free Software Foundation, either version 3 of the License, or      *
 *    (at your option) any later version.                                    *
 *                                                                           *
 *    KLog 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.                           *
 *                                                                           *
 *    You should have received a copy of the GNU General Public License      *
 *    along with KLog.  If not, see <https://www.gnu.org/licenses/>.         *
 *                                                                           *
 *****************************************************************************/
#include "tipsdialog.h"

#include <QDialogButtonBox>
#include <QGridLayout>
#include <QKeyEvent>
#include <QLabel>
#include <QPushButton>
#include <QDebug>

TipsDialog::TipsDialog(QWidget *parent): QDialog(parent)
{
      //qDebug() << "TipsDialog::TipsDialog";
    logLevel = Info;  //7 Debug /0=emergency or no debug
    logEvent(Q_FUNC_INFO, "Start", Debug);
    tipTextQLabel = new QLabel;
    tipId = 1;
    tipMax = 19;

    setWindowTitle(tr("KLog tips"));
    setWindowFlags(windowFlags() & Qt::WindowContextHelpButtonHint);

    tipTextQLabel->setWordWrap(true);
    tipTextQLabel->setOpenExternalLinks(false);
    tipTextQLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
    tipTextQLabel->setTextFormat(Qt::RichText);
    setTip(1);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
    QPushButton *nextButton = new QPushButton;
    QPushButton *prevButton = new QPushButton;
    nextButton->setText(tr("Next"));
    prevButton->setText(tr("Previous"));

    buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
    buttonBox->addButton(prevButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::ActionRole));
    buttonBox->addButton(nextButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::ActionRole));

    //connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject);
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())) ;
    connect(prevButton, SIGNAL(clicked()), this, SLOT(slotPrevButtonClicked() ) );
    connect(nextButton, SIGNAL(clicked()), this, SLOT(slotNextButtonClicked() ) );
    connect(tipTextQLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotLinkActivated(QString)));

    tip = new QWidget;

    QGridLayout *layout1 = new QGridLayout;
    layout1->addWidget(tipTextQLabel, 0, 1, 4, 4);
    tip->setLayout(layout1);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(tip);
    layout->addWidget(buttonBox);
    setLayout(layout);
    logEvent(Q_FUNC_INFO, "END", Debug);
}

TipsDialog::~TipsDialog(){}


void TipsDialog::slotPrevButtonClicked()
{
    logEvent(Q_FUNC_INFO, "Start", Debug);

    if (tipId>1)
    {
        tipId--;
    }
    else
    {
        tipId = tipMax;
    }
    setTip(tipId);

    logEvent(Q_FUNC_INFO, "END", Debug);
}

void TipsDialog::slotNextButtonClicked()
{
    logEvent(Q_FUNC_INFO, "Start", Debug);

    if (tipId<tipMax)
    {
        tipId++;
    }
    else
    {
        tipId = 1;
    }
    setTip(tipId);
    logEvent(Q_FUNC_INFO, "END", Debug);
}

void TipsDialog::setLogLevel(const DebugLogLevel _sev)
{
    logEvent(Q_FUNC_INFO, "Start", Debug);
    logLevel = _sev;
    logEvent(Q_FUNC_INFO, "END", Debug);
}

void TipsDialog::setTip(const int _t)
{
    logEvent(Q_FUNC_INFO, "Start", Debug);
    switch (_t)
    {
    case 1:
        //: Translator: Please make sure that the name of the link is coherent with the menu Tools->Fill in QSO data
        description = tr("<b>Tip #1:</b><br>Do you know...<br>You can use <a href=\"#ToolsFillInQSO\">Tools->Fill in QSO data</a> to automatically read the full log to fill the DXCC, CQ, ITU zones and continent?");
    break;
   case 2:
        //: Translator: Please make sure that the name of the link is coherent with the menu Tools->Fill in DXCC data
      description = tr("<b>Tip #2:</b><br>Do you know...<br>You can find the QSLs that you still need to send with <a href=\"#ToolsSendPendingQSL\">Tools->QSL tools...->Find My-QSLs pending to send</a>.<bR>This tool will list you in the search box all the QSOs with the QSL-Sent marked as <i>Requested</i>.");
    break;
    case 3:
        //: Translator: Please make sure that the name of the link is coherent with the menu Tools->QSL tools...->Find QSO to QSL
        description = tr("<b>Tip #3:</b><br>Do you know...<br>You can use <a href=\"#ToolsFindQSO2QSL\">Tools->QSL tools...->Find QSO to QSL</a> to look for all those QSO that you should send your QSL because you still need to confirm that DXCC and you have still not send your QSL card?");
    break;
    case 4:
        //: Translator: Please make sure that the name of the link is coherent with the menu File->Export Requested QSL to ADIF...
        description = tr("<b>Tip #4:</b><br>Do you know...<br>You can enter a '*' in the search box, in the search window to search for all the QSOs done with one specific station callsign?");
    break;
    case 5:
        description = tr("<b>Tip #5:</b><br>Do you know...<br>You can find the file containing all your log and other information in the logbook.dat "
                         "file and the klogrc file, containing the KLog config file in the KLog folder by opening the"
                         " <a href=\"#FileOpenKLogFolder\">File->KLog folder</a> menu?");
    break;
    case 6:
        //: Translator: Please make sure that the name of the link is coherent with the menu File->KLog folder
        description = tr("<b>Tip #6:</b><br>Do you know...<br>You can upload your QSO marked as queued to LoTW via TQSL with <a href=\"#ToolsUploadLoTW\">Tools->LoTW tools ...->Sends the log to LoTW calling TQSL.</a> ?<br><br>You have to configure TQSL in the preferences to be able to use this functionality.");
    break;
    case 7:
        //: Translator: Please make sure that the name of the link is coherent with the menu QSL tools...->Find My-QSLs pending to send
        description = tr("<b>Tip #7:</b><br>Do you know...<br>You can see the QSO that confirms one specific DXCC entity in one specific band by poiting your mouse over that band in the DXCC widget?");
    break;
    case 8:
        //: Translator: Please make sure that the name of the link is coherent with the menu QSL tools...->Find DX-QSLs pending to receive
        description = tr("<b>Tip #8:</b><br>Do you know...<br>You can find the QSLs that you are still waiting for with <a href=\"#ToolsReceivePendingQSL\">Tools->QSL tools...->Find DX-QSLs pending to receive</a>.<bR>This tool will list you in the search box all the QSOs with the QSL-Sent marked as <i>Sent</i> but you have still not received the QSL card from the DX.");
    break;
    case 9:
        //: Translator: Please make sure that the name of the link is coherent with the menu QSL tools...->Find requested pending to receive
        description = tr("<b>Tip #9:</b><br>Do you know...<br>You can find the QSLs that you are still waiting for with <a href=\"#ToolsReceiveRecPendingQSL\">Tools->QSL tools...->Find requested pending to receive</a>.<bR>This tool will list you in the search box all the QSOs with the QSL-Rec marked as <i>Requested</i> but you have still not received the QSL card from the DX.");
    break;
    case 10:
        description = tr("<b>Tip #10:</b><br>Do you know...<br>You can subscribe to the <a href=https://t.me/klogchat>English KLog Telegram group</a> to discuss about KLog in English?");
    break;
    case 11:
        description = tr("<b>Tip #11:</b><br>Do you know...<br>You can subscribe to the <a href=https://t.me/KLogES>Spanish Telegram group</a> to discuss about KLog in Spanish?");
    break;
    case 12:
        description = tr("<b>Tip #12:</b><br>Do you know...<br>You can subscribe to <a href=https://groups.io/g/klog>KLog mailing list</a> to discuss via email about KLog in English?");
    break;
    case 13:
        description = tr("<b>Tip #13:</b><br>Do you know...<br>You can <a href=https://twitter.com/_ea4k>follow EA4K on twitter</a> to get updates about KLog?");
    break;
    case 14:
        description = tr("<b>Tip #14:</b><br>Do you know...<br>You can write your own <a href=https://www.eham.net/reviews/detail/3118>review in eHam.net about KLog</a> to help other users to decide to use KLog?");
    break;
    case 15:
        description = tr("<b>Tip #15:</b><br>Do you know...<br>You can join the development team by simply <a href=https://github.com/ea4k/klog?tab=readme-ov-file#telegram-groups>Contacting us</a>?");
    break;
    case 16:
        description = tr("<b>Tip #16:</b><br>Do you know...<br>That there are many ways to contribute to KLog and some of them are listed in the <a href=https://github.com/ea4k/klog/issues>KLog issues</a> page?");
    break;
    case 17:
        description = tr("<b>Tip #17:</b><br>Do you know...<br>You can support translating KLog into your language? Please check <a href=https://github.com/ea4k/klog/tree/master/src/translations>KLog Translations</a> page.");
    break;
    case 18:
        description = tr("<b>Tip #18:</b><br>Do you know...<br>You can double-click on an entity name in the DXCC table and all the QSOs with that DXCC Entity will be shown in the search box?");
    break;
    case 19:
        description = tr("<b>Tip #19:</b><br>Do you know...<br>You can right-click on a QSO and select <i>Check in QRZ.com</i> to check that callsign in QRZ.com?");
    break;
    default:
        //description = tr("TIP-Default: Text");
        description = "";
    break;
    }
    //tipTextEdit->setHtml(description);

    tipTextQLabel->setText(description);
    logEvent(Q_FUNC_INFO, "END", Debug);
      //qDebug() << "TipsDialog::setTip: END" ;
}

void TipsDialog::slotLinkActivated(const QString &_link)
{
    logEvent(Q_FUNC_INFO, "Start", Debug);

      //qDebug() << "TipsDialog::slotLinkActivated: " << _link;
    //Comprobar el enalce y activar el menu correspondiente
    if (_link == "#ToolsFillInQSO")
    {
        emit fillInQSOSignal();
    }
    else if (_link == "#ToolsFindQSO2QSL")
    {
        emit fillInDXCCSignal();
    }
    else if (_link == "#ToolsFillInDXCC")
    {
        emit findQSL2QSOSignal();
    }
    else if (_link == "#FileExportQSLADIFToPrint")
    {
        emit fileExportToPrintSignal();
    }
    else if (_link == "#FileExportLoTWADIF")
    {
        //emit fileExportForLoTWSignal();
    }
    else if (_link == "#FileOpenKLogFolder")
    {
        emit fileOpenKLogFolderSignal();
    }
    else if (_link == "#ToolsSendPendingQSL")
    {
        emit toolSendPendingQSLSignal();
    }
    else if (_link == "#ToolsReceivePendingQSL")
    {
        emit toolRecPendingQSLSignal();
    }
    else if (_link == "#ToolsReceiveRecPendingQSL")
    {
        emit toolRecRecPendingQSLSignal();
    }
    else if (_link == "#ToolsUploadLoTW")
    {
        emit toolsUploadLoTWSignal();
    }
    logEvent(Q_FUNC_INFO, "END", Debug);
}


void TipsDialog::logEvent(const QString &_func, const QString &_msg,  DebugLogLevel _level)
{
    if (logLevel<=_level)
        emit debugLog (_func, _msg, _level);
}