WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / src / app / legalnotice.cpp
blobaf46ee9e5ee3ecec3c37665f474ea90fe34594eb
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2023 Mike Tzou (Chocobo1)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * In addition, as a special exception, the copyright holders give permission to
20 * link this program with the OpenSSL project's "OpenSSL" library (or with
21 * modified versions of it that use the same license as the "OpenSSL" library),
22 * and distribute the linked executables. You must obey the GNU General Public
23 * License in all respects for all of the code used other than "OpenSSL". If you
24 * modify file(s), you may extend this exception to your version of the file(s),
25 * but you are not obligated to do so. If you do not wish to do so, delete this
26 * exception statement from your version.
29 #include "legalnotice.h"
31 #ifdef DISABLE_GUI
32 #include <cstdio>
33 #endif // DISABLE_GUI
35 #include <QCoreApplication>
36 #include <QString>
38 #ifndef DISABLE_GUI
39 #include <QMessageBox>
40 #endif // DISABLE_GUI
42 #include "base/global.h"
44 #ifndef DISABLE_GUI
45 #include "gui/utils.h"
46 #endif // DISABLE_GUI
48 void showLegalNotice(const bool isInteractive)
50 const QString noticeTitle = QCoreApplication::translate("LegalNotice", "Legal Notice");
51 const QString noticeBody = QCoreApplication::translate("LegalNotice", "qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.");
52 const QString noticeEnd = QCoreApplication::translate("LegalNotice", "No further notices will be issued.");
54 if (!isInteractive)
56 const QString legalNotice = u"\n*** %1 ***\n"_s.arg(noticeTitle)
57 + noticeBody + u"\n\n"
58 + QCoreApplication::translate("LegalNotice", "If you have read the legal notice, you can use command line option `--confirm-legal-notice` to suppress this message.");
59 printf("%s\n\n", qUtf8Printable(legalNotice));
60 return;
63 #ifdef DISABLE_GUI
64 const QString legalNotice = u"\n*** %1 ***\n"_s.arg(noticeTitle)
65 + noticeBody + u"\n\n"
66 + noticeEnd + u"\n\n"
67 + QCoreApplication::translate("LegalNotice", "Press 'Enter' key to continue...");
68 printf("%s", qUtf8Printable(legalNotice));
69 getchar();
70 #else // DISABLE_GUI
71 const QString messageBody = noticeBody + u"\n\n" + noticeEnd;
72 QMessageBox msgBox {QMessageBox::NoIcon, noticeTitle, messageBody, QMessageBox::Ok};
73 msgBox.show(); // Need to be shown first or moveToCenter does not work
74 msgBox.move(Utils::Gui::screenCenter(&msgBox));
75 msgBox.exec();
76 #endif // DISABLE_GUI