summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-04-15 18:53:13 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-04-15 18:53:13 (GMT)
commit79d610f3c038acb65dfb2f5ccf59cd0b3ffeacf1 (patch)
tree1bbf520a77d334e3795a25d65a9b78ac3df588b9
parent59d973448045888d2ffa8e5cd949357d9c93ead3 (diff)
downloadswift-79d610f3c038acb65dfb2f5ccf59cd0b3ffeacf1.zip
swift-79d610f3c038acb65dfb2f5ccf59cd0b3ffeacf1.tar.bz2
Set a special X11 window resource name on the main dialog.
This allows users to tweak windowmanagers like FVWM based on the type of dialog of Swift.
-rw-r--r--Swift/Controllers/ApplicationInfo.h12
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp24
-rw-r--r--Swift/QtUI/QtMainWindow.cpp17
-rw-r--r--Swift/QtUI/QtSwift.cpp9
-rw-r--r--Swift/QtUI/QtUtilities.cpp30
-rw-r--r--Swift/QtUI/QtUtilities.h14
-rw-r--r--Swift/QtUI/SConscript1
7 files changed, 83 insertions, 24 deletions
diff --git a/Swift/Controllers/ApplicationInfo.h b/Swift/Controllers/ApplicationInfo.h
new file mode 100644
index 0000000..8e6db31
--- /dev/null
+++ b/Swift/Controllers/ApplicationInfo.h
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#define SWIFT_APPLICATION_NAME "Swift"
+
+#define SWIFT_ORGANIZATION_NAME "Swift"
+#define SWIFT_ORGANIZATION_DOMAIN "swift.im"
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 4637322..794f993 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -7,17 +7,8 @@
#include "QtLoginWindow.h"
#include <boost/bind.hpp>
-
-#include "Swift/Controllers/UIEvents/UIEventStream.h"
-#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
-#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
-#include "Swiften/Base/Platform.h"
-
-#include "QtAboutWidget.h"
-#include "QtSwiftUtil.h"
-#include "QtMainWindow.h"
-
#include <algorithm>
+#include <cassert>
#include <QApplication>
#include <QBoxLayout>
@@ -29,13 +20,24 @@
#include <QLabel>
#include <QMenuBar>
-#include <cassert>
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
+#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
+#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
+#include "Swiften/Base/Platform.h"
+
+#include "QtAboutWidget.h"
+#include "QtSwiftUtil.h"
+#include "QtMainWindow.h"
+#include "QtUtilities.h"
namespace Swift{
QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
uiEventStream_ = uiEventStream;
+
setWindowTitle("Swift");
+ QtUtilities::setX11Resource(this, "Main");
+
resize(200, 500);
setContentsMargins(0,0,0,0);
QWidget *centralWidget = new QWidget(this);
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index f8c9673..116f52e 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -6,15 +6,6 @@
#include "QtMainWindow.h"
-#include "QtAddContactDialog.h"
-#include "QtJoinMUCDialog.h"
-#include "QtSwiftUtil.h"
-#include "QtTabWidget.h"
-#include "Roster/QtTreeWidgetFactory.h"
-#include "Roster/QtTreeWidget.h"
-#include "Swift/Controllers/UIEvents/AddContactUIEvent.h"
-
-
#include <QBoxLayout>
#include <QComboBox>
#include <QLineEdit>
@@ -26,6 +17,14 @@
#include <QAction>
#include <QTabWidget>
+#include "QtAddContactDialog.h"
+#include "QtJoinMUCDialog.h"
+#include "QtSwiftUtil.h"
+#include "QtTabWidget.h"
+#include "Roster/QtTreeWidgetFactory.h"
+#include "Roster/QtTreeWidget.h"
+#include "Swift/Controllers/UIEvents/AddContactUIEvent.h"
+
namespace Swift {
QtMainWindow::QtMainWindow(UIEventStream* uiEventStream, QtTreeWidgetFactory *treeWidgetFactory) : QWidget() {
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index efe872f..258a7b6 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -27,6 +27,7 @@
#include "Swiften/Elements/Presence.h"
#include "Swiften/Client/Client.h"
#include "Swift/Controllers/MainController.h"
+#include "Swift/Controllers/ApplicationInfo.h"
#include "Swift/QtUI/BuildVersion.h"
#include "SwifTools/AutoUpdater/AutoUpdater.h"
#include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h"
@@ -46,14 +47,14 @@ QtSwift::QtSwift(bool netbookMode) : autoUpdater_(NULL) {
} else {
splitter_ = NULL;
}
- QCoreApplication::setApplicationName("Swift");
- QCoreApplication::setOrganizationName("Swift");
- QCoreApplication::setOrganizationDomain("swift.im");
+ QCoreApplication::setApplicationName(SWIFT_APPLICATION_NAME);
+ QCoreApplication::setOrganizationName(SWIFT_ORGANIZATION_NAME);
+ QCoreApplication::setOrganizationDomain(SWIFT_ORGANIZATION_DOMAIN);
QCoreApplication::setApplicationVersion(buildVersion);
tabs_ = new QtChatTabs();
settings_ = new QtSettingsProvider();
- application_ = new PlatformApplication("Swift");
+ application_ = new PlatformApplication(SWIFT_APPLICATION_NAME);
treeWidgetFactory_ = new QtTreeWidgetFactory();
systemTray_ = new QtSystemTray();
loginWindowFactory_ = new QtLoginWindowFactory(splitter_, systemTray_, settings_);
diff --git a/Swift/QtUI/QtUtilities.cpp b/Swift/QtUI/QtUtilities.cpp
new file mode 100644
index 0000000..11a3768
--- /dev/null
+++ b/Swift/QtUI/QtUtilities.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include "QtUtilities.h"
+
+#include <QWidget>
+#ifdef Q_WS_X11
+#include <QX11Info>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#endif
+
+#include "Swift/Controllers/ApplicationInfo.h"
+
+namespace QtUtilities {
+
+void setX11Resource(QWidget* widget, const QString& c) {
+#ifdef Q_WS_X11
+ char res_class[] = SWIFT_APPLICATION_NAME;
+ XClassHint hint;
+ hint.res_name = (QString(SWIFT_APPLICATION_NAME) + "-" + c).toUtf8().data();
+ hint.res_class = res_class;
+ XSetClassHint(widget->x11Info().display(), widget->winId(), &hint);
+#endif
+}
+
+}
diff --git a/Swift/QtUI/QtUtilities.h b/Swift/QtUI/QtUtilities.h
new file mode 100644
index 0000000..6e64d6e
--- /dev/null
+++ b/Swift/QtUI/QtUtilities.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+class QWidget;
+class QString;
+
+namespace QtUtilities {
+ void setX11Resource(QWidget* widget, const QString& c);
+};
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index b82cb7b..345e7c3 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -72,6 +72,7 @@ sources = [
"QtTextEdit.cpp",
"QtXMLConsoleWidgetFactory.cpp",
"QtXMLConsoleWidget.cpp",
+ "QtUtilities.cpp",
"ChatSnippet.cpp",
"MessageSnippet.cpp",
"SystemMessageSnippet.cpp",