Remove -c switch.
This commit is contained in:
parent
9eb2731093
commit
32151644a3
3 changed files with 48 additions and 71 deletions
23
src/main.cpp
23
src/main.cpp
|
@ -40,8 +40,6 @@
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
bool run_minimal_without_gui = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
const QString str = QString::fromLocal8Bit(argv[i]);
|
const QString str = QString::fromLocal8Bit(argv[i]);
|
||||||
|
|
||||||
|
@ -49,20 +47,10 @@ int main(int argc, char *argv[]) {
|
||||||
qDebug("Usage: rssguard [OPTIONS]\n\n"
|
qDebug("Usage: rssguard [OPTIONS]\n\n"
|
||||||
"Option\t\tMeaning\n"
|
"Option\t\tMeaning\n"
|
||||||
"-h\t\tDisplays this help.\n"
|
"-h\t\tDisplays this help.\n"
|
||||||
"-q\t\tQuits minimal non-GUI instance of application already running on this machine.\n"
|
"-q\t\tQuits minimal non-GUI instance of application already running on this machine.");
|
||||||
"-c\t\tStarts the application without GUI and will regularly update configured feeds.\n\n"
|
|
||||||
"Running with '-c' option starts application without GUI and/or tray icon. No "
|
|
||||||
"message boxes will be shown, no GUI. Only minimal functionality will be enabled, including periodic checking for "
|
|
||||||
"feed/message updates. Note that you must configure the application via GUI first! So to really get periodic "
|
|
||||||
"feed updates, you must import some feeds and set their auto-update policy first in the GUI.\n\n"
|
|
||||||
"You can quick the minimal non-GUI application instance either by just killing it or by running the application "
|
|
||||||
"executable again with -q option.");
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (str == "-c") {
|
|
||||||
run_minimal_without_gui = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//: Abbreviation of language, e.g. en.
|
//: Abbreviation of language, e.g. en.
|
||||||
|
@ -79,7 +67,7 @@ int main(int argc, char *argv[]) {
|
||||||
qInstallMessageHandler(Debugging::debugHandler);
|
qInstallMessageHandler(Debugging::debugHandler);
|
||||||
|
|
||||||
// Instantiate base application object.
|
// Instantiate base application object.
|
||||||
Application application(APP_LOW_NAME, run_minimal_without_gui, argc, argv);
|
Application application(APP_LOW_NAME, argc, argv);
|
||||||
qDebug("Instantiated Application class.");
|
qDebug("Instantiated Application class.");
|
||||||
|
|
||||||
// Check if another instance is running.
|
// Check if another instance is running.
|
||||||
|
@ -96,14 +84,12 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Add an extra path for non-system icon themes and set current icon theme
|
// Add an extra path for non-system icon themes and set current icon theme
|
||||||
// and skin.
|
// and skin.
|
||||||
if (!run_minimal_without_gui) {
|
|
||||||
qApp->icons()->setupSearchPaths();
|
qApp->icons()->setupSearchPaths();
|
||||||
qApp->icons()->loadCurrentIconTheme();
|
qApp->icons()->loadCurrentIconTheme();
|
||||||
qApp->skins()->loadCurrentSkin();
|
qApp->skins()->loadCurrentSkin();
|
||||||
|
|
||||||
// Load localization and setup locale before any widget is constructed.
|
// Load localization and setup locale before any widget is constructed.
|
||||||
qApp->localization()->loadActiveLanguage();
|
qApp->localization()->loadActiveLanguage();
|
||||||
}
|
|
||||||
|
|
||||||
// These settings needs to be set before any QSettings object.
|
// These settings needs to be set before any QSettings object.
|
||||||
Application::setApplicationName(APP_NAME);
|
Application::setApplicationName(APP_NAME);
|
||||||
|
@ -118,7 +104,6 @@ int main(int argc, char *argv[]) {
|
||||||
// Setup single-instance behavior.
|
// Setup single-instance behavior.
|
||||||
QObject::connect(&application, &Application::messageReceived, &application, &Application::processExecutionMessage);
|
QObject::connect(&application, &Application::messageReceived, &application, &Application::processExecutionMessage);
|
||||||
|
|
||||||
if (!run_minimal_without_gui) {
|
|
||||||
qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'.";
|
qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'.";
|
||||||
|
|
||||||
// Instantiate main application window.
|
// Instantiate main application window.
|
||||||
|
@ -163,7 +148,3 @@ int main(int argc, char *argv[]) {
|
||||||
// Enter global event loop.
|
// Enter global event loop.
|
||||||
return Application::exec();
|
return Application::exec();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return Application::exec();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
#include <QWebEngineDownloadItem>
|
#include <QWebEngineDownloadItem>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Application::Application(const QString &id, bool run_minimal_without_gui, int &argc, char **argv)
|
Application::Application(const QString &id, int &argc, char **argv)
|
||||||
: QtSingleApplication(id, argc, argv),
|
: QtSingleApplication(id, argc, argv),
|
||||||
m_runMinimalWithoutGui(run_minimal_without_gui), m_feedReader(nullptr),
|
m_feedReader(nullptr),
|
||||||
m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr),
|
m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr),
|
||||||
m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr),
|
m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr),
|
||||||
m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr) {
|
m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr) {
|
||||||
|
@ -247,7 +247,7 @@ void Application::processExecutionMessage(const QString &message) {
|
||||||
if (messages.contains(APP_QUIT_INSTANCE)) {
|
if (messages.contains(APP_QUIT_INSTANCE)) {
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
else if (!m_runMinimalWithoutGui) {
|
else {
|
||||||
foreach (const QString &msg, messages) {
|
foreach (const QString &msg, messages) {
|
||||||
if (msg == APP_IS_RUNNING) {
|
if (msg == APP_IS_RUNNING) {
|
||||||
showGuiMessage(APP_NAME, tr("Application is already running."), QSystemTrayIcon::Information);
|
showGuiMessage(APP_NAME, tr("Application is already running."), QSystemTrayIcon::Information);
|
||||||
|
@ -301,10 +301,7 @@ void Application::showGuiMessage(const QString &title, const QString &message,
|
||||||
QSystemTrayIcon::MessageIcon message_type, QWidget *parent,
|
QSystemTrayIcon::MessageIcon message_type, QWidget *parent,
|
||||||
bool show_at_least_msgbox, QObject *invokation_target,
|
bool show_at_least_msgbox, QObject *invokation_target,
|
||||||
const char *invokation_slot) {
|
const char *invokation_slot) {
|
||||||
if (m_runMinimalWithoutGui) {
|
if (SystemTrayIcon::areNotificationsEnabled() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||||
qDebug("Silencing GUI message: '%s'.", qPrintable(message));
|
|
||||||
}
|
|
||||||
else if (SystemTrayIcon::areNotificationsEnabled() && SystemTrayIcon::isSystemTrayActivated()) {
|
|
||||||
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot);
|
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot);
|
||||||
}
|
}
|
||||||
else if (show_at_least_msgbox) {
|
else if (show_at_least_msgbox) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Application : public QtSingleApplication {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
explicit Application(const QString &id, bool run_minimal_without_gui, int &argc, char **argv);
|
explicit Application(const QString &id, int &argc, char **argv);
|
||||||
virtual ~Application();
|
virtual ~Application();
|
||||||
|
|
||||||
FeedReader *feedReader();
|
FeedReader *feedReader();
|
||||||
|
@ -128,7 +128,6 @@ class Application : public QtSingleApplication {
|
||||||
void eliminateFirstRun();
|
void eliminateFirstRun();
|
||||||
void eliminateFirstRun(const QString &version);
|
void eliminateFirstRun(const QString &version);
|
||||||
|
|
||||||
bool m_runMinimalWithoutGui;
|
|
||||||
FeedReader *m_feedReader;
|
FeedReader *m_feedReader;
|
||||||
|
|
||||||
// This read-write lock is used by application on its close.
|
// This read-write lock is used by application on its close.
|
||||||
|
|
Loading…
Add table
Reference in a new issue