#include "downloadsettings.h"
#include "downloadmanager.h"
+#include "MainWindow.h"
DownloadSettings::DownloadSettings(QWidget *parent) : QWidget(parent) {
QSettings settings;
settings.setValue("downloadFolder", dir);
updateMessage();
- QMainWindow* mainWindow = dynamic_cast<QMainWindow*>(window());
- if (mainWindow) {
- QString status;
- status = tr("Download location changed.");
- if (DownloadManager::instance()->activeItems() > 0)
- status += " " + tr("Current downloads will still go in the previous location.");
- mainWindow->statusBar()->showMessage(status);
- }
+ QString status = tr("Download location changed.");
+ if (DownloadManager::instance()->activeItems() > 0)
+ status += " " + tr("Current downloads will still go in the previous location.");
+ MainWindow::instance()->showMessage(status);
}
}
namespace The {
- static QMap<QString, QAction*> *g_actions = 0;
-
QMap<QString, QAction*>* globalActions() {
+ static QMap<QString, QAction*> *g_actions = 0;
if (!g_actions)
g_actions = new QMap<QString, QAction*>;
return g_actions;
}
- static QMap<QString, QMenu*> *g_menus = 0;
-
QMap<QString, QMenu*>* globalMenus() {
+ static QMap<QString, QMenu*> *g_menus = 0;
if (!g_menus)
g_menus = new QMap<QString, QMenu*>;
return g_menus;
}
}
- static QNetworkAccessManager *nam = 0;
-
QNetworkAccessManager* networkAccessManager() {
+ static QNetworkAccessManager *nam = 0;
if (!nam) {
networkHttpProxySetting();
maybeSetSystemProxy();
return nam;
}
- static NetworkAccess *g_http = 0;
NetworkAccess* http() {
+ static NetworkAccess *g_http = 0;
if (!g_http) {
// qDebug() << "Creating NetworkAccess";
g_http = new NetworkAccess();
#include "constants.h"
#include "MainWindow.h"
#include "searchparams.h"
+#include "iconloader/qticonloader.h"
+#ifndef Q_WS_X11
+#include "extra.h"
+#endif
#ifdef Q_WS_MAC
#include "mac_startup.h"
-#include "macfullscreen.h"
#endif
-#include "iconloader/qticonloader.h"
int main(int argc, char **argv) {
MainWindow::printHelp();
return 0;
}
-
if (app.sendMessage(message))
return 0;
#ifndef APP_WIN
app.setWheelScrollLines(1);
#endif
+ app.setAttribute(Qt::AA_DontShowIconsInMenus);
-#ifdef APP_MAC
- app.setAttribute(Qt::AA_NativeWindows);
- QFile file(":/mac.css");
- file.open(QFile::ReadOnly);
- app.setStyleSheet(QLatin1String(file.readAll()));
-#endif
-
-#ifdef APP_WIN
- QFile file(":/win.css");
- file.open(QFile::ReadOnly);
- app.setStyleSheet(QLatin1String(file.readAll()));
+#ifndef Q_WS_X11
+ Extra::appSetup(&app);
#endif
const QString locale = QLocale::system().name();
MainWindow mainWin;
mainWin.setWindowTitle(Constants::NAME);
-#ifdef Q_WS_MAC
- app.setQuitOnLastWindowClosed(false);
- mac::SetupFullScreenWindow(mainWin.winId());
+#ifndef Q_WS_X11
+ Extra::windowSetup(&mainWin);
#endif
// no window icon on Mac
mainWin.setWindowIcon(appIcon);
#endif
-#ifdef APP_WIN
- app.setFont(QFont("Segoe UI", 9));
-#endif
-
mainWin.show();
mainWin.connect(&app, SIGNAL(messageReceived(const QString &)), &mainWin, SLOT(messageReceived(const QString &)));
update();
// status tip
- QMainWindow* mainWindow = dynamic_cast<QMainWindow*>(window());
- if (mainWindow) mainWindow->statusBar()->showMessage(action->statusTip());
+ static_cast<QMainWindow*>(window())->statusBar()->showMessage(action->statusTip());
}
}
void SegmentedControl::leaveEvent(QEvent *event) {
QWidget::leaveEvent(event);
// status tip
- QMainWindow* mainWindow = dynamic_cast<QMainWindow*>(window());
- if (mainWindow) mainWindow->statusBar()->clearMessage();
+ static_cast<QMainWindow*>(window())->statusBar()->clearMessage();
d->hoveredAction = 0;
d->pressedAction = 0;
update();