Changeset 14624
- Timestamp:
- Dec 16, 2015, 8:01:03 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMakeLists.txt
r14622 r14624 224 224 set(QT_TARGETS) 225 225 if(USE_QT5) 226 set(QT5_REQUIRED_MODULES Core Gui Widgets Network DBus LinguistTools) 226 set(QT5_REQUIRED_MODULES Core Gui Widgets Network LinguistTools) 227 set(QT5_OPTIONAL_MODULES DBus AxContainer AxServer) 227 228 foreach(M ${QT5_REQUIRED_MODULES}) 228 229 find_package(Qt5${M} QUIET) … … 236 237 endif() 237 238 endforeach() 239 if(QT_TARGETS) 240 foreach(M ${QT5_OPTIONAL_MODULES}) 241 find_package(Qt5${M} QUIET) 242 if(Qt5${M}_FOUND) 243 list(APPEND QT_TARGETS Qt5::${M}) 244 endif() 245 endforeach() 246 endif() 238 247 else() 239 set(QT4_REQUIRED_MODULES QtCore QtGui QtNetwork QtDBus) 240 find_package(Qt4 4.6.2 QUIET COMPONENTS ${QT4_REQUIRED_MODULES}) 248 set(QT4_REQUIRED_MODULES QtCore QtGui QtNetwork) 249 set(QT4_OPTIONAL_MODULES QtDBus QAxContainer QAxServer) 250 find_package(Qt4 4.6.2 QUIET COMPONENTS ${QT4_REQUIRED_MODULES} OPTIONAL_COMPONENTS ${QT4_OPTIONAL_MODULES}) 241 251 foreach(M ${QT4_REQUIRED_MODULES}) 242 252 string(TOUPPER "${M}" M_UPPER) … … 248 258 endif() 249 259 endforeach() 260 if (QT_TARGETS) 261 foreach(M ${QT4_OPTIONAL_MODULES}) 262 string(TOUPPER "${M}" M_UPPER) 263 if(QT_${M_UPPER}_FOUND) 264 list(APPEND QT_TARGETS Qt4::${M}) 265 endif() 266 endforeach() 267 endif() 250 268 endif() 251 269 -
trunk/qt/Application.cc
r14621 r14624 11 11 #include <iostream> 12 12 13 #include <QDBusConnection>14 #include <QDBusMessage>15 #include <QDBusReply>16 13 #include <QIcon> 17 14 #include <QLibraryInfo> … … 21 18 #include <QSystemTrayIcon> 22 19 20 #ifdef QT_DBUS_LIB 21 #include <QDBusConnection> 22 #include <QDBusMessage> 23 #include <QDBusReply> 24 #endif 25 23 26 #include <libtransmission/transmission.h> 24 27 #include <libtransmission/tr-getopt.h> … … 28 31 #include "AddData.h" 29 32 #include "Application.h" 30 #include "DBusInteropHelper.h"31 33 #include "Formatter.h" 34 #include "InteropHelper.h" 32 35 #include "MainWindow.h" 33 36 #include "OptionsDialog.h" … … 158 161 // try to delegate the work to an existing copy of Transmission 159 162 // before starting ourselves... 160 DBusInteropHelper interopClient;163 InteropHelper interopClient; 161 164 if (interopClient.isConnected ()) 162 165 { … … 176 179 } 177 180 178 if (metainfo.isEmpty ()) 179 continue; 180 181 const QVariant result = interopClient.addMetainfo (metainfo); 182 if (result.isValid () && result.toBool ()) 181 if (!metainfo.isEmpty () && interopClient.addMetainfo (metainfo)) 183 182 delegated = true; 184 183 } … … 295 294 addTorrent (filename); 296 295 297 DBusInteropHelper::registerObject (this);296 InteropHelper::registerObject (this); 298 297 } 299 298 … … 543 542 Application::notifyApp (const QString& title, const QString& body) const 544 543 { 544 #ifdef QT_DBUS_LIB 545 545 const QLatin1String dbusServiceName ("org.freedesktop.Notifications"); 546 546 const QLatin1String dbusInterfaceName ("org.freedesktop.Notifications"); … … 565 565 return true; 566 566 } 567 #endif 567 568 568 569 myWindow->trayIcon ().showMessage (title, body); … … 583 584 char * argv[]) 584 585 { 586 InteropHelper::initialize (); 587 585 588 Application app (argc, argv); 586 589 return app.exec (); -
trunk/qt/CMakeLists.txt
r14623 r14624 21 21 qt4_add_translation(${ARGN}) 22 22 endmacro() 23 endif() 24 25 set(ENABLE_COM_INTEROP OFF) 26 if(MSVC AND ((Qt5AxContainer_FOUND AND Qt5AxServer_FOUND) OR (QT_QAXCONTAINER_FOUND AND QT_QAXSERVER_FOUND))) 27 set(ENABLE_COM_INTEROP ON) 28 endif() 29 30 set(ENABLE_DBUS_INTEROP OFF) 31 if(Qt5DBus_FOUND OR QT_QTDBUS_FOUND) 32 set(ENABLE_DBUS_INTEROP ON) 33 endif() 34 35 if(NOT ENABLE_COM_INTEROP AND NOT ENABLE_DBUS_INTEROP) 36 message(FATAL_ERROR "Neither D-Bus nor COM interop is possible") 23 37 endif() 24 38 … … 28 42 Application.cc 29 43 ColumnResizer.cc 44 ComInteropHelper.cc 30 45 DBusInteropHelper.cc 31 46 DetailsDialog.cc … … 43 58 FreeSpaceLabel.cc 44 59 IconToolButton.cc 60 InteropHelper.cc 45 61 InteropObject.cc 46 62 LicenseDialog.cc … … 70 86 ) 71 87 88 if (NOT ENABLE_COM_INTEROP) 89 set_source_files_properties(ComInteropHelper.cc PROPERTIES HEADER_FILE_ONLY ON) 90 endif() 91 if (NOT ENABLE_DBUS_INTEROP) 92 set_source_files_properties(DBusInteropHelper.cc PROPERTIES HEADER_FILE_ONLY ON) 93 endif() 94 72 95 set(${PROJECT_NAME}_HEADERS 73 96 AboutDialog.h … … 76 99 BaseDialog.h 77 100 ColumnResizer.h 101 ComInteropHelper.h 78 102 CustomVariantType.h 79 103 DBusInteropHelper.h … … 92 116 FreeSpaceLabel.h 93 117 IconToolButton.h 118 InteropHelper.h 94 119 InteropObject.h 95 120 LicenseDialog.h … … 183 208 ) 184 209 185 add_definitions(186 "-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_FULL_DATADIR}/${TR_NAME}/translations\""187 -DQT_NO_CAST_FROM_ASCII188 )189 190 210 tr_win32_app_info(${PROJECT_NAME}_WIN32_RC_FILE 191 211 "Transmission Qt Client" … … 193 213 "transmission-qt.exe" 194 214 "qtr.ico") 215 216 if(ENABLE_COM_INTEROP) 217 find_program(MIDL_EXECUTABLE midl) 218 add_custom_command( 219 OUTPUT 220 ${CMAKE_CURRENT_BINARY_DIR}/transmission-qt.tlb 221 COMMAND 222 ${MIDL_EXECUTABLE} /tlb ${CMAKE_CURRENT_BINARY_DIR}/transmission-qt.tlb transmission-qt.idl 223 DEPENDS 224 transmission-qt.idl 225 WORKING_DIRECTORY 226 ${CMAKE_CURRENT_SOURCE_DIR} 227 ) 228 list(APPEND ${PROJECT_NAME}_WIN32_RC_FILE transmission-qt.tlb.rc transmission-qt.idl ${CMAKE_CURRENT_BINARY_DIR}/transmission-qt.tlb) 229 set_source_files_properties(transmission-qt.idl ${CMAKE_CURRENT_BINARY_DIR}/transmission-qt.tlb PROPERTIES HEADER_FILE_ONLY ON) 230 endif() 195 231 196 232 add_executable(${TR_NAME}-qt WIN32 … … 210 246 ) 211 247 248 target_compile_definitions(${TR_NAME}-qt PRIVATE 249 "TRANSLATIONS_DIR=\"${CMAKE_INSTALL_FULL_DATADIR}/${TR_NAME}/translations\"" 250 QT_NO_CAST_FROM_ASCII 251 $<$<BOOL:${ENABLE_COM_INTEROP}>:ENABLE_COM_INTEROP> 252 $<$<BOOL:${ENABLE_DBUS_INTEROP}>:ENABLE_DBUS_INTEROP>) 253 212 254 if(MSVC) 213 255 tr_append_target_property(${TR_NAME}-qt LINK_FLAGS "/ENTRY:mainCRTStartup") -
trunk/qt/InteropObject.h
r14621 r14624 16 16 { 17 17 Q_OBJECT 18 19 #ifdef ENABLE_DBUS_INTEROP 18 20 Q_CLASSINFO ("D-Bus Interface", "com.transmissionbt.Transmission") 21 #endif 22 23 #ifdef ENABLE_COM_INTEROP 24 Q_CLASSINFO ("ClassID", "{0e2c952c-0597-491f-ba26-249d7e6fab49}") 25 Q_CLASSINFO ("InterfaceID", "{9402f54f-4906-4f20-ad73-afcfeb5b228d}") 26 Q_CLASSINFO ("RegisterObject", "yes") 27 Q_CLASSINFO ("CoClassAlias", "QtClient") 28 Q_CLASSINFO ("Description", "Transmission Qt Client Class") 29 #endif 19 30 20 31 public:
Note: See TracChangeset
for help on using the changeset viewer.