summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2017-11-24 23:24:09 +0000
committerThomas Preud'homme <robotux@celest.fr>2017-11-24 23:24:09 +0000
commitb3c8bdcc0d1e4b2ab298847a7902b6d60410a5bc (patch)
tree8fce8a51adfb245db8ab2a76831661780c0c713e
parente297dbd8052ef4e66f069e2dd1865ae7fa8af28e (diff)
New upstream version 1.2.3.6
-rw-r--r--AuthPlugin.cpp123
-rw-r--r--AuthPlugin.h46
-rw-r--r--CliParser.cpp295
-rw-r--r--CliParser.h46
-rw-r--r--CompilerInfo.h2
-rw-r--r--CopyEngineManager.cpp620
-rw-r--r--CopyEngineManager.h144
-rw-r--r--[-rwxr-xr-x]CopyListener.cpp657
-rw-r--r--[-rwxr-xr-x]CopyListener.h196
-rw-r--r--[-rwxr-xr-x]Core.cpp1790
-rw-r--r--Core.h320
-rw-r--r--DebugEngine.cpp627
-rw-r--r--DebugEngine.h177
-rw-r--r--DebugEngineMacro.h20
-rw-r--r--DebugModel.cpp158
-rw-r--r--Environment.h10
-rw-r--r--EventDispatcher.cpp665
-rw-r--r--EventDispatcher.h116
-rw-r--r--ExtraSocket.cpp66
-rw-r--r--ExtraSocket.h16
-rw-r--r--FacilityEngine.cpp339
-rw-r--r--FacilityEngine.h88
-rw-r--r--GlobalClass.cpp40
-rw-r--r--GlobalClass.h44
-rw-r--r--HelpDialog.cpp233
-rw-r--r--HelpDialog.h50
-rw-r--r--HelpDialog.ui38
-rw-r--r--InternetUpdater.cpp112
-rw-r--r--InternetUpdater.h33
-rw-r--r--[-rwxr-xr-x]LanguagesManager.cpp468
-rw-r--r--LanguagesManager.h101
-rw-r--r--LocalListener.cpp455
-rw-r--r--LocalListener.h69
-rw-r--r--LocalPluginOptions.cpp54
-rw-r--r--LocalPluginOptions.h33
-rw-r--r--LogThread.cpp397
-rw-r--r--LogThread.h104
-rw-r--r--OSSpecific.cpp62
-rw-r--r--OSSpecific.h29
-rw-r--r--OSSpecific.ui108
-rw-r--r--[-rwxr-xr-x]OptionDialog.cpp2332
-rw-r--r--[-rwxr-xr-x]OptionDialog.h194
-rw-r--r--OptionDialog.ui193
-rw-r--r--OptionEngine.cpp361
-rw-r--r--OptionEngine.h104
-rw-r--r--PlatformMacro.h2
-rw-r--r--PluginInformation.cpp174
-rw-r--r--PluginInformation.h40
-rw-r--r--[-rwxr-xr-x]PluginLoader.cpp440
-rw-r--r--[-rwxr-xr-x]PluginLoader.h83
-rw-r--r--PluginsManager.cpp1562
-rw-r--r--PluginsManager.h215
-rw-r--r--README7
-rw-r--r--ResourcesManager.cpp318
-rw-r--r--ResourcesManager.h71
-rw-r--r--SessionLoader.cpp242
-rw-r--r--SessionLoader.h64
-rw-r--r--Singleton.h52
-rw-r--r--StructEnumDefinition.h140
-rw-r--r--StructEnumDefinition_UltracopierSpecific.h2
-rw-r--r--SystrayIcon.cpp826
-rw-r--r--SystrayIcon.h211
-rw-r--r--ThemesManager.cpp437
-rw-r--r--ThemesManager.h118
-rw-r--r--Variable.h30
-rw-r--r--interface/FacilityInterface.h46
-rw-r--r--interface/OptionInterface.h29
-rw-r--r--interface/PluginInterface_CopyEngine.h353
-rw-r--r--interface/PluginInterface_Listener.h62
-rw-r--r--interface/PluginInterface_PluginLoader.h35
-rw-r--r--interface/PluginInterface_SessionLoader.h33
-rw-r--r--interface/PluginInterface_Themes.h172
-rw-r--r--lib/qt-tar-xz/QTarDecode.cpp233
-rw-r--r--lib/qt-tar-xz/QTarDecode.h45
-rw-r--r--lib/qt-tar-xz/QXzDecode.cpp2
-rw-r--r--lib/qt-tar-xz/QXzDecode.h2
-rw-r--r--lib/qt-tar-xz/QXzDecodeThread.cpp2
-rw-r--r--lib/qt-tar-xz/QXzDecodeThread.h2
-rw-r--r--main.cpp156
-rw-r--r--patch/comercial/rsync-copy-engine.patch902
-rw-r--r--patch/opensource/KDE-Ultracopier.patch290
-rw-r--r--patch/opensource/options-with-pass.patch336
-rw-r--r--plugins-alternative/CopyEngine/Rsync/AvancedQFile.cpp94
-rw-r--r--plugins-alternative/CopyEngine/Rsync/AvancedQFile.h32
-rw-r--r--plugins-alternative/CopyEngine/Rsync/FilterRules.cpp193
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Filters.cpp456
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Filters.h44
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/ar/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/de/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/el/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/es/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/fr/translation.ts810
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/hi/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/id/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/it/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/ja/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/ko/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/nl/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/no/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/pl/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/pt/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/ru/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/th/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/tr/translation.ts806
-rw-r--r--plugins-alternative/CopyEngine/Rsync/Languages/zh/translation.ts806
-rwxr-xr-xplugins-alternative/CopyEngine/Rsync/ListThread.cpp1720
-rwxr-xr-xplugins-alternative/CopyEngine/Rsync/ListThread.h376
-rw-r--r--plugins-alternative/CopyEngine/Rsync/ListThread_InodeAction.cpp66
-rw-r--r--plugins-alternative/CopyEngine/Rsync/MkPath.cpp100
-rw-r--r--plugins-alternative/CopyEngine/Rsync/MkPath.h56
-rw-r--r--plugins-alternative/CopyEngine/Rsync/ReadThread.cpp597
-rw-r--r--plugins-alternative/CopyEngine/Rsync/ReadThread.h144
-rw-r--r--plugins-alternative/CopyEngine/Rsync/RenamingRules.cpp85
-rw-r--r--plugins-alternative/CopyEngine/Rsync/RenamingRules.h34
-rw-r--r--plugins-alternative/CopyEngine/Rsync/RmPath.cpp179
-rw-r--r--plugins-alternative/CopyEngine/Rsync/RmPath.h58
-rw-r--r--plugins-alternative/CopyEngine/Rsync/StructEnumDefinition_CopyEngine.h90
-rw-r--r--plugins-alternative/CopyEngine/Rsync/TransferThread.cpp1252
-rw-r--r--plugins-alternative/CopyEngine/Rsync/TransferThread.h221
-rw-r--r--plugins-alternative/CopyEngine/Rsync/WriteThread.cpp508
-rw-r--r--plugins-alternative/CopyEngine/Rsync/WriteThread.h138
-rw-r--r--plugins-alternative/CopyEngine/Rsync/copyEngine-collision-and-error.cpp565
-rwxr-xr-xplugins-alternative/CopyEngine/Rsync/copyEngine.cpp819
-rwxr-xr-xplugins-alternative/CopyEngine/Rsync/copyEngine.h362
-rw-r--r--plugins-alternative/CopyEngine/Rsync/copyEngine.pro82
-rw-r--r--plugins-alternative/CopyEngine/Rsync/debugDialog.cpp70
-rw-r--r--plugins-alternative/CopyEngine/Rsync/debugDialog.h40
-rw-r--r--plugins-alternative/CopyEngine/Rsync/debugDialog.ui100
-rwxr-xr-xplugins-alternative/CopyEngine/Rsync/documentation.dox42
-rw-r--r--plugins-alternative/CopyEngine/Rsync/factory.cpp420
-rw-r--r--plugins-alternative/CopyEngine/Rsync/factory.h96
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileErrorDialog.cpp95
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileErrorDialog.h45
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileExistsDialog.cpp189
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileExistsDialog.h58
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileIsSameDialog.cpp156
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileIsSameDialog.h56
-rw-r--r--plugins-alternative/CopyEngine/Rsync/fileIsSameDialog.ui192
-rw-r--r--plugins-alternative/CopyEngine/Rsync/folderExistsDialog.cpp143
-rw-r--r--plugins-alternative/CopyEngine/Rsync/folderExistsDialog.h54
-rw-r--r--plugins-alternative/CopyEngine/Rsync/options.ui328
-rw-r--r--plugins-alternative/CopyEngine/Rsync/resources/add.pngbin564 -> 0 bytes
-rw-r--r--plugins-alternative/CopyEngine/Rsync/resources/edit.pngbin563 -> 0 bytes
-rw-r--r--plugins-alternative/CopyEngine/Rsync/resources/filter.pngbin429 -> 0 bytes
-rw-r--r--plugins-alternative/CopyEngine/Rsync/resources/remove.pngbin722 -> 0 bytes
-rw-r--r--plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.cpp511
-rw-r--r--plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h91
-rw-r--r--plugins-alternative/PluginLoader/keybinding/DebugEngineMacro.h (renamed from plugins/CopyEngine/Ultracopier-0.3/DebugEngineMacro.h)7
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Environment.h (renamed from plugins/CopyEngine/Ultracopier-0.3/Environment.h)6
-rw-r--r--plugins-alternative/PluginLoader/keybinding/KeyBind.cpp11
-rw-r--r--plugins-alternative/PluginLoader/keybinding/KeyBind.h18
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/ar/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/de/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/el/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/en/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/es/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/fr/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/hi/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/hu/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/id/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/it/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/ja/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/ko/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/nl/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/no/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/pl/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/pt/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/ru/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/th/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/tr/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Languages/zh/translation.ts4
-rw-r--r--plugins-alternative/PluginLoader/keybinding/OptionsWidget.cpp55
-rw-r--r--plugins-alternative/PluginLoader/keybinding/OptionsWidget.h31
-rw-r--r--plugins-alternative/PluginLoader/keybinding/OptionsWidget.ui31
-rw-r--r--plugins-alternative/PluginLoader/keybinding/PlatformMacro.h1
-rw-r--r--plugins-alternative/PluginLoader/keybinding/StructEnumDefinition.h (renamed from plugins-alternative/CopyEngine/Rsync/StructEnumDefinition.h)0
-rw-r--r--plugins-alternative/PluginLoader/keybinding/Variable.h16
-rw-r--r--plugins-alternative/PluginLoader/keybinding/documentation.dox34
-rw-r--r--plugins-alternative/PluginLoader/keybinding/informations.xml27
-rw-r--r--plugins-alternative/PluginLoader/keybinding/plugin.json1
-rw-r--r--plugins-alternative/PluginLoader/keybinding/pluginLoader.cpp61
-rw-r--r--plugins-alternative/PluginLoader/keybinding/pluginLoader.h47
-rw-r--r--plugins-alternative/PluginLoader/keybinding/pluginLoader.pro50
-rw-r--r--plugins-alternative/PluginLoader/keybinding/pluginLoader.pro.user.3.3-pre1266
-rw-r--r--plugins-alternative/Themes/Clean/Languages/ar/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/de/translation.ts16
-rw-r--r--plugins-alternative/Themes/Clean/Languages/el/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/en/translation.ts55
-rw-r--r--plugins-alternative/Themes/Clean/Languages/es/translation.ts10
-rw-r--r--plugins-alternative/Themes/Clean/Languages/fr/translation.ts10
-rw-r--r--plugins-alternative/Themes/Clean/Languages/hi/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/hu/translation.ts55
-rw-r--r--plugins-alternative/Themes/Clean/Languages/id/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/it/translation.ts20
-rw-r--r--plugins-alternative/Themes/Clean/Languages/ja/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/ko/translation.ts10
-rw-r--r--plugins-alternative/Themes/Clean/Languages/nl/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/no/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/pl/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/ru/translation.ts10
-rw-r--r--plugins-alternative/Themes/Clean/Languages/th/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/tr/translation.ts4
-rw-r--r--plugins-alternative/Themes/Clean/Languages/zh/translation.ts4
-rw-r--r--[-rwxr-xr-x]plugins-alternative/Themes/Clean/documentation.dox6
-rw-r--r--plugins-alternative/Themes/Clean/factory.cpp89
-rw-r--r--plugins-alternative/Themes/Clean/factory.h42
-rw-r--r--plugins-alternative/Themes/Clean/informations.xml3
-rw-r--r--plugins-alternative/Themes/Clean/interface.cpp557
-rw-r--r--plugins-alternative/Themes/Clean/interface.h242
-rw-r--r--plugins-alternative/Themes/Clean/interface.pro31
-rw-r--r--plugins-alternative/Themes/Clean/interface.ui14
-rw-r--r--plugins-alternative/Themes/Clean/plugin.json1
-rw-r--r--plugins-alternative/Themes/Clean/resources.qrc2
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/informations.pngbin734 -> 841 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/systray_Caught_Unix.pngbin798 -> 1093 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/systray_Caught_Windows.pngbin563 -> 623 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin1007 -> 1296 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin664 -> 841 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin789 -> 754 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin551 -> 485 bytes
-rw-r--r--plugins-alternative/Themes/Clean/resources_unix.qrc4
-rw-r--r--plugins-alternative/Themes/Clean/resources_windows.qrc2
-rw-r--r--plugins-alternative/Themes/Supercopier/DebugEngineMacro.h28
-rw-r--r--plugins-alternative/Themes/Supercopier/Environment.h10
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/ar/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/de/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/el/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/en/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/es/translation.ts340
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/fr/translation.ts344
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/hi/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/hu/translation.ts328
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/id/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/it/translation.ts336
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/ja/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/ko/translation.ts336
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/nl/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/no/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/pl/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/pt/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/ru/translation.ts336
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/th/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/tr/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/Languages/zh/translation.ts324
-rw-r--r--plugins-alternative/Themes/Supercopier/StructEnumDefinition.h (renamed from plugins/CopyEngine/Ultracopier-0.3/StructEnumDefinition.h)0
-rw-r--r--plugins-alternative/Themes/Supercopier/TransferModel.cpp569
-rw-r--r--plugins-alternative/Themes/Supercopier/TransferModel.h96
-rw-r--r--plugins-alternative/Themes/Supercopier/Variable.h15
-rw-r--r--plugins-alternative/Themes/Supercopier/documentation.dox33
-rw-r--r--plugins-alternative/Themes/Supercopier/factory.cpp441
-rw-r--r--plugins-alternative/Themes/Supercopier/factory.h83
-rw-r--r--plugins-alternative/Themes/Supercopier/informations.xml26
-rw-r--r--plugins-alternative/Themes/Supercopier/interface.cpp1332
-rw-r--r--plugins-alternative/Themes/Supercopier/interface.h221
-rw-r--r--plugins-alternative/Themes/Supercopier/interface.pro59
-rw-r--r--plugins-alternative/Themes/Supercopier/interface.ui845
-rw-r--r--plugins-alternative/Themes/Supercopier/interfaceResources.qrc24
-rw-r--r--plugins-alternative/Themes/Supercopier/interfaceResources_unix.qrc9
-rw-r--r--plugins-alternative/Themes/Supercopier/interfaceResources_windows.qrc9
-rw-r--r--plugins-alternative/Themes/Supercopier/plugin.json1
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/add.pngbin0 -> 246 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/exit.pngbin0 -> 545 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/informations.pngbin0 -> 281 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/options.pngbin0 -> 275 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Bottom_Progress_Unix.pngbin0 -> 95 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Bottom_Progress_Windows.pngbin0 -> 93 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Caught_Unix.pngbin0 -> 147 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Caught_Windows.pngbin0 -> 148 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin0 -> 147 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin0 -> 148 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Top_Progress_Unix.pngbin0 -> 95 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Top_Progress_Windows.pngbin0 -> 93 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin0 -> 141 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin0 -> 139 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/add.pngbin0 -> 240 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/cancel.pngbin0 -> 284 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/export-transfer-list.pngbin0 -> 264 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/import-transfer-list.pngbin0 -> 316 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/main.pngbin0 -> 148 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/moveDown.pngbin0 -> 191 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/moveUp.pngbin0 -> 190 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/player_end.pngbin0 -> 226 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/player_pause.pngbin0 -> 207 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/player_play.pngbin0 -> 208 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/progressbarleft.pngbin0 -> 133 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/progressbarright.pngbin0 -> 132 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/putOnBottom.pngbin0 -> 206 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/putOnTop.pngbin0 -> 208 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/remove.pngbin0 -> 254 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/resources/search.pngbin0 -> 237 bytes
-rw-r--r--plugins-alternative/Themes/Supercopier/themesOptions.ui384
-rw-r--r--plugins-alternative/Themes/Teracopy/DebugEngineMacro.h7
-rw-r--r--plugins-alternative/Themes/Teracopy/Environment.h3
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/ar/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/de/translation.ts26
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/el/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/en/translation.ts89
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/es/translation.ts14
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/fr/translation.ts9
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/hi/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/hu/translation.ts93
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/id/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/it/translation.ts26
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/ja/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/ko/translation.ts6
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/nl/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/no/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/pl/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/ru/translation.ts14
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/th/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/tr/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/Languages/zh/translation.ts8
-rw-r--r--plugins-alternative/Themes/Teracopy/TransferModel.cpp841
-rw-r--r--plugins-alternative/Themes/Teracopy/TransferModel.h120
-rw-r--r--plugins-alternative/Themes/Teracopy/Variable.h3
-rw-r--r--[-rwxr-xr-x]plugins-alternative/Themes/Teracopy/documentation.dox6
-rw-r--r--plugins-alternative/Themes/Teracopy/factory.cpp107
-rw-r--r--plugins-alternative/Themes/Teracopy/factory.h38
-rw-r--r--plugins-alternative/Themes/Teracopy/informations.xml3
-rw-r--r--plugins-alternative/Themes/Teracopy/interface.cpp695
-rw-r--r--plugins-alternative/Themes/Teracopy/interface.h289
-rw-r--r--plugins-alternative/Themes/Teracopy/interface.pro31
-rw-r--r--plugins-alternative/Themes/Teracopy/interface.ui14
-rw-r--r--plugins-alternative/Themes/Teracopy/plugin.json1
-rw-r--r--plugins-alternative/Themes/Teracopy/resources.qrc2
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/add.pngbin564 -> 552 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/exit.pngbin775 -> 874 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/informations.pngbin734 -> 841 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/options.pngbin660 -> 624 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/systray_Caught_Unix.pngbin798 -> 1093 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/systray_Caught_Windows.pngbin563 -> 623 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin1007 -> 1296 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin664 -> 841 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin789 -> 754 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin551 -> 485 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/checkbox.pngbin654 -> 619 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/main.pngbin563 -> 623 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/player_pause.pngbin484 -> 640 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources/player_play.pngbin501 -> 673 bytes
-rw-r--r--plugins-alternative/Themes/Teracopy/resources_unix.qrc4
-rw-r--r--plugins-alternative/Themes/Teracopy/resources_windows.qrc2
-rw-r--r--plugins-alternative/Themes/Windows/DebugEngineMacro.h28
-rw-r--r--plugins-alternative/Themes/Windows/Environment.h10
-rw-r--r--plugins-alternative/Themes/Windows/Languages/ar/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/de/translation.ts124
-rw-r--r--plugins-alternative/Themes/Windows/Languages/el/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/en/translation.ts124
-rw-r--r--plugins-alternative/Themes/Windows/Languages/es/translation.ts124
-rw-r--r--plugins-alternative/Themes/Windows/Languages/fr/translation.ts124
-rw-r--r--plugins-alternative/Themes/Windows/Languages/hi/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/hu/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/id/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/it/translation.ts125
-rw-r--r--plugins-alternative/Themes/Windows/Languages/ja/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/ko/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/nl/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/no/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/pl/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/ru/translation.ts127
-rw-r--r--plugins-alternative/Themes/Windows/Languages/th/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/tr/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/Languages/zh/translation.ts121
-rw-r--r--plugins-alternative/Themes/Windows/StructEnumDefinition.h1
-rw-r--r--plugins-alternative/Themes/Windows/TransferModel.cpp286
-rw-r--r--plugins-alternative/Themes/Windows/TransferModel.h90
-rw-r--r--plugins-alternative/Themes/Windows/Variable.h15
-rw-r--r--plugins-alternative/Themes/Windows/documentation.dox29
-rw-r--r--plugins-alternative/Themes/Windows/factory.cpp74
-rw-r--r--plugins-alternative/Themes/Windows/factory.h45
-rw-r--r--plugins-alternative/Themes/Windows/informations.xml26
-rw-r--r--plugins-alternative/Themes/Windows/interface.cpp414
-rw-r--r--plugins-alternative/Themes/Windows/interface.h165
-rw-r--r--plugins-alternative/Themes/Windows/interface.pro48
-rw-r--r--plugins-alternative/Themes/Windows/interface.ui415
-rw-r--r--plugins-alternative/Themes/Windows/plugin.json1
-rw-r--r--plugins-alternative/Themes/Windows/resources.qrc10
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/informations.pngbin0 -> 841 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/systray_Caught_Unix.pngbin0 -> 1093 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/systray_Caught_Windows.pngbin0 -> 623 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin0 -> 1296 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin0 -> 841 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin0 -> 754 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin0 -> 485 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/arrow-down.pngbin0 -> 598 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/arrow-up.pngbin0 -> 602 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/empty.pngbin0 -> 95 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/icon-top.pngbin0 -> 2437 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/icon-top.xcfbin0 -> 4398 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources/icon.pngbin0 -> 379 bytes
-rw-r--r--plugins-alternative/Themes/Windows/resources_unix.qrc7
-rw-r--r--plugins-alternative/Themes/Windows/resources_windows.qrc7
-rw-r--r--plugins-alternative/static-plugins-supercopier.qrc6
-rw-r--r--plugins/CopyEngine/Rsync/Rsync.pro2
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/AvancedQFile.cpp94
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/AvancedQFile.h32
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/CompilerInfo.h1
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/FilterRules.cpp193
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/FilterRules.h46
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/FilterRules.ui162
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Filters.cpp456
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Filters.h44
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Filters.ui194
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/ar/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/de/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/el/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/es/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/fr/translation.ts799
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/hi/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/id/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/it/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/ja/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/ko/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/nl/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/no/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/pl/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/pt/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/ru/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/th/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/tr/translation.ts795
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Languages/zh/translation.ts795
-rwxr-xr-xplugins/CopyEngine/Ultracopier-0.3/ListThread.cpp1689
-rwxr-xr-xplugins/CopyEngine/Ultracopier-0.3/ListThread.h370
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/ListThread_InodeAction.cpp58
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/MkPath.cpp100
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/MkPath.h56
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/ReadThread.cpp597
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/ReadThread.h144
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/RenamingRules.cpp85
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/RenamingRules.h34
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/RenamingRules.ui129
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/RmPath.cpp127
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/RmPath.h56
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/StructEnumDefinition_CopyEngine.h90
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/TransferThread.cpp1245
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/TransferThread.h218
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/Variable.h35
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/WriteThread.cpp508
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/WriteThread.h138
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/copyEngine-collision-and-error.cpp565
-rwxr-xr-xplugins/CopyEngine/Ultracopier-0.3/copyEngine.cpp796
-rwxr-xr-xplugins/CopyEngine/Ultracopier-0.3/copyEngine.h359
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/copyEngine.pro82
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/debugDialog.cpp70
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/debugDialog.h40
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/factory.cpp407
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/factory.h95
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileErrorDialog.cpp95
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileErrorDialog.h45
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileErrorDialog.ui220
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileExistsDialog.cpp189
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileExistsDialog.h58
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileExistsDialog.ui367
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileIsSameDialog.cpp156
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/fileIsSameDialog.h56
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/folderExistsDialog.cpp143
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/folderExistsDialog.h54
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/folderExistsDialog.ui282
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/options.ui314
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/resources.qrc8
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/resources/add.pngbin564 -> 0 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/resources/edit.pngbin563 -> 0 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/resources/filter.pngbin429 -> 0 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/resources/remove.pngbin722 -> 0 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/scanFileOrFolder.cpp460
-rw-r--r--plugins/CopyEngine/Ultracopier-0.3/scanFileOrFolder.h87
-rw-r--r--plugins/CopyEngine/Ultracopier/AvancedQFile.cpp208
-rw-r--r--plugins/CopyEngine/Ultracopier/AvancedQFile.h45
-rw-r--r--plugins/CopyEngine/Ultracopier/CompilerInfo.h (renamed from plugins-alternative/CopyEngine/Rsync/CompilerInfo.h)0
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngine-collision-and-error.cpp567
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngine.cpp1238
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngine.h381
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngine.pro101
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp692
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngineFactory.h132
-rw-r--r--plugins/CopyEngine/Ultracopier/DebugDialog.cpp44
-rw-r--r--plugins/CopyEngine/Ultracopier/DebugDialog.h39
-rw-r--r--plugins/CopyEngine/Ultracopier/DebugEngineMacro.h (renamed from plugins-alternative/CopyEngine/Rsync/DebugEngineMacro.h)7
-rw-r--r--plugins/CopyEngine/Ultracopier/DiskSpace.cpp53
-rw-r--r--plugins/CopyEngine/Ultracopier/DiskSpace.h28
-rw-r--r--plugins/CopyEngine/Ultracopier/DiskSpace.ui68
-rw-r--r--plugins/CopyEngine/Ultracopier/DriveManagement.cpp102
-rw-r--r--plugins/CopyEngine/Ultracopier/DriveManagement.h34
-rw-r--r--plugins/CopyEngine/Ultracopier/Environment.h (renamed from plugins-alternative/CopyEngine/Rsync/Environment.h)3
-rw-r--r--plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp163
-rw-r--r--plugins/CopyEngine/Ultracopier/FileErrorDialog.h51
-rw-r--r--plugins/CopyEngine/Ultracopier/FileExistsDialog.cpp238
-rw-r--r--plugins/CopyEngine/Ultracopier/FileExistsDialog.h60
-rw-r--r--plugins/CopyEngine/Ultracopier/FileIsSameDialog.cpp188
-rw-r--r--plugins/CopyEngine/Ultracopier/FileIsSameDialog.h57
-rw-r--r--plugins/CopyEngine/Ultracopier/FilterRules.cpp193
-rw-r--r--plugins/CopyEngine/Ultracopier/FilterRules.h (renamed from plugins-alternative/CopyEngine/Rsync/FilterRules.h)0
-rw-r--r--plugins/CopyEngine/Ultracopier/FilterRules.ui (renamed from plugins-alternative/CopyEngine/Rsync/FilterRules.ui)10
-rw-r--r--plugins/CopyEngine/Ultracopier/Filters.cpp457
-rw-r--r--plugins/CopyEngine/Ultracopier/Filters.h45
-rw-r--r--plugins/CopyEngine/Ultracopier/Filters.ui (renamed from plugins-alternative/CopyEngine/Rsync/Filters.ui)18
-rw-r--r--plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp199
-rw-r--r--plugins/CopyEngine/Ultracopier/FolderExistsDialog.h57
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/ar/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/de/translation.ts1294
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/el/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/en/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/es/translation.ts1305
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/fr/translation.ts1338
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/hi/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/hu/translation.ts1297
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/id/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/it/translation.ts1319
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/ja/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/ko/translation.ts1293
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/nl/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/no/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/pl/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/pt/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/ru/translation.ts1293
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/th/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/tr/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/zh/translation.ts1289
-rw-r--r--plugins/CopyEngine/Ultracopier/ListThread.cpp2379
-rw-r--r--plugins/CopyEngine/Ultracopier/ListThread.h431
-rw-r--r--plugins/CopyEngine/Ultracopier/ListThread_InodeAction.cpp64
-rw-r--r--plugins/CopyEngine/Ultracopier/MkPath.cpp516
-rw-r--r--plugins/CopyEngine/Ultracopier/MkPath.h106
-rw-r--r--plugins/CopyEngine/Ultracopier/ReadThread.cpp687
-rw-r--r--plugins/CopyEngine/Ultracopier/ReadThread.h147
-rw-r--r--plugins/CopyEngine/Ultracopier/RenamingRules.cpp85
-rw-r--r--plugins/CopyEngine/Ultracopier/RenamingRules.h34
-rw-r--r--plugins/CopyEngine/Ultracopier/RenamingRules.ui (renamed from plugins-alternative/CopyEngine/Rsync/RenamingRules.ui)0
-rw-r--r--plugins/CopyEngine/Ultracopier/ScanFileOrFolder.cpp677
-rw-r--r--plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h108
-rw-r--r--plugins/CopyEngine/Ultracopier/StructEnumDefinition.h1
-rw-r--r--plugins/CopyEngine/Ultracopier/StructEnumDefinition_CopyEngine.h124
-rw-r--r--plugins/CopyEngine/Ultracopier/TransferThread.cpp2081
-rw-r--r--plugins/CopyEngine/Ultracopier/TransferThread.h288
-rw-r--r--plugins/CopyEngine/Ultracopier/Variable.h (renamed from plugins-alternative/CopyEngine/Rsync/Variable.h)18
-rw-r--r--plugins/CopyEngine/Ultracopier/WriteThread.cpp967
-rw-r--r--plugins/CopyEngine/Ultracopier/WriteThread.h160
-rw-r--r--plugins/CopyEngine/Ultracopier/copyEngineOptions.ui762
-rw-r--r--plugins/CopyEngine/Ultracopier/copyEngineResources.qrc (renamed from plugins-alternative/CopyEngine/Rsync/resources.qrc)2
-rw-r--r--plugins/CopyEngine/Ultracopier/debugDialog.ui (renamed from plugins/CopyEngine/Ultracopier-0.3/debugDialog.ui)2
-rw-r--r--[-rwxr-xr-x]plugins/CopyEngine/Ultracopier/documentation.dox (renamed from plugins/CopyEngine/Ultracopier-0.3/documentation.dox)12
-rw-r--r--plugins/CopyEngine/Ultracopier/fileErrorDialog.ui (renamed from plugins-alternative/CopyEngine/Rsync/fileErrorDialog.ui)52
-rw-r--r--plugins/CopyEngine/Ultracopier/fileExistsDialog.ui (renamed from plugins-alternative/CopyEngine/Rsync/fileExistsDialog.ui)51
-rw-r--r--plugins/CopyEngine/Ultracopier/fileIsSameDialog.ui (renamed from plugins/CopyEngine/Ultracopier-0.3/fileIsSameDialog.ui)62
-rw-r--r--plugins/CopyEngine/Ultracopier/folderExistsDialog.ui (renamed from plugins-alternative/CopyEngine/Rsync/folderExistsDialog.ui)49
-rw-r--r--plugins/CopyEngine/Ultracopier/informations-rsync.xml (renamed from plugins-alternative/CopyEngine/Rsync/informations.xml)5
-rw-r--r--plugins/CopyEngine/Ultracopier/informations.xml (renamed from plugins/CopyEngine/Ultracopier-0.3/informations.xml)13
-rw-r--r--plugins/CopyEngine/Ultracopier/plugin.json1
-rw-r--r--plugins/CopyEngine/Ultracopier/resources/add.pngbin0 -> 552 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier/resources/edit.pngbin0 -> 623 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier/resources/filter.pngbin0 -> 685 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier/resources/remove.pngbin0 -> 683 bytes
-rw-r--r--plugins/Languages/ar/flag.pngbin992 -> 585 bytes
-rw-r--r--plugins/Languages/ar/informations.xml5
-rw-r--r--plugins/Languages/ar/translation.ts876
-rw-r--r--plugins/Languages/de/flag.pngbin753 -> 712 bytes
-rw-r--r--plugins/Languages/de/informations.xml5
-rw-r--r--plugins/Languages/de/translation.ts1169
-rw-r--r--plugins/Languages/el/flag.pngbin779 -> 726 bytes
-rw-r--r--plugins/Languages/el/informations.xml5
-rw-r--r--plugins/Languages/el/translation.ts876
-rw-r--r--plugins/Languages/es/flag.pngbin782 -> 726 bytes
-rw-r--r--plugins/Languages/es/informations.xml5
-rw-r--r--plugins/Languages/es/translation.ts1061
-rw-r--r--plugins/Languages/fr/flag.pngbin738 -> 699 bytes
-rw-r--r--plugins/Languages/fr/informations.xml9
-rw-r--r--plugins/Languages/fr/translation.ts1123
-rw-r--r--plugins/Languages/hi/flag.pngbin696 -> 728 bytes
-rw-r--r--plugins/Languages/hi/informations.xml5
-rw-r--r--plugins/Languages/hi/translation.ts876
-rw-r--r--plugins/Languages/hu/flag.pngbin0 -> 810 bytes
-rw-r--r--plugins/Languages/hu/informations.xml29
-rw-r--r--plugins/Languages/hu/translation.ts1412
-rw-r--r--plugins/Languages/id/flag.pngbin659 -> 691 bytes
-rw-r--r--plugins/Languages/id/informations.xml5
-rw-r--r--plugins/Languages/id/translation.ts876
-rw-r--r--plugins/Languages/it/flag.pngbin710 -> 675 bytes
-rw-r--r--plugins/Languages/it/informations.xml5
-rw-r--r--plugins/Languages/it/translation.ts1215
-rw-r--r--plugins/Languages/ja/flag.pngbin630 -> 595 bytes
-rw-r--r--plugins/Languages/ja/informations.xml5
-rw-r--r--plugins/Languages/ja/translation.ts886
-rw-r--r--plugins/Languages/ko/flag.pngbin744 -> 650 bytes
-rw-r--r--plugins/Languages/ko/informations.xml3
-rw-r--r--plugins/Languages/ko/translation.ts964
-rw-r--r--plugins/Languages/nl/flag.pngbin679 -> 709 bytes
-rw-r--r--plugins/Languages/nl/informations.xml5
-rw-r--r--plugins/Languages/nl/translation.ts876
-rw-r--r--plugins/Languages/no/flag.pngbin739 -> 715 bytes
-rw-r--r--plugins/Languages/no/informations.xml5
-rw-r--r--plugins/Languages/no/translation.ts876
-rw-r--r--plugins/Languages/pl/flag.pngbin703 -> 586 bytes
-rw-r--r--plugins/Languages/pl/informations.xml5
-rw-r--r--plugins/Languages/pl/translation.ts876
-rw-r--r--plugins/Languages/pt/flag.pngbin703 -> 686 bytes
-rw-r--r--plugins/Languages/pt/informations.xml5
-rw-r--r--plugins/Languages/pt/translation.ts876
-rw-r--r--plugins/Languages/ru/flag.pngbin676 -> 721 bytes
-rw-r--r--plugins/Languages/ru/informations.xml5
-rw-r--r--plugins/Languages/ru/translation.ts1003
-rw-r--r--plugins/Languages/th/flag.pngbin694 -> 731 bytes
-rw-r--r--plugins/Languages/th/informations.xml5
-rw-r--r--plugins/Languages/th/translation.ts876
-rw-r--r--plugins/Languages/tr/flag.pngbin672 -> 634 bytes
-rw-r--r--plugins/Languages/tr/informations.xml5
-rw-r--r--plugins/Languages/tr/translation.ts876
-rw-r--r--plugins/Languages/zh/flag.pngbin576 -> 538 bytes
-rw-r--r--plugins/Languages/zh/informations.xml5
-rw-r--r--plugins/Languages/zh/translation.ts886
-rw-r--r--plugins/Listener/catchcopy-v0002/DebugEngineMacro.h7
-rw-r--r--plugins/Listener/catchcopy-v0002/Environment.h3
-rw-r--r--plugins/Listener/catchcopy-v0002/Variable.h3
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp12
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.h3
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp47
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h17
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp1269
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h264
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/VariablesCatchcopy.h3
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/documentation.dox6
-rw-r--r--plugins/Listener/catchcopy-v0002/informations.xml3
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/listener.cpp127
-rw-r--r--[-rwxr-xr-x]plugins/Listener/catchcopy-v0002/listener.h79
-rw-r--r--plugins/Listener/catchcopy-v0002/listener.pro6
-rw-r--r--plugins/Listener/catchcopy-v0002/plugin.json1
-rw-r--r--plugins/Listener/dbus/Catchcopy.cpp6
-rw-r--r--plugins/Listener/dbus/Catchcopy.h8
-rw-r--r--plugins/Listener/dbus/DebugEngineMacro.h7
-rw-r--r--plugins/Listener/dbus/Environment.h3
-rw-r--r--plugins/Listener/dbus/Variable.h3
-rw-r--r--[-rwxr-xr-x]plugins/Listener/dbus/documentation.dox18
-rw-r--r--plugins/Listener/dbus/informations.xml3
-rw-r--r--[-rwxr-xr-x]plugins/Listener/dbus/listener.cpp99
-rw-r--r--[-rwxr-xr-x]plugins/Listener/dbus/listener.h65
-rw-r--r--plugins/Listener/dbus/listener.pro5
-rw-r--r--plugins/Listener/dbus/plugin.json1
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/DebugEngineMacro.h7
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/Environment.h3
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/ar/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/de/translation.ts8
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/el/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/en/translation.ts17
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/es/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/fr/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/hi/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/hu/translation.ts17
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/id/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/it/translation.ts9
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/ja/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/ko/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/nl/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/no/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/pl/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/pt/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/ru/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/th/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/tr/translation.ts5
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/zh/translation.ts5
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/OptionsWidget.cpp16
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/OptionsWidget.h0
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/OptionsWidget.ui3
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/Variable.h4
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/documentation.dox10
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/informations.xml3
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/plugin.json1
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp877
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/pluginLoader.h74
-rw-r--r--[-rwxr-xr-x]plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro35
-rw-r--r--plugins/SessionLoader/KDE4/DebugEngineMacro.h7
-rw-r--r--plugins/SessionLoader/KDE4/Environment.h3
-rw-r--r--plugins/SessionLoader/KDE4/Variable.h3
-rw-r--r--[-rwxr-xr-x]plugins/SessionLoader/KDE4/documentation.dox6
-rw-r--r--plugins/SessionLoader/KDE4/informations.xml3
-rw-r--r--plugins/SessionLoader/KDE4/plugin.json1
-rw-r--r--plugins/SessionLoader/KDE4/sessionLoader.cpp72
-rw-r--r--plugins/SessionLoader/KDE4/sessionLoader.h35
-rw-r--r--plugins/SessionLoader/KDE4/sessionLoader.pro4
-rw-r--r--plugins/SessionLoader/KDE4/sessionLoader.pro.user.2.7pre1208
-rw-r--r--plugins/SessionLoader/Windows/DebugEngineMacro.h7
-rw-r--r--plugins/SessionLoader/Windows/Environment.h3
-rw-r--r--plugins/SessionLoader/Windows/Variable.h3
-rw-r--r--[-rwxr-xr-x]plugins/SessionLoader/Windows/documentation.dox8
-rw-r--r--plugins/SessionLoader/Windows/informations.xml3
-rw-r--r--plugins/SessionLoader/Windows/plugin.json1
-rw-r--r--[-rwxr-xr-x]plugins/SessionLoader/Windows/sessionLoader.cpp99
-rw-r--r--[-rwxr-xr-x]plugins/SessionLoader/Windows/sessionLoader.h18
-rw-r--r--plugins/SessionLoader/Windows/sessionLoader.pro5
-rw-r--r--plugins/Themes/Oxygen/DebugEngineMacro.h7
-rw-r--r--plugins/Themes/Oxygen/Environment.h3
-rw-r--r--plugins/Themes/Oxygen/Languages/ar/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/de/translation.ts329
-rw-r--r--plugins/Themes/Oxygen/Languages/el/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/en/translation.ts329
-rw-r--r--plugins/Themes/Oxygen/Languages/es/translation.ts315
-rw-r--r--plugins/Themes/Oxygen/Languages/fr/translation.ts305
-rw-r--r--plugins/Themes/Oxygen/Languages/hi/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/hu/translation.ts329
-rw-r--r--plugins/Themes/Oxygen/Languages/id/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/it/translation.ts333
-rw-r--r--plugins/Themes/Oxygen/Languages/ja/translation.ts257
-rw-r--r--plugins/Themes/Oxygen/Languages/ko/translation.ts285
-rw-r--r--plugins/Themes/Oxygen/Languages/nl/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/no/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/pl/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/pt/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/ru/translation.ts317
-rw-r--r--plugins/Themes/Oxygen/Languages/th/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/tr/translation.ts263
-rw-r--r--plugins/Themes/Oxygen/Languages/zh/translation.ts257
-rw-r--r--plugins/Themes/Oxygen/ThemesFactory.cpp476
-rw-r--r--plugins/Themes/Oxygen/ThemesFactory.h86
-rw-r--r--plugins/Themes/Oxygen/TransferModel.cpp887
-rw-r--r--plugins/Themes/Oxygen/TransferModel.h119
-rw-r--r--plugins/Themes/Oxygen/Variable.h6
-rw-r--r--[-rwxr-xr-x]plugins/Themes/Oxygen/documentation.dox6
-rw-r--r--plugins/Themes/Oxygen/factory.cpp146
-rw-r--r--plugins/Themes/Oxygen/factory.h61
-rw-r--r--plugins/Themes/Oxygen/informations.xml3
-rw-r--r--[-rwxr-xr-x]plugins/Themes/Oxygen/interface.cpp1817
-rw-r--r--[-rwxr-xr-x]plugins/Themes/Oxygen/interface.h355
-rw-r--r--plugins/Themes/Oxygen/interface.pro56
-rw-r--r--plugins/Themes/Oxygen/interface.ui646
-rw-r--r--plugins/Themes/Oxygen/interfaceResources.qrc (renamed from plugins/Themes/Oxygen/resources.qrc)2
-rw-r--r--plugins/Themes/Oxygen/interfaceResources_unix.qrc (renamed from plugins/Themes/Oxygen/resources_unix.qrc)4
-rw-r--r--plugins/Themes/Oxygen/interfaceResources_windows.qrc (renamed from plugins/Themes/Oxygen/resources_windows.qrc)2
-rw-r--r--plugins/Themes/Oxygen/options.ui281
-rw-r--r--plugins/Themes/Oxygen/plugin.json1
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/add.pngbin564 -> 552 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/exit.pngbin775 -> 874 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/informations.pngbin734 -> 841 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/options.pngbin660 -> 624 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Unix.pngbin798 -> 1093 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Windows.pngbin563 -> 623 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin1007 -> 1174 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin664 -> 677 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin789 -> 665 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin551 -> 439 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/add.pngbin564 -> 552 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/cancel.pngbin775 -> 874 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/export-transfer-list.pngbin504 -> 455 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/import-transfer-list.pngbin481 -> 454 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/main.pngbin563 -> 623 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/moveDown.pngbin525 -> 466 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/moveUp.pngbin484 -> 466 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/player_end.pngbin506 -> 696 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/player_pause.pngbin484 -> 640 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/player_play.pngbin501 -> 673 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/putOnBottom.pngbin691 -> 676 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/putOnTop.pngbin650 -> 681 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/remove.pngbin722 -> 683 bytes
-rw-r--r--plugins/Themes/Oxygen/resources/search.pngbin808 -> 781 bytes
-rw-r--r--plugins/Themes/Oxygen/themesOptions.ui426
-rw-r--r--plugins/static-plugins-oxygen.qrc6
-rw-r--r--plugins/static-plugins-windows.qrc6
-rw-r--r--plugins/static-plugins.qrc12
-rw-r--r--resources/Languages/en/flag.pngbin779 -> 741 bytes
-rw-r--r--resources/Languages/en/informations.xml8
-rw-r--r--resources/Languages/en/translation.ts1383
-rw-r--r--resources/bug-128x128.pngbin12933 -> 6042 bytes
-rw-r--r--resources/document-encrypt.pngbin561 -> 0 bytes
-rw-r--r--resources/moveDown.pngbin525 -> 466 bytes
-rw-r--r--resources/moveUp.pngbin484 -> 466 bytes
-rw-r--r--resources/none-128x128.pngbin11200 -> 4942 bytes
-rw-r--r--resources/options.pngbin660 -> 624 bytes
-rw-r--r--resources/qt.conf2
-rw-r--r--resources/resources-windows-qt-plugin.qrc5
-rw-r--r--resources/resources-windows.rc19
-rw-r--r--resources/supercopier-128x128.pngbin0 -> 5041 bytes
-rw-r--r--resources/supercopier-16x16.pngbin0 -> 148 bytes
-rw-r--r--resources/supercopier-all-in-one.icobin0 -> 786 bytes
-rw-r--r--resources/supercopier.icnsbin0 -> 32304 bytes
-rw-r--r--resources/supercopier.icobin0 -> 1078 bytes
-rw-r--r--resources/systray_Caught_Unix.pngbin798 -> 1093 bytes
-rw-r--r--resources/systray_Caught_Windows.pngbin563 -> 623 bytes
-rw-r--r--resources/systray_Semiuncaught_Unix.pngbin1007 -> 1296 bytes
-rw-r--r--resources/systray_Semiuncaught_Windows.pngbin664 -> 841 bytes
-rw-r--r--resources/systray_Uncaught_Unix.pngbin789 -> 754 bytes
-rw-r--r--resources/systray_Uncaught_Windows.pngbin551 -> 485 bytes
-rw-r--r--resources/ultracopier-128x128.pngbin7440 -> 4928 bytes
-rw-r--r--resources/ultracopier-16x16.pngbin672 -> 685 bytes
-rw-r--r--resources/ultracopier-all-in-one.icobin0 -> 2594 bytes
-rw-r--r--resources/ultracopier-resources.qrc (renamed from resources/resources.qrc)3
-rw-r--r--resources/ultracopier-resources_unix.qrc (renamed from resources/resources_unix.qrc)0
-rw-r--r--resources/ultracopier-resources_windows.qrc (renamed from resources/resources_windows.qrc)0
-rw-r--r--resources/ultracopier.exe.amd64.manifest14
-rw-r--r--resources/ultracopier.exe.x86.manifest14
-rw-r--r--resources/warning.pngbin0 -> 511 bytes
-rw-r--r--static.pro33
-rw-r--r--supercopier-static.pro6
-rw-r--r--tools/unit-tester/copyEngine.cpp1386
-rw-r--r--tools/unit-tester/copyEngine.h263
-rw-r--r--tools/unit-tester/copyEngineUnitTester.cpp104
-rw-r--r--tools/unit-tester/copyEngineUnitTester.h46
-rw-r--r--tools/unit-tester/main.cpp8
-rw-r--r--tools/unit-tester/unit-tester.pro42
-rw-r--r--ultracopier-all-in-one-direct.pro119
-rw-r--r--ultracopier-core.pro (renamed from ultracopier.pro)70
-rw-r--r--ultracopier-static.pro6
-rw-r--r--[-rwxr-xr-x]ultracopier.dox6
798 files changed, 94943 insertions, 74011 deletions
diff --git a/AuthPlugin.cpp b/AuthPlugin.cpp
deleted file mode 100644
index fcea81c..0000000
--- a/AuthPlugin.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/** \file AuthPlugin.cpp
-\brief Define the authentication plugin
-\author alpha_one_x86
-\version 0.3
-\date 2010
-\copyright GNU Public License 3 (GPL3), see the file COPYING */
-
-#include <QDir>
-
-#include "AuthPlugin.h"
-
-AuthPlugin::AuthPlugin()
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- //load the overall instance
- stopIt=false;
- //set sem to 1
- sem.release();
- moveToThread(this);
-}
-
-AuthPlugin::~AuthPlugin()
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- stop();
-}
-
-QStringList AuthPlugin::getFileList(const QString &path)
-{
- QStringList list;
- QDir dir(path);
- if(dir.exists())
- {
- foreach(QString dirName, dir.entryList(QDir::Dirs|QDir::NoDotAndDotDot))
- list<<getFileList(path+dirName+QDir::separator());
- foreach(QString fileName, dir.entryList(QDir::Files|QDir::NoDotAndDotDot))
- list<<path+fileName;
- }
- return list;
-}
-
-void AuthPlugin::run()
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- sem.acquire();
- stopIt=false;
- foreach(QString basePath,readPath)
- {
- foreach(QString dirSub,searchPathPlugin)
- {
- QString pluginComposed=basePath+dirSub+QDir::separator();
- QDir dir(pluginComposed);
- if(dir.exists())
- {
- foreach(QString dirName, dir.entryList(QDir::Dirs|QDir::NoDotAndDotDot))
- {
- QString pluginBasePath = pluginComposed+dirName+QDir::separator();
- if(QFile::exists(pluginBasePath+"sign.key"))
- {
- QCryptographicHash folderHash(QCryptographicHash::Sha1);
- QStringList filesList=getFileList(pluginBasePath);
- if(stopIt)
- return;
- QFile keyDescriptor(pluginBasePath+"sign.key");
- if(keyDescriptor.open(QIODevice::ReadOnly))
- {
- if(stopIt)
- return;
- bool errorFound=false;
- foreach(QString fileToAddToCheckSum,filesList)
- if(fileToAddToCheckSum!=(pluginBasePath+"sign.key"))
- {
- QFile fileDescriptor(fileToAddToCheckSum);
- if(fileDescriptor.open(QIODevice::ReadOnly))
- {
- if(stopIt)
- return;
- folderHash.addData(fileDescriptor.readAll());
- fileDescriptor.close();
- if(stopIt)
- return;
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Error at open this file: "+fileToAddToCheckSum+", error string: "+fileDescriptor.errorString());
- errorFound=true;
- break;
- }
- }
- if(!errorFound)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"folder: \""+pluginBasePath+"\", hash: "+QString(folderHash.result().toHex()));
- QByteArray key=keyDescriptor.readAll();
- if(key==folderHash.result())
- emit authentifiedPath(pluginBasePath);
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"This plugin have wrong authentification");
- }
- keyDescriptor.close();
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file: \""+pluginBasePath+"sign.key\", unable to open the key file: "+keyDescriptor.errorString());
- }
- }
- }
- }
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"stop()");
- sem.release();
-}
-
-void AuthPlugin::loadSearchPath(const QStringList &readPath,const QStringList &searchPathPlugin)
-{
- this->readPath=readPath;
- this->searchPathPlugin=searchPathPlugin;
-}
-
-void AuthPlugin::stop()
-{
- stopIt=true;
- sem.acquire();
- sem.release();
-}
diff --git a/AuthPlugin.h b/AuthPlugin.h
deleted file mode 100644
index dda14ac..0000000
--- a/AuthPlugin.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/** \file AuthPlugin.h
-\brief Define the authentication plugin
-\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
-
-#ifndef AUTHPLUGIN_H
-#define AUTHPLUGIN_H
-
-#include <QThread>
-#include <QObject>
-#include <QSemaphore>
-#include <QStringList>
-#include <QString>
-#include <QCryptographicHash>
-
-#include "Environment.h"
-
-/** \brief allow authentify the plugin */
-class AuthPlugin : public QThread
-{
- Q_OBJECT
-public:
- AuthPlugin();
- ~AuthPlugin();
- /** \brief stop all action to close ultracopier */
- void stop();
- /** \brief add path to check
- \param readPath list of read place
- \param searchPathPlugin list of plugin place
- */
- void loadSearchPath(const QStringList &readPath,const QStringList &searchPathPlugin);
-protected:
- void run();
-private:
- bool stopIt;
- QSemaphore sem;
- QStringList readPath;
- QStringList searchPathPlugin;
- static QStringList getFileList(const QString &path);
-signals:
- void authentifiedPath(QString);
-};
-
-#endif // AUTHPLUGIN_H
diff --git a/CliParser.cpp b/CliParser.cpp
index 13aeac1..e2a9780 100644
--- a/CliParser.cpp
+++ b/CliParser.cpp
@@ -1,8 +1,6 @@
/** \file CliParser.cpp
\brief To group into one class, the CLI parsing
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "CliParser.h"
@@ -20,150 +18,165 @@ CliParser::CliParser(QObject *parent) :
*/
void CliParser::cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";"));
- if(ultracopierArguments.size()==1)
- {
- if(external)
- QMessageBox::warning(NULL,tr("Warning"),tr("Ultracopier is already running, right click on its system tray icon (near the clock) to use it"));
- // else do nothing, is normal starting without arguements
- return;
- }
- if(ultracopierArguments.size()==2)
- {
- if(ultracopierArguments.last()=="quit" && external)
- {
- if(onlyCheck)
- return;
- QCoreApplication::exit();
- return;
- }
- if(ultracopierArguments.last()=="--help")
- {
- showHelp(false);
- return;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Command line not understand");
- showHelp();
- return;
- }
- if(ultracopierArguments.size()==3)
- {
- if(ultracopierArguments[1]=="Transfer-list")
- {
- if(onlyCheck)
- return;
- QFile transferFile(ultracopierArguments.last());
- if(transferFile.open(QIODevice::ReadOnly))
- {
- QString content;
- QByteArray data=transferFile.readLine(64);
- if(data.size()<=0)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Problem at the reading, or file size is null"));
- QMessageBox::warning(NULL,tr("Warning"),tr("Problem at the reading, or file size is null"));
- transferFile.close();
- return;
- }
- content=QString::fromUtf8(data);
- content.remove('\n');
- QStringList transferListArguments=content.split(';');
- if(transferListArguments.size()!=4 || transferListArguments[0]!="Ultracopier-0.3" || transferListArguments[1]!="Transfer-list")
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("This file is not supported transfer list"));
- QMessageBox::warning(NULL,tr("Warning"),tr("This file is not supported transfer list"));
- transferFile.close();
- return;
- }
- transferFile.close();
- emit newTransferList(transferListArguments[3],transferListArguments[2],ultracopierArguments.last());
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Unable to open the transfer list file: %1").arg(transferFile.errorString()));
- QMessageBox::warning(NULL,tr("Warning"),tr("Unable to open the transfer list file"));
- return;
- }
- return;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Command line not understand");
- showHelp();
- return;
- }
- if(ultracopierArguments.size()>3)
- {
- if(ultracopierArguments[1]=="Copy" || ultracopierArguments[1]=="cp")
- {
- if(onlyCheck)
- return;
- QStringList transferList=ultracopierArguments;
- transferList.removeFirst();
- transferList.removeFirst();
- if(transferList.last()=="?")
- {
- transferList.removeLast();
- emit newCopy(transferList);
- }
- else
- {
- QString destination=transferList.last();
- transferList.removeLast();
- emit newCopy(transferList,destination);
- }
- return;
- }
- if(ultracopierArguments[1]=="Move" || ultracopierArguments[1]=="mv")
- {
- if(onlyCheck)
- return;
- QStringList transferList=ultracopierArguments;
- transferList.removeFirst();
- transferList.removeFirst();
- if(transferList.last()=="?")
- {
- transferList.removeLast();
- emit newMove(transferList);
- }
- else
- {
- QString destination=transferList.last();
- transferList.removeLast();
- emit newMove(transferList,destination);
- }
- return;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Command line not understand");
- showHelp();
- return;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Command line not understand");
- showHelp();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultracopierArguments: ")+ultracopierArguments.join(QStringLiteral(";")));
+ if(ultracopierArguments.size()==1)
+ {
+ if(external)
+ QMessageBox::warning(NULL,tr("Warning"),tr("Ultracopier is already running, right click on its system tray icon (near the clock) to use it"));
+ // else do nothing, is normal starting without arguements
+ return;
+ }
+ else if(ultracopierArguments.size()==2)
+ {
+ if(ultracopierArguments.last()==QStringLiteral("quit"))
+ {
+ if(onlyCheck)
+ return;
+ QCoreApplication::exit();
+ return;
+ }
+ else if(ultracopierArguments.last()==QStringLiteral("--help"))
+ {
+ showHelp(false);
+ return;
+ }
+ else if(ultracopierArguments.last()==QStringLiteral("--options"))
+ {
+ emit showOptions();
+ return;
+ }
+ else if(ultracopierArguments.last().endsWith(QStringLiteral(".urc")))
+ {
+ tryLoadPlugin(ultracopierArguments.last());
+ return;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Command line not understand");
+ showHelp();
+ return;
+ }
+ else if(ultracopierArguments.size()==3)
+ {
+ if(ultracopierArguments.at(1)==QStringLiteral("Transfer-list"))
+ {
+ if(onlyCheck)
+ return;
+ QFile transferFile(ultracopierArguments.last());
+ if(transferFile.open(QIODevice::ReadOnly))
+ {
+ QString content;
+ QByteArray data=transferFile.readLine(64);
+ if(data.size()<=0)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Problem reading file, or file size is 0"));
+ QMessageBox::warning(NULL,tr("Warning"),tr("Problem reading file, or file size is 0"));
+ transferFile.close();
+ return;
+ }
+ content=QString::fromUtf8(data);
+ QStringList transferListArguments=content.split(';');
+ transferListArguments[3].remove('\n');
+ if(transferListArguments.at(0)!="Ultracopier" ||
+ transferListArguments.at(1)!="Transfer-list" ||
+ (transferListArguments.at(2)!="Transfer" && transferListArguments.at(2)!="Copy" && transferListArguments.at(2)!="Move")
+ )
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("This file is not supported transfer list"));
+ QMessageBox::warning(NULL,tr("Warning"),tr("This file is not supported transfer list"));
+ transferFile.close();
+ return;
+ }
+ transferFile.close();
+ emit newTransferList(transferListArguments.at(3),transferListArguments.at(2),ultracopierArguments.last());
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to open the transfer list file: %1").arg(transferFile.errorString()));
+ QMessageBox::warning(NULL,tr("Warning"),tr("Unable to open the transfer list file"));
+ return;
+ }
+ return;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Command line not understand");
+ showHelp();
+ return;
+ }
+ else if(ultracopierArguments.size()>3)
+ {
+ if(ultracopierArguments.at(1)==QStringLiteral("Copy") || ultracopierArguments.at(1)==QStringLiteral("cp"))
+ {
+ if(onlyCheck)
+ return;
+ QStringList transferList=ultracopierArguments;
+ transferList.removeFirst();
+ transferList.removeFirst();
+ if(transferList.last()=="?")
+ {
+ transferList.removeLast();
+ emit newCopyWithoutDestination(transferList);
+ }
+ else
+ {
+ QString destination=transferList.last();
+ transferList.removeLast();
+ emit newCopy(transferList,destination);
+ }
+ return;
+ }
+ else if(ultracopierArguments.at(1)==QStringLiteral("Move") || ultracopierArguments.at(1)==QStringLiteral("mv"))
+ {
+ if(onlyCheck)
+ return;
+ QStringList transferList=ultracopierArguments;
+ transferList.removeFirst();
+ transferList.removeFirst();
+ if(transferList.last()=="?")
+ {
+ transferList.removeLast();
+ emit newMoveWithoutDestination(transferList);
+ }
+ else
+ {
+ QString destination=transferList.last();
+ transferList.removeLast();
+ emit newMove(transferList,destination);
+ }
+ return;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Command line not understand"));
+ showHelp();
+ return;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Command line not understand"));
+ showHelp();
}
/** \brief show the help
*\param incorrectArguments if the help is call because the arguments are wrong */
void CliParser::showHelp(const bool &incorrectArguments)
{
- if(incorrectArguments)
- qDebug() << "Incorrect arguments detected";
- qDebug() << tr("The arguments possibles are:");
- qDebug() << "--help : "+tr("To have this help");
- qDebug() << "quit : "+tr("To quit the other instance running (if have)");
- qDebug() << "Transfer-list [transfer list file] : "+tr("To pass transfer list to do");
- qDebug() << "cp [source [source2]] [destination] : "+tr("To copy sources separated by space to destination. If destination is \"?\", ultracopier will ask it to the user");
- qDebug() << "mv [source [source2]] [destination] : "+tr("Same as above, but with move");
+ if(incorrectArguments)
+ qDebug() << "Incorrect arguments detected";
+ qDebug() << tr("The arguments possible are:");
+ qDebug() << "--help : "+tr("To display this help");
+ qDebug() << "--options : "+tr("To display the options");
+ qDebug() << "quit : "+tr("To quit the other instances (if running)");
+ qDebug() << "Transfer-list [transfer list file] : "+tr("Open transfer list");
+ qDebug() << "cp [source [source2]] [destination] : "+tr("To copy sources to destination, separated by space. If destination is \"?\", ultracopier will ask the user");
+ qDebug() << "mv [source [source2]] [destination] : "+tr("To move sources to destination, separated by space. If destination is \"?\", ultracopier will ask the user");
- QString message;
- if(incorrectArguments)
- message+="<b>"+tr("Command line not understand")+"</b><br />\n";
- message+=+"<b></b>"+tr("The arguments possibles are:")+"\n<ul>";
- message+="<li><b>--help</b> : "+tr("To have this help")+"</li>\n";
- message+="<li><b>quit</b> : "+tr("To quit the other instance running (if have)")+"</li>\n";
- message+="<li><b>Transfer-list [transfer list file]</b> : "+tr("To pass transfer list to do")+"</li>\n";
- message+="<li><b>cp [source [source2]] [destination]</b> : "+tr("To copy sources separated by space to destination. If destination is \"?\", ultracopier will ask it to the user")+"</li>\n";
- message+="<li><b>mv [source [source2]] [destination]</b> : "+tr("Same as above, but with move")+"</li>\n";
- message+=+"</ul>";
- if(incorrectArguments)
- QMessageBox::warning(NULL,tr("Warning"),message);
- else
- QMessageBox::information(NULL,tr("Help"),message);
+ QString message;
+ if(incorrectArguments)
+ message+="<b>"+tr("Command not valid")+"</b><br />\n";
+ message+=+"<b></b>"+tr("The arguments possible are:")+"\n<ul>";
+ message+="<li><b>--help</b> : "+tr("To display this help")+"</li>\n";
+ message+="<li><b>--options</b> : "+tr("To display the options")+"</li>\n";
+ message+="<li><b>quit</b> : "+tr("To quit the other instances (if running)")+"</li>\n";
+ message+="<li><b>Transfer-list [transfer list file]</b> : "+tr("Open transfer list")+"</li>\n";
+ message+="<li><b>cp [source [source2]] [destination]</b> : "+tr("To copy sources to destination, separated by space. If destination is \"?\", ultracopier will ask the user")+"</li>\n";
+ message+="<li><b>mv [source [source2]] [destination]</b> : "+tr("To move sources to destination, separated by space. If destination is \"?\", ultracopier will ask the user")+"</li>\n";
+ message+=+"</ul>";
+ if(incorrectArguments)
+ QMessageBox::warning(NULL,tr("Warning"),message);
+ else
+ QMessageBox::information(NULL,tr("Help"),message);
}
diff --git a/CliParser.h b/CliParser.h
index 360f30e..a2f3617 100644
--- a/CliParser.h
+++ b/CliParser.h
@@ -1,8 +1,6 @@
/** \file CliParser.h
\brief To group into one class, the CLI parsing
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef CLIPARSER_H
@@ -18,30 +16,34 @@
/** \brief class to parse all command line options */
class CliParser : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit CliParser(QObject *parent = 0);
+ explicit CliParser(QObject *parent = 0);
public slots:
- /** \brief method to parse the ultracopier arguments
- \param ultracopierArguments the argument list
- \param external true if the arguments come from other instance of ultracopier
- */
- void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck);
+ /** \brief method to parse the ultracopier arguments
+ \param ultracopierArguments the argument list
+ \param external true if the arguments come from other instance of ultracopier
+ */
+ void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck);
signals:
- /** new copy without destination have been pased by the CLI */
- void newCopy(QStringList sources);
- /** new copy with destination have been pased by the CLI */
- void newCopy(QStringList sources,QString destination);
- /** new move without destination have been pased by the CLI */
- void newMove(QStringList sources);
- /** new move with destination have been pased by the CLI */
- void newMove(QStringList sources,QString destination);
- /** new transfer list pased by the CLI */
- void newTransferList(QString engine,QString mode,QString file);
+ /** new copy without destination have been pased by the CLI */
+ void newCopyWithoutDestination(QStringList sources) const;
+ /** new copy with destination have been pased by the CLI */
+ void newCopy(QStringList sources,QString destination) const;
+ /** new move without destination have been pased by the CLI */
+ void newMoveWithoutDestination(QStringList sources) const;
+ /** new move with destination have been pased by the CLI */
+ void newMove(QStringList sources,QString destination) const;
+ /** new transfer list pased by the CLI */
+ void newTransferList(QString engine,QString mode,QString file) const;
+
+ void tryLoadPlugin(const QString &file) const;
+ /// \brief Show the help option
+ void showOptions() const;
private:
- /** \brief show the help
- *\param incorrectArguments if the help is call because the arguments are wrong */
- void showHelp(const bool &incorrectArguments=true);
+ /** \brief show the help
+ *\param incorrectArguments if the help is call because the arguments are wrong */
+ void showHelp(const bool &incorrectArguments=true);
};
#endif // CLIPARSER_H
diff --git a/CompilerInfo.h b/CompilerInfo.h
index 6cc079b..c4b4464 100644
--- a/CompilerInfo.h
+++ b/CompilerInfo.h
@@ -1,8 +1,6 @@
/** \file CompilerInfo.h
\brief Define the compiler info
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
/// \def COMPILERINFO the string to identify the compiler
diff --git a/CopyEngineManager.cpp b/CopyEngineManager.cpp
index 4808fc7..2355743 100644
--- a/CopyEngineManager.cpp
+++ b/CopyEngineManager.cpp
@@ -1,343 +1,381 @@
/** \file CopyEngineManager.cpp
\brief Define the copy engine manager
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
-#include <QDebug>
#include <QMessageBox>
#include "CopyEngineManager.h"
+#include "LanguagesManager.h"
+
+#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+#include "plugins/CopyEngine/Ultracopier/CopyEngineFactory.h"
+#endif
CopyEngineManager::CopyEngineManager(OptionDialog *optionDialog)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- connect(languages, SIGNAL(newLanguageLoaded(QString)), &facilityEngine,SLOT(retranslate()),Qt::DirectConnection);
- this->optionDialog=optionDialog;
- //setup the ui layout
- plugins->lockPluginListEdition();
- connect(this,SIGNAL(previouslyPluginAdded(PluginsAvailable)), this,SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins,SIGNAL(onePluginAdded(PluginsAvailable)), this,SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins,SIGNAL(onePluginWillBeRemoved(PluginsAvailable)), this,SLOT(onePluginWillBeRemoved(PluginsAvailable)),Qt::DirectConnection);
- connect(plugins,SIGNAL(pluginListingIsfinish()), this,SLOT(allPluginIsloaded()),Qt::QueuedConnection);
- QList<PluginsAvailable> list=plugins->getPluginsByCategory(PluginType_CopyEngine);
- foreach(PluginsAvailable currentPlugin,list)
- emit previouslyPluginAdded(currentPlugin);
- plugins->unlockPluginListEdition();
- //load the options
- isConnected=false;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ this->optionDialog=optionDialog;
+ //setup the ui layout
+ PluginsManager::pluginsManager->lockPluginListEdition();
+ connect(this,&CopyEngineManager::previouslyPluginAdded, this,&CopyEngineManager::onePluginAdded,Qt::QueuedConnection);
+ connect(PluginsManager::pluginsManager,&PluginsManager::onePluginAdded, this,&CopyEngineManager::onePluginAdded,Qt::QueuedConnection);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved, this,&CopyEngineManager::onePluginWillBeRemoved,Qt::DirectConnection);
+ #endif
+ connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish, this,&CopyEngineManager::allPluginIsloaded,Qt::QueuedConnection);
+ QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_CopyEngine);
+ foreach(PluginsAvailable currentPlugin,list)
+ emit previouslyPluginAdded(currentPlugin);
+ PluginsManager::pluginsManager->unlockPluginListEdition();
+ //load the options
+ isConnected=false;
}
void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin)
{
- if(plugin.category!=PluginType_CopyEngine)
- return;
- //setFileName
- QString pluginPath=plugin.path+PluginsManager::getResolvedPluginName("copyEngine");
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: "+pluginPath);
- //search into loaded session
- int index=0;
- while(index<pluginList.size())
- {
- if(pluginList.at(index).pluginPath==pluginPath)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("Engine already found!"));
- return;
- }
- index++;
- }
- CopyEnginePlugin newItem;
- newItem.pluginPath=pluginPath;
- newItem.path=plugin.path;
- newItem.name=plugin.name;
- newItem.pointer=new QPluginLoader(newItem.pluginPath);
- QObject *pluginObject = newItem.pointer->instance();
- if(pluginObject==NULL)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("unable to load the plugin: %1").arg(newItem.pointer->errorString()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("unable to load the plugin for %1").arg(newItem.pluginPath));
- newItem.pointer->unload();
- return;
- }
- newItem.factory = qobject_cast<PluginInterface_CopyEngineFactory *>(pluginObject);
- //check if found
- index=0;
- while(index<pluginList.size())
- {
- if(pluginList.at(index).factory==newItem.factory)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Plugin already found"));
- newItem.pointer->unload();
- return;
- }
- index++;
- }
- if(newItem.factory==NULL)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("unable to cast the plugin: %1").arg(newItem.pointer->errorString()));
- newItem.pointer->unload();
- return;
- }
- #ifdef ULTRACOPIER_DEBUG
- qRegisterMetaType<DebugLevel>("DebugLevel");
- connect(newItem.factory,SIGNAL(debugInformation(DebugLevel,QString,QString,QString,int)),this,SLOT(debugInformation(DebugLevel,QString,QString,QString,int)),Qt::QueuedConnection);
- #endif // ULTRACOPIER_DEBUG
- newItem.options=new LocalPluginOptions("CopyEngine-"+newItem.name);
- newItem.factory->setResources(newItem.options,plugin.writablePath,plugin.path,&facilityEngine,ULTRACOPIER_VERSION_PORTABLE_BOOL);
- newItem.optionsWidget=newItem.factory->options();
- newItem.supportedProtocolsForTheSource=newItem.factory->supportedProtocolsForTheSource();
- newItem.supportedProtocolsForTheDestination=newItem.factory->supportedProtocolsForTheDestination();
- newItem.canDoOnlyCopy=newItem.factory->canDoOnlyCopy();
- newItem.type=newItem.factory->getCopyType();
- newItem.transferListOperation=newItem.factory->getTransferListOperation();
- optionDialog->addPluginOptionWidget(PluginType_CopyEngine,newItem.name,newItem.optionsWidget);
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"plugin: "+newItem.name+" loaded, send options");
- //emit newCopyEngineOptions(plugin.path,newItem.name,newItem.optionsWidget);
- pluginList << newItem;
- connect(languages,SIGNAL(newLanguageLoaded(QString)),newItem.factory,SLOT(newLanguageLoaded()));
- if(plugins->allPluginHaveBeenLoaded())
- allPluginIsloaded();
- if(isConnected)
- emit addCopyEngine(newItem.name,newItem.canDoOnlyCopy);
+ if(plugin.category!=PluginType_CopyEngine)
+ return;
+ //setFileName
+ QString pluginPath=plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("copyEngine"));
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ /*more IO
+ if(!QFile(pluginPath).exists())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The plugin binary is missing: ")+pluginPath);
+ return;
+ }*/
+ #endif
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+pluginPath);
+ //search into loaded session
+ int index=0;
+ while(index<pluginList.size())
+ {
+ if(pluginList.at(index).pluginPath==pluginPath)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("Engine already found!"));
+ return;
+ }
+ index++;
+ }
+ CopyEnginePlugin newItem;
+ newItem.pluginPath=pluginPath;
+ newItem.path=plugin.path;
+ newItem.name=plugin.name;
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ newItem.pointer=new QPluginLoader(newItem.pluginPath);
+ #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ QObjectList objectList=QPluginLoader::staticInstances();
+ index=0;
+ QObject *pluginObject;
+ while(index<objectList.size())
+ {
+ pluginObject=objectList.at(index);
+ newItem.factory = qobject_cast<PluginInterface_CopyEngineFactory *>(pluginObject);
+ if(newItem.factory!=NULL)
+ break;
+ index++;
+ }
+ if(index==objectList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("static copy engine not found"));
+ return;
+ }
+ #else
+ QObject *pluginObject = newItem.pointer->instance();
+ if(pluginObject==NULL)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: %1").arg(newItem.pointer->errorString()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin for %1").arg(newItem.pluginPath));
+ newItem.pointer->unload();
+ return;
+ }
+ newItem.factory = qobject_cast<PluginInterface_CopyEngineFactory *>(pluginObject);
+ //check if found
+ index=0;
+ while(index<pluginList.size())
+ {
+ if(pluginList.at(index).factory==newItem.factory)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Plugin already found"));
+ newItem.pointer->unload();
+ return;
+ }
+ index++;
+ }
+ if(newItem.factory==NULL)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to cast the plugin: %1").arg(newItem.pointer->errorString()));
+ newItem.pointer->unload();
+ return;
+ }
+ #endif
+ #else
+ newItem.factory=new CopyEngineFactory();
+ #endif
+
+ #ifdef ULTRACOPIER_DEBUG
+ connect(newItem.factory,&PluginInterface_CopyEngineFactory::debugInformation,this,&CopyEngineManager::debugInformation,Qt::QueuedConnection);
+ #endif // ULTRACOPIER_DEBUG
+ newItem.options=new LocalPluginOptions(QStringLiteral("CopyEngine-")+newItem.name);
+ newItem.factory->setResources(newItem.options,plugin.writablePath,plugin.path,&FacilityEngine::facilityEngine,ULTRACOPIER_VERSION_PORTABLE_BOOL);
+ newItem.optionsWidget=newItem.factory->options();
+ newItem.supportedProtocolsForTheSource=newItem.factory->supportedProtocolsForTheSource();
+ newItem.supportedProtocolsForTheDestination=newItem.factory->supportedProtocolsForTheDestination();
+ newItem.canDoOnlyCopy=newItem.factory->canDoOnlyCopy();
+ newItem.type=newItem.factory->getCopyType();
+ newItem.transferListOperation=newItem.factory->getTransferListOperation();
+ optionDialog->addPluginOptionWidget(PluginType_CopyEngine,newItem.name,newItem.optionsWidget);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("plugin: ")+newItem.name+QStringLiteral(" loaded, send options"));
+ //emit newCopyEngineOptions(plugin.path,newItem.name,newItem.optionsWidget);
+ pluginList << newItem;
+ connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newItem.factory,&PluginInterface_CopyEngineFactory::newLanguageLoaded);
+ if(PluginsManager::pluginsManager->allPluginHaveBeenLoaded())
+ allPluginIsloaded();
+ if(isConnected)
+ emit addCopyEngine(newItem.name,newItem.canDoOnlyCopy);
}
+#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
void CopyEngineManager::onePluginWillBeRemoved(const PluginsAvailable &plugin)
{
- int index=0;
- while(index<pluginList.size())
- {
- if(pluginList.at(index).path==plugin.path)
- {
- if(pluginList.at(index).intances.size()<=0)
- {
- emit removeCopyEngine(pluginList.at(index).name);
- pluginList.removeAt(index);
- allPluginIsloaded();
- return;
- }
- }
- index++;
- }
+ int index=0;
+ while(index<pluginList.size())
+ {
+ if(pluginList.at(index).path==plugin.path)
+ {
+ if(pluginList.at(index).intances.size()<=0)
+ {
+ emit removeCopyEngine(pluginList.at(index).name);
+ pluginList.removeAt(index);
+ allPluginIsloaded();
+ return;
+ }
+ }
+ index++;
+ }
}
void CopyEngineManager::onePluginWillBeUnloaded(const PluginsAvailable &plugin)
{
- if(plugin.category!=PluginType_CopyEngine)
- return;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=0;
- while(index<pluginList.size())
- {
- if(pluginList.at(index).path==plugin.path)
- {
- delete pluginList.at(index).options;
- delete pluginList.at(index).factory;
- pluginList.at(index).pointer->unload();
- return;
- }
- index++;
- }
+ if(plugin.category!=PluginType_CopyEngine)
+ return;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ while(index<pluginList.size())
+ {
+ if(pluginList.at(index).path==plugin.path)
+ {
+ delete pluginList.at(index).options;
+ delete pluginList.at(index).factory;
+ pluginList.at(index).pointer->unload();
+ return;
+ }
+ index++;
+ }
}
+#endif
-CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const CopyMode &mode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination)
+CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultracopier::CopyMode &mode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start, pluginList.size(): %1, mode: %2, and particular protocol").arg(pluginList.size()).arg((int)mode));
- returnCopyEngine temp;
- int index=0;
- bool isTheGoodEngine=false;
- while(index<pluginList.size())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("pluginList.at(%1).name: %2").arg(index).arg(pluginList.at(index).name));
- isTheGoodEngine=false;
- if(mode!=Move || !pluginList.at(index).canDoOnlyCopy)
- {
- if(protocolsUsedForTheSources.size()==0)
- isTheGoodEngine=true;
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("pluginList.at(index).supportedProtocolsForTheDestination: %1").arg(pluginList.at(index).supportedProtocolsForTheDestination.join(";")));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("protocolsUsedForTheDestination: %1").arg(protocolsUsedForTheDestination));
- if(pluginList.at(index).supportedProtocolsForTheDestination.contains(protocolsUsedForTheDestination))
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("pluginList.at(index).supportedProtocolsForTheSource: %1").arg(pluginList.at(index).supportedProtocolsForTheSource.join(";")));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("protocolsUsedForTheSources.at(indexProto): %1").arg(protocolsUsedForTheSources.join(";")));
- isTheGoodEngine=true;
- int indexProto=0;
- while(indexProto<protocolsUsedForTheSources.size())
- {
- if(!pluginList.at(index).supportedProtocolsForTheSource.contains(protocolsUsedForTheSources.at(indexProto)))
- {
- isTheGoodEngine=false;
- break;
- }
- indexProto++;
- }
- }
- }
- }
- if(isTheGoodEngine)
- {
- pluginList[index].intances<<pluginList[index].factory->getInstance();
- temp.engine=pluginList[index].intances.last();
- temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
- temp.type=pluginList.at(index).type;
- temp.transferListOperation=pluginList.at(index).transferListOperation;
- return temp;
- }
- index++;
- }
- if(mode==Move)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Cannot find any copy engine with motions support");
- QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any copy engine with motions support"));
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Cannot find any compatible engine!");
- QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any compatible engine!"));
- }
- temp.engine=NULL;
- temp.type=File;
- temp.canDoOnlyCopy=true;
- return temp;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, mode: %2, and particular protocol").arg(pluginList.size()).arg((int)mode));
+ returnCopyEngine temp;
+ int index=0;
+ bool isTheGoodEngine=false;
+ while(index<pluginList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(%1).name: %2").arg(index).arg(pluginList.at(index).name));
+ isTheGoodEngine=false;
+ if(mode!=Ultracopier::Move || !pluginList.at(index).canDoOnlyCopy)
+ {
+ if(protocolsUsedForTheSources.size()==0)
+ isTheGoodEngine=true;
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(index).supportedProtocolsForTheDestination: %1").arg(pluginList.at(index).supportedProtocolsForTheDestination.join(";")));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("protocolsUsedForTheDestination: %1").arg(protocolsUsedForTheDestination));
+ if(protocolsUsedForTheDestination.isEmpty() || pluginList.at(index).supportedProtocolsForTheDestination.contains(protocolsUsedForTheDestination))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(index).supportedProtocolsForTheSource: %1").arg(pluginList.at(index).supportedProtocolsForTheSource.join(";")));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("protocolsUsedForTheSources.at(indexProto): %1").arg(protocolsUsedForTheSources.join(";")));
+ isTheGoodEngine=true;
+ int indexProto=0;
+ while(indexProto<protocolsUsedForTheSources.size())
+ {
+ if(!pluginList.at(index).supportedProtocolsForTheSource.contains(protocolsUsedForTheSources.at(indexProto)))
+ {
+ isTheGoodEngine=false;
+ break;
+ }
+ indexProto++;
+ }
+ }
+ }
+ }
+ if(isTheGoodEngine)
+ {
+ pluginList[index].intances<<pluginList.at(index).factory->getInstance();
+ temp.engine=pluginList.at(index).intances.last();
+ temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
+ temp.type=pluginList.at(index).type;
+ temp.transferListOperation=pluginList.at(index).transferListOperation;
+ return temp;
+ }
+ index++;
+ }
+ if(mode==Ultracopier::Move)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Cannot find any copy engine with move support");
+ QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any copy engine with move support"));
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Cannot find any compatible engine!");
+ QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any compatible engine!"));
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("protocolsUsedForTheSources: %1, protocolsUsedForTheDestination: %2").arg(protocolsUsedForTheSources.join(";")).arg(protocolsUsedForTheDestination));
+
+ temp.engine=NULL;
+ temp.type=Ultracopier::File;
+ temp.canDoOnlyCopy=true;
+ return temp;
}
-CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const CopyMode &mode,const QString &name)
+CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultracopier::CopyMode &mode,const QString &name)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start, pluginList.size(): %1, with mode: %2, and name: %3").arg(pluginList.size()).arg((int)mode).arg(name));
- returnCopyEngine temp;
- int index=0;
- while(index<pluginList.size())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("Check matching: %1").arg(pluginList.at(index).name));
- if(pluginList.at(index).name==name)
- {
- if(mode==Move && pluginList.at(index).canDoOnlyCopy)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"This copy engine does not support motions: pluginList.at(index).canDoOnlyCopy: "+QString::number(pluginList.at(index).canDoOnlyCopy));
- QMessageBox::critical(NULL,tr("Warning"),tr("This copy engine does not support motions"));
- temp.engine=NULL;
- return temp;
- }
- pluginList[index].intances<<pluginList[index].factory->getInstance();
- temp.engine=pluginList[index].intances.last();
- temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
- temp.type=pluginList.at(index).type;
- temp.transferListOperation=pluginList.at(index).transferListOperation;
- return temp;
- }
- index++;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Cannot find any engine with this name: %1").arg(name));
- QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any engine with this name: %1").arg(name));
- temp.engine=NULL;
- temp.type=File;
- temp.canDoOnlyCopy=true;
- return temp;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, with mode: %2, and name: %3").arg(pluginList.size()).arg((int)mode).arg(name));
+ returnCopyEngine temp;
+ int index=0;
+ while(index<pluginList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Check matching: %1").arg(pluginList.at(index).name));
+ if(pluginList.at(index).name==name)
+ {
+ if(mode==Ultracopier::Move && pluginList.at(index).canDoOnlyCopy)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"This copy engine does not support move: pluginList.at(index).canDoOnlyCopy: "+QString::number(pluginList.at(index).canDoOnlyCopy));
+ QMessageBox::critical(NULL,tr("Warning"),tr("This copy engine does not support move"));
+ temp.engine=NULL;
+ return temp;
+ }
+ pluginList[index].intances<<pluginList.at(index).factory->getInstance();
+ temp.engine=pluginList.at(index).intances.last();
+ temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
+ temp.type=pluginList.at(index).type;
+ temp.transferListOperation=pluginList.at(index).transferListOperation;
+ return temp;
+ }
+ index++;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Cannot find any engine with this name: %1").arg(name));
+ QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any engine with this name: %1").arg(name));
+ temp.engine=NULL;
+ temp.type=Ultracopier::File;
+ temp.canDoOnlyCopy=true;
+ return temp;
}
#ifdef ULTRACOPIER_DEBUG
-void CopyEngineManager::debugInformation(DebugLevel level,const QString& fonction,const QString& text,const QString& file,const int& ligne)
+void CopyEngineManager::debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne)
{
- DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,"Copy Engine plugin");
+ DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,QStringLiteral("Copy Engine plugin"));
}
#endif // ULTRACOPIER_DEBUG
/// \brief To notify when new value into a group have changed
void CopyEngineManager::newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value)
{
- if(groupName=="CopyEngine" && variableName=="List")
- {
- Q_UNUSED(value)
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"start(\""+groupName+"\",\""+variableName+"\",\""+value.toString()+"\")");
- allPluginIsloaded();
- }
+ if(groupName==QStringLiteral("CopyEngine") && variableName==QStringLiteral("List"))
+ {
+ Q_UNUSED(value)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"start(\""+groupName+"\",\""+variableName+"\",\""+value.toString()+"\")");
+ allPluginIsloaded();
+ }
}
void CopyEngineManager::setIsConnected()
{
- /* ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- prevent bug, I don't know why, in one case it bug here
- */
- isConnected=true;
- int index=0;
- while(index<pluginList.size())
- {
- emit addCopyEngine(pluginList.at(index).name,pluginList.at(index).canDoOnlyCopy);
- index++;
- }
+ /* ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ prevent bug, I don't know why, in one case it bug here
+ */
+ isConnected=true;
+ int index=0;
+ while(index<pluginList.size())
+ {
+ emit addCopyEngine(pluginList.at(index).name,pluginList.at(index).canDoOnlyCopy);
+ index++;
+ }
}
void CopyEngineManager::allPluginIsloaded()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QStringList actualList;
- int index=0;
- while(index<pluginList.size())
- {
- actualList << pluginList.at(index).name;
- index++;
- }
- QStringList preferedList=options->getOptionValue("CopyEngine","List").toStringList();
- preferedList.removeDuplicates();
- actualList.removeDuplicates();
- index=0;
- while(index<preferedList.size())
- {
- if(!actualList.contains(preferedList.at(index)))
- {
- preferedList.removeAt(index);
- index--;
- }
- index++;
- }
- index=0;
- while(index<actualList.size())
- {
- if(!preferedList.contains(actualList.at(index)))
- preferedList << actualList.at(index);
- index++;
- }
- options->setOptionValue("CopyEngine","List",preferedList);
- QList<CopyEnginePlugin> newPluginList;
- index=0;
- while(index<preferedList.size())
- {
- int pluginListIndex=0;
- while(pluginListIndex<pluginList.size())
- {
- if(preferedList.at(index)==pluginList.at(pluginListIndex).name)
- {
- newPluginList << pluginList.at(pluginListIndex);
- break;
- }
- pluginListIndex++;
- }
- index++;
- }
- pluginList=newPluginList;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ QStringList actualList;
+ int index=0;
+ while(index<pluginList.size())
+ {
+ actualList << pluginList.at(index).name;
+ index++;
+ }
+ QStringList preferedList=OptionEngine::optionEngine->getOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List")).toStringList();
+ preferedList.removeDuplicates();
+ actualList.removeDuplicates();
+ index=0;
+ while(index<preferedList.size())
+ {
+ if(!actualList.contains(preferedList.at(index)))
+ {
+ preferedList.removeAt(index);
+ index--;
+ }
+ index++;
+ }
+ index=0;
+ while(index<actualList.size())
+ {
+ if(!preferedList.contains(actualList.at(index)))
+ preferedList << actualList.at(index);
+ index++;
+ }
+ OptionEngine::optionEngine->setOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List"),preferedList);
+ QList<CopyEnginePlugin> newPluginList;
+ index=0;
+ while(index<preferedList.size())
+ {
+ int pluginListIndex=0;
+ while(pluginListIndex<pluginList.size())
+ {
+ if(preferedList.at(index)==pluginList.at(pluginListIndex).name)
+ {
+ newPluginList << pluginList.at(pluginListIndex);
+ break;
+ }
+ pluginListIndex++;
+ }
+ index++;
+ }
+ pluginList=newPluginList;
}
bool CopyEngineManager::protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination)
{
- int index=0;
- while(index<pluginList.size())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("pluginList.at(%1).name: %2").arg(index).arg(pluginList.at(index).name));
- if(pluginList.at(index).intances.contains(engine))
- {
- if(!pluginList.at(index).supportedProtocolsForTheDestination.contains(protocolsUsedForTheDestination))
- return false;
- int indexProto=0;
- while(indexProto<protocolsUsedForTheSources.size())
- {
- if(!pluginList.at(index).supportedProtocolsForTheSource.contains(protocolsUsedForTheSources.at(indexProto)))
- return false;
- indexProto++;
- }
- return true;
- }
- }
- return false;
+ int index=0;
+ while(index<pluginList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(%1).name: %2").arg(index).arg(pluginList.at(index).name));
+ if(pluginList.at(index).intances.contains(engine))
+ {
+ if(!pluginList.at(index).supportedProtocolsForTheDestination.contains(protocolsUsedForTheDestination))
+ return false;
+ int indexProto=0;
+ while(indexProto<protocolsUsedForTheSources.size())
+ {
+ if(!pluginList.at(index).supportedProtocolsForTheSource.contains(protocolsUsedForTheSources.at(indexProto)))
+ return false;
+ indexProto++;
+ }
+ return true;
+ }
+ }
+ return false;
}
diff --git a/CopyEngineManager.h b/CopyEngineManager.h
index 1b3ce58..1338081 100644
--- a/CopyEngineManager.h
+++ b/CopyEngineManager.h
@@ -1,103 +1,105 @@
/** \file CopyEngineManager.h
\brief Define the copy engine manager
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef COPYENGINEMANAGER_H
#define COPYENGINEMANAGER_H
#include <QObject>
+#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
#include <QPluginLoader>
+#endif
#include <QList>
#include <QWidget>
#include <QString>
#include "Environment.h"
-#include "GlobalClass.h"
#include "LocalPluginOptions.h"
#include "OptionDialog.h"
#include "interface/PluginInterface_CopyEngine.h"
#include "FacilityEngine.h"
namespace Ui {
- class CopyEngineOptions;
+ class CopyEngineOptions;
}
/** \brief Manage copy engine plugins and their instance */
-class CopyEngineManager : public QObject, public GlobalClass
+class CopyEngineManager : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- /** \brief internal structure to return one copy engine instance */
- struct returnCopyEngine
- {
- PluginInterface_CopyEngine * engine; ///< The copy engine instance
- bool canDoOnlyCopy; ///< true if can do only the copy (not move)
- CopyType type; ///< Kind of copy what it can do
- TransferListOperation transferListOperation;
- };
- explicit CopyEngineManager(OptionDialog *optionDialog);
- /** \brief return copy engine instance when know the sources and destinations
- \param mode the mode (copy/move)
- \param protocolsUsedForTheSources list of sources used
- \param protocolsUsedForTheDestination list of destination used
- \see getCopyEngine()
- */
- returnCopyEngine getCopyEngine(const CopyMode &mode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination);
- /** \brief return copy engine instance with specific engine
- \param mode the mode (copy/move)
- \param name name of the engine needed
- \see getCopyEngine()
- */
- returnCopyEngine getCopyEngine(const CopyMode &mode,const QString &name);
- //bool currentEngineCanDoOnlyCopy(QStringList protocolsUsedForTheSources,QString protocolsUsedForTheDestination="");
- //CopyType currentEngineGetCopyType(QStringList protocolsUsedForTheSources,QString protocolsUsedForTheDestination="");
- /** \brief to send all signal because all object is connected on it */
- void setIsConnected();
- /** \brief check if the protocols given is supported by the copy engine
- \see Core::newCopy()
- \see Core::newMove()
- */
- bool protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination);
+ /** \brief internal structure to return one copy engine instance */
+ struct returnCopyEngine
+ {
+ PluginInterface_CopyEngine * engine; ///< The copy engine instance
+ bool canDoOnlyCopy; ///< true if can do only the copy (not move)
+ Ultracopier::CopyType type; ///< Kind of copy what it can do
+ Ultracopier::TransferListOperation transferListOperation;
+ };
+ explicit CopyEngineManager(OptionDialog *optionDialog);
+ /** \brief return copy engine instance when know the sources and destinations
+ \param mode the mode (copy/move)
+ \param protocolsUsedForTheSources list of sources used
+ \param protocolsUsedForTheDestination list of destination used
+ \see getCopyEngine()
+ */
+ returnCopyEngine getCopyEngine(const Ultracopier::CopyMode &mode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination);
+ /** \brief return copy engine instance with specific engine
+ \param mode the mode (copy/move)
+ \param name name of the engine needed
+ \see getCopyEngine()
+ */
+ returnCopyEngine getCopyEngine(const Ultracopier::CopyMode &mode,const QString &name);
+ //bool currentEngineCanDoOnlyCopy(QStringList protocolsUsedForTheSources,QString protocolsUsedForTheDestination="");
+ //CopyType currentEngineGetCopyType(QStringList protocolsUsedForTheSources,QString protocolsUsedForTheDestination="");
+ /** \brief to send all signal because all object is connected on it */
+ void setIsConnected();
+ /** \brief check if the protocols given is supported by the copy engine
+ \see Core::newCopy()
+ \see Core::newMove()
+ */
+ bool protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination);
private slots:
- void onePluginAdded(const PluginsAvailable &plugin);
- void onePluginWillBeRemoved(const PluginsAvailable &plugin);
- void onePluginWillBeUnloaded(const PluginsAvailable &plugin);
- #ifdef ULTRACOPIER_DEBUG
- void debugInformation(DebugLevel level,const QString& fonction,const QString& text,const QString& file,const int& ligne);
- #endif // ULTRACOPIER_DEBUG
- /// \brief To notify when new value into a group have changed
- void newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value);
- void allPluginIsloaded();
+ void onePluginAdded(const PluginsAvailable &plugin);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ void onePluginWillBeRemoved(const PluginsAvailable &plugin);
+ void onePluginWillBeUnloaded(const PluginsAvailable &plugin);
+ #endif
+ #ifdef ULTRACOPIER_DEBUG
+ void debugInformation(const Ultracopier::DebugLevel &level, const QString& fonction, const QString& text, const QString& file, const int& ligne);
+ #endif // ULTRACOPIER_DEBUG
+ /// \brief To notify when new value into a group have changed
+ void newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value);
+ void allPluginIsloaded();
private:
- /// \brief the option interface
- struct CopyEnginePlugin
- {
- QString path;
- QString name;
- QString pluginPath;
- QStringList supportedProtocolsForTheSource;
- QStringList supportedProtocolsForTheDestination;
- QPluginLoader * pointer;
- PluginInterface_CopyEngineFactory * factory;
- QList<PluginInterface_CopyEngine *> intances;
- bool canDoOnlyCopy;
- CopyType type;
- TransferListOperation transferListOperation;
- LocalPluginOptions *options;
- QWidget *optionsWidget;
- };
- QList<CopyEnginePlugin> pluginList;
- OptionDialog *optionDialog;
- bool isConnected;
- FacilityEngine facilityEngine;
+ /// \brief the option interface
+ struct CopyEnginePlugin
+ {
+ QString path;
+ QString name;
+ QString pluginPath;
+ QStringList supportedProtocolsForTheSource;
+ QStringList supportedProtocolsForTheDestination;
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ QPluginLoader * pointer;
+ #endif
+ PluginInterface_CopyEngineFactory * factory;
+ QList<PluginInterface_CopyEngine *> intances;
+ bool canDoOnlyCopy;
+ Ultracopier::CopyType type;
+ Ultracopier::TransferListOperation transferListOperation;
+ LocalPluginOptions *options;
+ QWidget *optionsWidget;
+ };
+ QList<CopyEnginePlugin> pluginList;
+ OptionDialog *optionDialog;
+ bool isConnected;
signals:
- //void newCopyEngineOptions(QString,QString,QWidget *);
- void addCopyEngine(QString name,bool canDoOnlyCopy);
- void removeCopyEngine(QString name);
- void previouslyPluginAdded(PluginsAvailable);
+ //void newCopyEngineOptions(QString,QString,QWidget *);
+ void addCopyEngine(QString name,bool canDoOnlyCopy) const;
+ void removeCopyEngine(QString name) const;
+ void previouslyPluginAdded(PluginsAvailable) const;
};
#endif // COPYENGINEMANAGER_H
diff --git a/CopyListener.cpp b/CopyListener.cpp
index c648b97..897a4c4 100755..100644
--- a/CopyListener.cpp
+++ b/CopyListener.cpp
@@ -1,392 +1,465 @@
/** \file CopyListener.h
\brief Define the copy listener
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "CopyListener.h"
+#include "LanguagesManager.h"
+
+#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+#include "plugins/Listener/catchcopy-v0002/listener.h"
+#endif
+
+#include <QRegularExpression>
+#include <QMessageBox>
CopyListener::CopyListener(OptionDialog *optionDialog)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- this->optionDialog=optionDialog;
- pluginLoader=new PluginLoader(optionDialog);
- //load the options
- tryListen=false;
- QList<QPair<QString, QVariant> > KeysList;
- KeysList.append(qMakePair(QString("CatchCopyAsDefault"),QVariant(true)));
- options->addOptionGroup("CopyListener",KeysList);
- plugins->lockPluginListEdition();
- QList<PluginsAvailable> list=plugins->getPluginsByCategory(PluginType_Listener);
- qRegisterMetaType<PluginsAvailable>("PluginsAvailable");
- qRegisterMetaType<ListeningState>("ListeningState");
- connect(this,SIGNAL(previouslyPluginAdded(PluginsAvailable)), this,SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins,SIGNAL(onePluginAdded(PluginsAvailable)), this,SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins,SIGNAL(onePluginWillBeRemoved(PluginsAvailable)), this,SLOT(onePluginWillBeRemoved(PluginsAvailable)),Qt::DirectConnection);
- connect(plugins,SIGNAL(pluginListingIsfinish()), this,SLOT(allPluginIsloaded()),Qt::QueuedConnection);
- connect(pluginLoader,SIGNAL(pluginLoaderReady(CatchState,bool,bool)), this,SIGNAL(pluginLoaderReady(CatchState,bool,bool)));
- foreach(PluginsAvailable currentPlugin,list)
- emit previouslyPluginAdded(currentPlugin);
- plugins->unlockPluginListEdition();
- last_state=NotListening;
- last_have_plugin=false;
- last_inWaitOfReply=false;
+ stopIt=false;
+ this->optionDialog=optionDialog;
+ pluginLoader=new PluginLoader(optionDialog);
+ //load the options
+ tryListen=false;
+ PluginsManager::pluginsManager->lockPluginListEdition();
+ QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_Listener);
+ connect(this,&CopyListener::previouslyPluginAdded, this,&CopyListener::onePluginAdded,Qt::QueuedConnection);
+ connect(PluginsManager::pluginsManager,&PluginsManager::onePluginAdded, this,&CopyListener::onePluginAdded,Qt::QueuedConnection);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved, this,&CopyListener::onePluginWillBeRemoved,Qt::DirectConnection);
+ #endif
+ connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish, this,&CopyListener::allPluginIsloaded,Qt::QueuedConnection);
+ connect(pluginLoader,&PluginLoader::pluginLoaderReady, this,&CopyListener::pluginLoaderReady);
+ foreach(PluginsAvailable currentPlugin,list)
+ emit previouslyPluginAdded(currentPlugin);
+ PluginsManager::pluginsManager->unlockPluginListEdition();
+ last_state=Ultracopier::NotListening;
+ last_have_plugin=false;
+ last_inWaitOfReply=false;
+ stripSeparatorRegex=QRegularExpression(QStringLiteral("[\\\\/]+$"));
}
CopyListener::~CopyListener()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QList<PluginsAvailable> list=plugins->getPluginsByCategory(PluginType_Listener);
- foreach(PluginsAvailable currentPlugin,list)
- onePluginWillBeRemoved(currentPlugin);
- delete pluginLoader;
+ stopIt=true;
+ if(pluginLoader!=NULL)
+ {
+ delete pluginLoader;
+ pluginLoader=NULL;
+ }
}
void CopyListener::resendState()
{
- if(plugins->allPluginHaveBeenLoaded())
- {
- sendState(true);
- pluginLoader->resendState();
- }
+ if(PluginsManager::pluginsManager->allPluginHaveBeenLoaded())
+ {
+ sendState(true);
+ if(pluginLoader!=NULL)
+ pluginLoader->resendState();
+ }
}
void CopyListener::onePluginAdded(const PluginsAvailable &plugin)
{
- if(plugin.category!=PluginType_Listener)
- return;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"try load: "+plugin.path+PluginsManager::getResolvedPluginName("listener"));
- //setFileName
- QPluginLoader *pluginOfPluginLoader=new QPluginLoader(plugin.path+PluginsManager::getResolvedPluginName("listener"));
- QObject *pluginInstance = pluginOfPluginLoader->instance();
- if(pluginInstance)
- {
- PluginInterface_Listener *listen = qobject_cast<PluginInterface_Listener *>(pluginInstance);
- //check if found
- int index=0;
- while(index<pluginList.size())
- {
- if(pluginList.at(index).listenInterface==listen)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Plugin already found %1 for %2").arg(pluginList.at(index).path).arg(plugin.path));
- pluginOfPluginLoader->unload();
- return;
- }
- index++;
- }
- if(listen)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Plugin correctly loaded");
- #ifdef ULTRACOPIER_DEBUG
- connect(listen,SIGNAL(debugInformation(DebugLevel,QString,QString,QString,int)),this,SLOT(debugInformation(DebugLevel,QString,QString,QString,int)));
- #endif // ULTRACOPIER_DEBUG
- connect(listen,SIGNAL(newCopy(quint32,QStringList)), this,SLOT(newPluginCopy(quint32,QStringList)));
- connect(listen,SIGNAL(newCopy(quint32,QStringList,QString)), this,SLOT(newPluginCopy(quint32,QStringList,QString)));
- connect(listen,SIGNAL(newMove(quint32,QStringList)), this,SLOT(newPluginMove(quint32,QStringList)));
- connect(listen,SIGNAL(newMove(quint32,QStringList,QString)), this,SLOT(newPluginMove(quint32,QStringList,QString)));
- PluginListener newPluginListener;
- newPluginListener.listenInterface = listen;
- newPluginListener.pluginLoader = pluginOfPluginLoader;
- newPluginListener.path = plugin.path+PluginsManager::getResolvedPluginName("listener");
- newPluginListener.state = NotListening;
- newPluginListener.inWaitOfReply = false;
- newPluginListener.options=new LocalPluginOptions("Listener-"+plugin.name);
- newPluginListener.listenInterface->setResources(newPluginListener.options,plugin.writablePath,plugin.path,ULTRACOPIER_VERSION_PORTABLE_BOOL);
- optionDialog->addPluginOptionWidget(PluginType_Listener,plugin.name,newPluginListener.listenInterface->options());
- connect(languages,SIGNAL(newLanguageLoaded(QString)),newPluginListener.listenInterface,SLOT(newLanguageLoaded()));
- pluginList << newPluginListener;
- connect(pluginList.last().listenInterface,SIGNAL(newState(ListeningState)),this,SLOT(newState(ListeningState)));
- if(tryListen)
- {
- pluginList.last().inWaitOfReply=true;
- listen->listen();
- }
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to cast the plugin: "+pluginOfPluginLoader->errorString());
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to load the plugin: "+pluginOfPluginLoader->errorString());
+ if(plugin.category!=PluginType_Listener)
+ return;
+ PluginListener newPluginListener;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("try load: ")+plugin.path+PluginsManager::getResolvedPluginName("listener"));
+ //setFileName
+ #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ PluginInterface_Listener *listen;
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ QObjectList objectList=QPluginLoader::staticInstances();
+ int index=0;
+ QObject *pluginObject;
+ while(index<objectList.size())
+ {
+ pluginObject=objectList.at(index);
+ listen = qobject_cast<PluginInterface_Listener *>(pluginObject);
+ if(listen!=NULL)
+ break;
+ index++;
+ }
+ if(index==objectList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("static listener not found"));
+ return;
+ }
+ #else
+ listen=new Listener();
+ #endif
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ newPluginListener.pluginLoader=NULL;
+ #endif
+ #else
+ QPluginLoader *pluginOfPluginLoader=new QPluginLoader(plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("listener")));
+ QObject *pluginInstance = pluginOfPluginLoader->instance();
+ if(!pluginInstance)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: ")+pluginOfPluginLoader->errorString());
+ return;
+ }
+ PluginInterface_Listener *listen = qobject_cast<PluginInterface_Listener *>(pluginInstance);
+ if(!listen)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: ")+pluginOfPluginLoader->errorString());
+ return;
+ }
+ //check if found
+ int index=0;
+ while(index<pluginList.size())
+ {
+ if(pluginList.at(index).listenInterface==listen)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Plugin already found %1 for %2").arg(pluginList.at(index).path).arg(plugin.path));
+ pluginOfPluginLoader->unload();
+ return;
+ }
+ index++;
+ }
+ newPluginListener.pluginLoader = pluginOfPluginLoader;
+ #endif
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Plugin correctly loaded"));
+ #ifdef ULTRACOPIER_DEBUG
+ connect(listen,&PluginInterface_Listener::debugInformation,this,&CopyListener::debugInformation,Qt::DirectConnection);
+ #endif // ULTRACOPIER_DEBUG
+ connect(listen,&PluginInterface_Listener::error, this,&CopyListener::error,Qt::DirectConnection);
+ connect(listen,&PluginInterface_Listener::newCopyWithoutDestination, this,&CopyListener::newPluginCopyWithoutDestination,Qt::DirectConnection);
+ connect(listen,&PluginInterface_Listener::newCopy, this,&CopyListener::newPluginCopy,Qt::DirectConnection);
+ connect(listen,&PluginInterface_Listener::newMoveWithoutDestination, this,&CopyListener::newPluginMoveWithoutDestination,Qt::DirectConnection);
+ connect(listen,&PluginInterface_Listener::newMove, this,&CopyListener::newPluginMove,Qt::DirectConnection);
+ connect(listen,&PluginInterface_Listener::newClientList, this,&CopyListener::reloadClientList,Qt::DirectConnection);
+ newPluginListener.listenInterface = listen;
+
+ newPluginListener.path = plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("listener"));
+ newPluginListener.state = Ultracopier::NotListening;
+ newPluginListener.inWaitOfReply = false;
+ newPluginListener.options=new LocalPluginOptions(QStringLiteral("Listener-")+plugin.name);
+ newPluginListener.listenInterface->setResources(newPluginListener.options,plugin.writablePath,plugin.path,ULTRACOPIER_VERSION_PORTABLE_BOOL);
+ optionDialog->addPluginOptionWidget(PluginType_Listener,plugin.name,newPluginListener.listenInterface->options());
+ connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newPluginListener.listenInterface,&PluginInterface_Listener::newLanguageLoaded,Qt::DirectConnection);
+ pluginList << newPluginListener;
+ connect(pluginList.last().listenInterface,&PluginInterface_Listener::newState,this,&CopyListener::newState,Qt::DirectConnection);
+ if(tryListen)
+ {
+ pluginList.last().inWaitOfReply=true;
+ listen->listen();
+ }
}
#ifdef ULTRACOPIER_DEBUG
-void CopyListener::debugInformation(DebugLevel level,const QString& fonction,const QString& text,const QString& file,const int& ligne)
+void CopyListener::debugInformation(const Ultracopier::DebugLevel &level, const QString& fonction, const QString& text, const QString& file, const int& ligne)
{
- DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,"Listener plugin");
+ DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,QStringLiteral("Listener plugin"));
}
#endif // ULTRACOPIER_DEBUG
+void CopyListener::error(const QString &error)
+{
+ QMessageBox::critical(NULL,tr("Error"),tr("Error during the reception of the copy/move list\n%1").arg(error));
+}
+
bool CopyListener::oneListenerIsLoaded()
{
- return (pluginList.size()>0);
+ return (pluginList.size()>0);
}
+#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
void CopyListener::onePluginWillBeRemoved(const PluginsAvailable &plugin)
{
- if(plugin.category!=PluginType_Listener)
- return;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"unload the current plugin");
- int indexPlugin=0;
- while(indexPlugin<pluginList.size())
- {
- if((plugin.path+PluginsManager::getResolvedPluginName("listener"))==pluginList.at(indexPlugin).path)
- {
- int index=0;
- while(index<copyRunningList.size())
- {
- if(copyRunningList.at(index).listenInterface==pluginList.at(indexPlugin).listenInterface)
- copyRunningList[index].listenInterface=NULL;
- index++;
- }
- pluginList.at(indexPlugin).listenInterface->close();
- disconnect(pluginList.at(indexPlugin).listenInterface);
- pluginList.at(indexPlugin).pluginLoader->unload();
- delete pluginList.at(indexPlugin).options;
- pluginList.removeAt(indexPlugin);
- sendState();
- return;
- }
- indexPlugin++;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"not found");
+ if(plugin.category!=PluginType_Listener)
+ return;
+ int indexPlugin=0;
+ while(indexPlugin<pluginList.size())
+ {
+ if((plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("listener")))==pluginList.at(indexPlugin).path)
+ {
+ int index=0;
+ while(index<copyRunningList.size())
+ {
+ if(copyRunningList.at(index).listenInterface==pluginList.at(indexPlugin).listenInterface)
+ copyRunningList[index].listenInterface=NULL;
+ index++;
+ }
+ if(pluginList.at(indexPlugin).listenInterface!=NULL)
+ {
+ pluginList.at(indexPlugin).listenInterface->close();
+ delete pluginList.at(indexPlugin).listenInterface;
+ }
+ if(pluginList.at(indexPlugin).pluginLoader!=NULL)
+ {
+ pluginList.at(indexPlugin).pluginLoader->unload();
+ delete pluginList.at(indexPlugin).options;
+ }
+ pluginList.removeAt(indexPlugin);
+ sendState();
+ return;
+ }
+ indexPlugin++;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"not found");
}
+#endif
-void CopyListener::newState(const ListeningState &state)
+void CopyListener::newState(const Ultracopier::ListeningState &state)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- PluginInterface_Listener *temp=qobject_cast<PluginInterface_Listener *>(QObject::sender());
- if(temp==NULL)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("listener not located!"));
- return;
- }
- int index=0;
- while(index<pluginList.size())
- {
- if(temp==pluginList.at(index).listenInterface)
- {
- pluginList[index].state=state;
- pluginList[index].inWaitOfReply=false;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("new state for the plugin %1: %2").arg(index).arg(state));
- sendState(true);
- return;
- }
- index++;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("listener not found!"));
+ if(stopIt)
+ return;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ PluginInterface_Listener *temp=qobject_cast<PluginInterface_Listener *>(QObject::sender());
+ if(temp==NULL)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("listener not located!"));
+ return;
+ }
+ int index=0;
+ while(index<pluginList.size())
+ {
+ if(temp==pluginList.at(index).listenInterface)
+ {
+ pluginList[index].state=state;
+ pluginList[index].inWaitOfReply=false;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("new state for the plugin %1: %2").arg(index).arg(state));
+ sendState(true);
+ return;
+ }
+ index++;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("listener not found!"));
}
void CopyListener::listen()
{
- tryListen=true;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=0;
- while(index<pluginList.size())
- {
- pluginList[index].inWaitOfReply=true;
- pluginList.at(index).listenInterface->listen();
- index++;
- }
- pluginLoader->load();
+ tryListen=true;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ while(index<pluginList.size())
+ {
+ pluginList[index].inWaitOfReply=true;
+ pluginList.at(index).listenInterface->listen();
+ index++;
+ }
+ if(pluginLoader!=NULL)
+ pluginLoader->load();
}
void CopyListener::close()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- tryListen=false;
- pluginLoader->unload();
- int index=0;
- while(index<pluginList.size())
- {
- pluginList[index].inWaitOfReply=true;
- pluginList.at(index).listenInterface->close();
- index++;
- }
- copyRunningList.clear();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ tryListen=false;
+ if(pluginLoader!=NULL)
+ pluginLoader->unload();
+ int index=0;
+ while(index<pluginList.size())
+ {
+ pluginList[index].inWaitOfReply=true;
+ pluginList.at(index).listenInterface->close();
+ index++;
+ }
+ copyRunningList.clear();
}
QStringList CopyListener::stripSeparator(QStringList sources)
{
- int index=0;
- while(index<sources.size())
- {
- sources[index].remove(QRegExp("[\\\\/]+$"));
- index++;
- }
- return sources;
+ int index=0;
+ while(index<sources.size())
+ {
+ sources[index].remove(stripSeparatorRegex);
+ index++;
+ }
+ return sources;
}
/** new copy without destination have been pased by the CLI */
-void CopyListener::newCopy(QStringList sources)
+void CopyListener::copyWithoutDestination(QStringList sources)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- emit newCopy(incrementOrderId(),QStringList() << "file",stripSeparator(sources));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ emit newCopyWithoutDestination(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources));
}
/** new copy with destination have been pased by the CLI */
-void CopyListener::newCopy(QStringList sources,QString destination)
+void CopyListener::copy(QStringList sources,QString destination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- emit newCopy(incrementOrderId(),QStringList() << "file",stripSeparator(sources),"file",destination);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ emit newCopy(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination);
}
/** new move without destination have been pased by the CLI */
-void CopyListener::newMove(QStringList sources)
+void CopyListener::moveWithoutDestination(QStringList sources)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- emit newMove(incrementOrderId(),QStringList() << "file",stripSeparator(sources));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ emit newMoveWithoutDestination(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources));
}
/** new move with destination have been pased by the CLI */
-void CopyListener::newMove(QStringList sources,QString destination)
+void CopyListener::move(QStringList sources,QString destination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- emit newMove(incrementOrderId(),QStringList() << "file",stripSeparator(sources),"file",destination);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ emit newMove(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination);
}
void CopyListener::copyFinished(const quint32 & orderId,const bool &withError)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=0;
- while(index<copyRunningList.size())
- {
- if(orderId==copyRunningList.at(index).orderId)
- {
- orderList.removeAll(orderId);
- if(copyRunningList.at(index).listenInterface!=NULL)
- copyRunningList.at(index).listenInterface->transferFinished(copyRunningList.at(index).pluginOrderId,withError);
- copyRunningList.removeAt(index);
- return;
- }
- index++;
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ while(index<copyRunningList.size())
+ {
+ if(orderId==copyRunningList.at(index).orderId)
+ {
+ orderList.removeAll(orderId);
+ if(copyRunningList.at(index).listenInterface!=NULL)
+ copyRunningList.at(index).listenInterface->transferFinished(copyRunningList.at(index).pluginOrderId,withError);
+ copyRunningList.removeAt(index);
+ return;
+ }
+ index++;
+ }
}
void CopyListener::copyCanceled(const quint32 & orderId)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=0;
- while(index<copyRunningList.size())
- {
- if(orderId==copyRunningList.at(index).orderId)
- {
- orderList.removeAll(orderId);
- if(copyRunningList.at(index).listenInterface!=NULL)
- copyRunningList.at(index).listenInterface->transferCanceled(copyRunningList.at(index).pluginOrderId);
- copyRunningList.removeAt(index);
- return;
- }
- index++;
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ while(index<copyRunningList.size())
+ {
+ if(orderId==copyRunningList.at(index).orderId)
+ {
+ orderList.removeAll(orderId);
+ if(copyRunningList.at(index).listenInterface!=NULL)
+ copyRunningList.at(index).listenInterface->transferCanceled(copyRunningList.at(index).pluginOrderId);
+ copyRunningList.removeAt(index);
+ return;
+ }
+ index++;
+ }
}
-void CopyListener::newPluginCopy(const quint32 &orderId,const QStringList &sources)
+void CopyListener::newPluginCopyWithoutDestination(const quint32 &orderId,const QStringList &sources)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"sources: "+sources.join(";"));
- PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
- CopyRunning newCopyInformation;
- newCopyInformation.listenInterface = plugin;
- newCopyInformation.pluginOrderId = orderId;
- newCopyInformation.orderId = incrementOrderId();
- copyRunningList << newCopyInformation;
- emit newCopy(orderId,QStringList() << "file",stripSeparator(sources));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(QStringLiteral(";")));
+ PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
+ CopyRunning newCopyInformation;
+ newCopyInformation.listenInterface = plugin;
+ newCopyInformation.pluginOrderId = orderId;
+ newCopyInformation.orderId = incrementOrderId();
+ copyRunningList << newCopyInformation;
+ emit newCopyWithoutDestination(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources));
}
void CopyListener::newPluginCopy(const quint32 &orderId,const QStringList &sources,const QString &destination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"sources: "+sources.join(";")+", destination: "+destination);
- PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
- CopyRunning newCopyInformation;
- newCopyInformation.listenInterface = plugin;
- newCopyInformation.pluginOrderId = orderId;
- newCopyInformation.orderId = incrementOrderId();
- copyRunningList << newCopyInformation;
- emit newCopy(orderId,QStringList() << "file",stripSeparator(sources),"file",destination);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(QStringLiteral(";"))+QStringLiteral(", destination: ")+destination);
+ PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
+ CopyRunning newCopyInformation;
+ newCopyInformation.listenInterface = plugin;
+ newCopyInformation.pluginOrderId = orderId;
+ newCopyInformation.orderId = incrementOrderId();
+ copyRunningList << newCopyInformation;
+ emit newCopy(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination);
}
-void CopyListener::newPluginMove(const quint32 &orderId,const QStringList &sources)
+void CopyListener::newPluginMoveWithoutDestination(const quint32 &orderId,const QStringList &sources)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"sources: "+sources.join(";"));
- PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
- CopyRunning newCopyInformation;
- newCopyInformation.listenInterface = plugin;
- newCopyInformation.pluginOrderId = orderId;
- newCopyInformation.orderId = incrementOrderId();
- copyRunningList << newCopyInformation;
- emit newMove(orderId,QStringList() << "file",stripSeparator(sources));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(QStringLiteral(";")));
+ PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
+ CopyRunning newCopyInformation;
+ newCopyInformation.listenInterface = plugin;
+ newCopyInformation.pluginOrderId = orderId;
+ newCopyInformation.orderId = incrementOrderId();
+ copyRunningList << newCopyInformation;
+ emit newMoveWithoutDestination(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources));
}
void CopyListener::newPluginMove(const quint32 &orderId,const QStringList &sources,const QString &destination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"sources: "+sources.join(";")+", destination: "+destination);
- PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
- CopyRunning newCopyInformation;
- newCopyInformation.listenInterface = plugin;
- newCopyInformation.pluginOrderId = orderId;
- newCopyInformation.orderId = incrementOrderId();
- copyRunningList << newCopyInformation;
- emit newMove(orderId,QStringList() << "file",stripSeparator(sources),"file",destination);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(";")+QStringLiteral(", destination: ")+destination);
+ PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender());
+ CopyRunning newCopyInformation;
+ newCopyInformation.listenInterface = plugin;
+ newCopyInformation.pluginOrderId = orderId;
+ newCopyInformation.orderId = incrementOrderId();
+ copyRunningList << newCopyInformation;
+ emit newMove(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination);
}
quint32 CopyListener::incrementOrderId()
{
- do
- {
- nextOrderId++;
- if(nextOrderId>2000000)
- nextOrderId=0;
- } while(orderList.contains(nextOrderId));
- return nextOrderId;
+ do
+ {
+ nextOrderId++;
+ if(nextOrderId>2000000)
+ nextOrderId=0;
+ } while(orderList.contains(nextOrderId));
+ return nextOrderId;
}
void CopyListener::allPluginIsloaded()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"with value: "+QString::number(pluginList.size()>0));
- sendState(true);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("with value: ")+QString::number(pluginList.size()>0));
+ sendState(true);
+ reloadClientList();
+}
+
+void CopyListener::reloadClientList()
+{
+ if(!PluginsManager::pluginsManager->allPluginHaveBeenLoaded())
+ return;
+ QStringList clients;
+ int indexPlugin=0;
+ while(indexPlugin<pluginList.size())
+ {
+ if(pluginList.at(indexPlugin).listenInterface!=NULL)
+ {
+ clients << pluginList.at(indexPlugin).listenInterface->clientsList();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ask client to: ")+pluginList.at(indexPlugin).path);
+ }
+ indexPlugin++;
+ }
+ emit newClientList(clients);
}
void CopyListener::sendState(bool force)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start, pluginList.size(): %1, force: %2").arg(pluginList.size()).arg(force));
- ListeningState current_state=NotListening;
- bool found_not_listen=false,found_listen=false,found_inWaitOfReply=false;
- int index=0;
- while(index<pluginList.size())
- {
- if(current_state==NotListening)
- {
- if(pluginList.at(index).state==SemiListening)
- current_state=SemiListening;
- else if(pluginList.at(index).state==NotListening)
- found_not_listen=true;
- else if(pluginList.at(index).state==FullListening)
- found_listen=true;
- }
- if(pluginList.at(index).inWaitOfReply)
- found_inWaitOfReply=true;
- index++;
- }
- if(current_state==NotListening)
- {
- if(found_not_listen && found_listen)
- current_state=SemiListening;
- else if(found_not_listen)
- current_state=NotListening;
- else if(FullListening)
- current_state=FullListening;
- else
- current_state=SemiListening;
- }
- bool have_plugin=pluginList.size()>0;
- if(force || current_state!=last_state || have_plugin!=last_have_plugin || found_inWaitOfReply!=last_inWaitOfReply)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("send listenerReady(%1,%2,%3)").arg(current_state).arg(have_plugin).arg(found_inWaitOfReply));
- emit listenerReady(current_state,have_plugin,found_inWaitOfReply);
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("Skip the signal sending"));
- last_state=current_state;
- last_have_plugin=have_plugin;
- last_inWaitOfReply=found_inWaitOfReply;
+ if(stopIt)
+ return;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, force: %2").arg(pluginList.size()).arg(force));
+ Ultracopier::ListeningState current_state=Ultracopier::NotListening;
+ bool found_not_listen=false,found_listen=false,found_inWaitOfReply=false;
+ int index=0;
+ while(index<pluginList.size())
+ {
+ if(current_state==Ultracopier::NotListening)
+ {
+ if(pluginList.at(index).state==Ultracopier::SemiListening)
+ current_state=Ultracopier::SemiListening;
+ else if(pluginList.at(index).state==Ultracopier::NotListening)
+ found_not_listen=true;
+ else if(pluginList.at(index).state==Ultracopier::FullListening)
+ found_listen=true;
+ }
+ if(pluginList.at(index).inWaitOfReply)
+ found_inWaitOfReply=true;
+ index++;
+ }
+ if(current_state==Ultracopier::NotListening)
+ {
+ if(found_not_listen && found_listen)
+ current_state=Ultracopier::SemiListening;
+ else if(found_not_listen)
+ current_state=Ultracopier::NotListening;
+ else if(!found_not_listen && found_listen)
+ current_state=Ultracopier::FullListening;
+ else
+ current_state=Ultracopier::SemiListening;
+ }
+ bool have_plugin=pluginList.size()>0;
+ if(force || current_state!=last_state || have_plugin!=last_have_plugin || found_inWaitOfReply!=last_inWaitOfReply)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("send listenerReady(%1,%2,%3)").arg(current_state).arg(have_plugin).arg(found_inWaitOfReply));
+ emit listenerReady(current_state,have_plugin,found_inWaitOfReply);
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Skip the signal sending"));
+ last_state=current_state;
+ last_have_plugin=have_plugin;
+ last_inWaitOfReply=found_inWaitOfReply;
}
diff --git a/CopyListener.h b/CopyListener.h
index 198ce9f..447ecb8 100755..100644
--- a/CopyListener.h
+++ b/CopyListener.h
@@ -1,115 +1,123 @@
/** \file CopyListener.h
\brief Define the class to load the plugin and lunch it
\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
+\licence GPL3, see the file COPYING */
#ifndef COPYLISTENER_H
#define COPYLISTENER_H
#include <QObject>
#include <QList>
+#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
#include <QPluginLoader>
+#endif
#include "interface/PluginInterface_Listener.h"
#include "Environment.h"
-#include "GlobalClass.h"
#include "PluginLoader.h"
#include "OptionDialog.h"
/** \brief to load all the listener and parse all event */
-class CopyListener : public QObject, public GlobalClass
+class CopyListener : public QObject
{
- Q_OBJECT
- public:
- explicit CopyListener(OptionDialog *optionDialog);
- ~CopyListener();
- /** \brief send of one listener is loaded */
- bool oneListenerIsLoaded();
- /** \brief to resend the state */
- void resendState();
- private slots:
- //void newPlugin();
- void newPluginCopy(const quint32 &orderId,const QStringList &sources);
- void newPluginCopy(const quint32 &orderId,const QStringList &sources,const QString &destination);
- void newPluginMove(const quint32 &orderId,const QStringList &sources);
- void newPluginMove(const quint32 &orderId,const QStringList &sources,const QString &destination);
- void onePluginAdded(const PluginsAvailable &plugin);
- void onePluginWillBeRemoved(const PluginsAvailable &plugin);
- void newState(const ListeningState &state);
- #ifdef ULTRACOPIER_DEBUG
- void debugInformation(DebugLevel level,const QString& fonction,const QString& text,const QString& file,const int& ligne);
- #endif // ULTRACOPIER_DEBUG
- void allPluginIsloaded();
- public slots:
- /** \brief the copy is finished
- \param orderId id used when it have send the copy
- \param withError true if it have found error
- \see newCopy()
- \see newMove()
- */
- void copyFinished(const quint32 & orderId,const bool &withError);
- /** \brief the copy is canceled by the user
- \param orderId id used when it have send the copy
- \see newCopy()
- \see newMove()
- */
- void copyCanceled(const quint32 & orderId);
- /** \brief try listen, to get copy/move from external source (mainly the file manager)
- \see close()
- */
- void listen();
- /** \brief stop listen, to get copy/move from external source (mainly the file manager)
- \see listen()
- */
- void close();
- /** new copy without destination have been pased by the CLI */
- void newCopy(QStringList sources);
- /** new copy with destination have been pased by the CLI */
- void newCopy(QStringList sources,QString destination);
- /** new move without destination have been pased by the CLI */
- void newMove(QStringList sources);
- /** new move with destination have been pased by the CLI */
- void newMove(QStringList sources,QString destination);
- signals:
- void newCopy(quint32 orderId,QStringList protocolsUsedForTheSources,QStringList sources);
- void newCopy(quint32 orderId,QStringList protocolsUsedForTheSources,QStringList sources,QString protocolsUsedForTheDestination,QString destination);
- void newMove(quint32 orderId,QStringList protocolsUsedForTheSources,QStringList sources);
- void newMove(quint32 orderId,QStringList protocolsUsedForTheSources,QStringList sources,QString protocolsUsedForTheDestination,QString destination);
- void listenerReady(ListeningState state,bool havePlugin,bool someAreInWaitOfReply);
- void pluginLoaderReady(CatchState state,bool havePlugin,bool someAreInWaitOfReply);
- void previouslyPluginAdded(PluginsAvailable);
- private:
- struct PluginListener
- {
- PluginInterface_Listener *listenInterface;
- QPluginLoader *pluginLoader;
- QString path;
- ListeningState state;
- bool inWaitOfReply;
- LocalPluginOptions *options;
- };
- QList<PluginListener> pluginList;
- //for the options
- quint32 nextOrderId;
- QList<quint32> orderList;
- //for the copy as suspend
- struct CopyRunning
- {
- PluginInterface_Listener *listenInterface;
- quint32 pluginOrderId;
- quint32 orderId;
- };
- QList<CopyRunning> copyRunningList;
- quint32 incrementOrderId();
- bool tryListen;
- PluginLoader *pluginLoader;
- ListeningState last_state;
- bool last_have_plugin,last_inWaitOfReply;
- void sendState(bool force=false);
- QStringList stripSeparator(QStringList sources);
- OptionDialog *optionDialog;
+ Q_OBJECT
+ public:
+ explicit CopyListener(OptionDialog *optionDialog);
+ ~CopyListener();
+ /** \brief send of one listener is loaded */
+ bool oneListenerIsLoaded();
+ /** \brief to resend the state */
+ void resendState();
+ private slots:
+ //void newPlugin();
+ void newPluginCopyWithoutDestination(const quint32 &orderId,const QStringList &sources);
+ void newPluginCopy(const quint32 &orderId,const QStringList &sources,const QString &destination);
+ void newPluginMoveWithoutDestination(const quint32 &orderId,const QStringList &sources);
+ void newPluginMove(const quint32 &orderId,const QStringList &sources,const QString &destination);
+ void onePluginAdded(const PluginsAvailable &plugin);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ void onePluginWillBeRemoved(const PluginsAvailable &plugin);
+ #endif
+ void newState(const Ultracopier::ListeningState &state);
+ #ifdef ULTRACOPIER_DEBUG
+ void debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne);
+ #endif // ULTRACOPIER_DEBUG
+ void error(const QString &error);
+ void allPluginIsloaded();
+ void reloadClientList();
+ public slots:
+ /** \brief the copy is finished
+ \param orderId id used when it have send the copy
+ \param withError true if it have found error
+ \see newCopy()
+ \see newMove()
+ */
+ void copyFinished(const quint32 & orderId,const bool &withError);
+ /** \brief the copy is canceled by the user
+ \param orderId id used when it have send the copy
+ \see newCopy()
+ \see newMove()
+ */
+ void copyCanceled(const quint32 & orderId);
+ /** \brief try listen, to get copy/move from external source (mainly the file manager)
+ \see close()
+ */
+ void listen();
+ /** \brief stop listen, to get copy/move from external source (mainly the file manager)
+ \see listen()
+ */
+ void close();
+ /** new copy without destination have been pased by the CLI */
+ void copyWithoutDestination(QStringList sources);
+ /** new copy with destination have been pased by the CLI */
+ void copy(QStringList sources,QString destination);
+ /** new move without destination have been pased by the CLI */
+ void moveWithoutDestination(QStringList sources);
+ /** new move with destination have been pased by the CLI */
+ void move(QStringList sources,QString destination);
+ signals:
+ void newCopyWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources) const;
+ void newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) const;
+ void newMoveWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources) const;
+ void newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) const;
+ void listenerReady(const Ultracopier::ListeningState &state,const bool &havePlugin,const bool &someAreInWaitOfReply) const;
+ void pluginLoaderReady(const Ultracopier::CatchState &state,const bool &havePlugin,const bool &someAreInWaitOfReply) const;
+ void previouslyPluginAdded(const PluginsAvailable &) const;
+ void newClientList(const QStringList &clientsList) const;
+ private:
+ struct PluginListener
+ {
+ PluginInterface_Listener *listenInterface;
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ QPluginLoader *pluginLoader;
+ #endif
+ QString path;
+ Ultracopier::ListeningState state;
+ bool inWaitOfReply;
+ LocalPluginOptions *options;
+ };
+ QList<PluginListener> pluginList;
+ //for the options
+ quint32 nextOrderId;
+ QList<quint32> orderList;
+ //for the copy as suspend
+ struct CopyRunning
+ {
+ PluginInterface_Listener *listenInterface;
+ quint32 pluginOrderId;
+ quint32 orderId;
+ };
+ QList<CopyRunning> copyRunningList;
+ quint32 incrementOrderId();
+ bool tryListen;
+ PluginLoader *pluginLoader;
+ Ultracopier::ListeningState last_state;
+ bool last_have_plugin,last_inWaitOfReply;
+ void sendState(bool force=false);
+ QStringList stripSeparator(QStringList sources);
+ OptionDialog *optionDialog;
+ bool stopIt;
+ QRegularExpression stripSeparatorRegex;
};
#endif // COPYLISTENER_H
diff --git a/Core.cpp b/Core.cpp
index a12ba32..52d693c 100755..100644
--- a/Core.cpp
+++ b/Core.cpp
@@ -1,304 +1,284 @@
/** \file Core.cpp
\brief Define the class for the core
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include <QMessageBox>
#include <QtPlugin>
+#include <cmath>
#include "Core.h"
+#include "ThemesManager.h"
Core::Core(CopyEngineManager *copyEngineList)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- this->copyEngineList=copyEngineList;
- nextId=0;
- forUpateInformation.setInterval(ULTRACOPIER_TIME_INTERFACE_UPDATE);
- loadInterface();
- //connect(&copyEngineList, SIGNAL(newCanDoOnlyCopy(bool)), this, SIGNAL(newCanDoOnlyCopy(bool)));
- connect(themes, SIGNAL(theThemeNeedBeUnloaded()), this, SLOT(unloadInterface()));
- connect(themes, SIGNAL(theThemeIsReloaded()), this, SLOT(loadInterface()));
- connect(&forUpateInformation, SIGNAL(timeout()), this, SLOT(periodicSynchronization()));
-
- qRegisterMetaType<QList<returnActionOnCopyList> >("QList<returnActionOnCopyList>");
- qRegisterMetaType<QList<ProgressionItem> >("QList<ProgressionItem>");
- qRegisterMetaType<QList<int> >("QList<int>");
- qRegisterMetaType<QList<QUrl> >("QList<QUrl>");
- qRegisterMetaType<EngineActionInProgress>("EngineActionInProgress");
- qRegisterMetaType<CopyMode >("CopyMode");
- qRegisterMetaType<QList<returnActionOnCopyList> >("QList<returnActionOnCopyList>");
- qRegisterMetaType<QList<ProgressionItem> >("QList<ProgressionItem>");
-}
-
-void Core::newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources)
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- if(openNewCopyEngineInstance(Copy,false,protocolsUsedForTheSources)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- copyList.last().orderId<<orderId;
- copyList.last().engine->newCopy(sources);
- copyList.last().interface->haveExternalOrder();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ this->copyEngineList=copyEngineList;
+ nextId=0;
+ forUpateInformation.setInterval(ULTRACOPIER_TIME_INTERFACE_UPDATE);
+ loadInterface();
+ //connect(&copyEngineList, &CopyEngineManager::newCanDoOnlyCopy, this, &Core::newCanDoOnlyCopy);
+ connect(ThemesManager::themesManager, &ThemesManager::theThemeNeedBeUnloaded, this, &Core::unloadInterface);
+ connect(ThemesManager::themesManager, &ThemesManager::theThemeIsReloaded, this, &Core::loadInterface, Qt::QueuedConnection);
+ connect(&forUpateInformation, &QTimer::timeout, this, &Core::periodicSynchronization);
+}
+
+Core::~Core()
+{
+ int index=0;
+ while(index<copyList.size())
+ {
+ copyList[index].engine->cancel();
+ delete copyList.at(index).nextConditionalSync;
+ delete copyList.at(index).interface;
+ delete copyList.at(index).engine;
+ index++;
+ }
+}
+
+void Core::newCopyWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources)
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ if(openNewCopyEngineInstance(Ultracopier::Copy,false,protocolsUsedForTheSources)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
+ copyList.last().orderId<<orderId;
+ copyList.last().engine->newCopy(sources);
+ copyList.last().interface->haveExternalOrder();
+}
+
+void Core::newTransfer(const Ultracopier::CopyMode &mode,const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination)
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+sources.join(QStringLiteral(";"))+QStringLiteral(", dest: ")+destination+QStringLiteral(", mode: ")+QString::number(mode));
+ //search to group the window
+ int GroupWindowWhen=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen")).toInt();
+ bool haveSameSource=false,haveSameDestination=false;
+ if(GroupWindowWhen!=0)
+ {
+ bool needConfirmation=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("confirmToGroupWindows")).toInt();
+ int index=0;
+ while(index<copyList.size())
+ {
+ bool rightMode=false;
+ if(mode==Ultracopier::Copy)
+ rightMode=copyList.at(index).mode==Ultracopier::Copy;
+ else
+ rightMode=copyList.at(index).mode==Ultracopier::Move;
+ if(!copyList.at(index).ignoreMode && rightMode && !copyList.at(index).canceled)
+ {
+ if(GroupWindowWhen!=5)
+ {
+ if(GroupWindowWhen!=2)
+ haveSameSource=copyList.at(index).engine->haveSameSource(sources);
+ if(GroupWindowWhen!=1)
+ haveSameDestination=copyList.at(index).engine->haveSameDestination(destination);
+ }
+ if(
+ GroupWindowWhen==5 ||
+ (GroupWindowWhen==1 && haveSameSource) ||
+ (GroupWindowWhen==2 && haveSameDestination) ||
+ (GroupWindowWhen==3 && (haveSameSource && haveSameDestination)) ||
+ (GroupWindowWhen==4 && (haveSameSource || haveSameDestination))
+ )
+ {
+ /*protocols are same*/
+ if(copyEngineList->protocolsSupportedByTheCopyEngine(copyList.at(index).engine,protocolsUsedForTheSources,protocolsUsedForTheDestination))
+ {
+ bool confirmed=true;
+ if(needConfirmation)
+ {
+ QMessageBox::StandardButton reply = QMessageBox::question(copyList.at(index).interface,tr("Group window"),tr("Do you want group the transfer with another actual running transfer?"),QMessageBox::Yes|QMessageBox::No,QMessageBox::No);
+ confirmed=(reply==QMessageBox::Yes);
+ }
+ if(confirmed)
+ {
+ copyList[index].orderId<<orderId;
+ if(mode==Ultracopier::Copy)
+ copyList.at(index).engine->newCopy(sources,destination);
+ else
+ copyList.at(index).engine->newMove(sources,destination);
+ copyList.at(index).interface->haveExternalOrder();
+ return;
+ }
+ }
+ }
+ }
+ index++;
+ }
+ }
+ //else open new windows
+ if(openNewCopyEngineInstance(mode,false,protocolsUsedForTheSources,protocolsUsedForTheDestination)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to get a engine instance"));
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a engine instance"));
+ return;
+ }
+ copyList.last().orderId<<orderId;
+ if(mode==Ultracopier::Copy)
+ copyList.last().engine->newCopy(sources,destination);
+ else
+ copyList.last().engine->newMove(sources,destination);
+ copyList.last().interface->haveExternalOrder();
}
void Core::newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: "+sources.join(";")+", dest: "+destination);
- //search to group the window
- int GroupWindowWhen=options->getOptionValue("Ultracopier","GroupWindowWhen").toInt();
- bool haveSameSource=false,haveSameDestination=false;
- if(GroupWindowWhen!=0)
- {
- int index=0;
- while(index<copyList.size())
- {
- if(!copyList.at(index).ignoreMode && copyList.at(index).mode==Copy)
- {
- if(GroupWindowWhen!=5)
- {
- if(GroupWindowWhen!=2)
- haveSameSource=copyList.at(index).engine->haveSameSource(sources);
- if(GroupWindowWhen!=1)
- haveSameDestination=copyList.at(index).engine->haveSameDestination(destination);
- }
- if(
- GroupWindowWhen==5 ||
- (GroupWindowWhen==1 && haveSameSource) ||
- (GroupWindowWhen==2 && haveSameDestination) ||
- (GroupWindowWhen==3 && (haveSameSource && haveSameDestination)) ||
- (GroupWindowWhen==4 && (haveSameSource || haveSameDestination))
- )
- {
- /*protocols are same*/
- if(copyEngineList->protocolsSupportedByTheCopyEngine(copyList.at(index).engine,protocolsUsedForTheSources,protocolsUsedForTheDestination))
- {
- copyList[index].orderId<<orderId;
- copyList.at(index).engine->newCopy(sources,destination);
- copyList.at(index).interface->haveExternalOrder();
- return;
- }
- }
- }
- index++;
- }
- }
- //else open new windows
- if(openNewCopyEngineInstance(Copy,false,protocolsUsedForTheSources,protocolsUsedForTheDestination)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- copyList.last().orderId<<orderId;
- copyList.last().engine->newCopy(sources,destination);
- copyList.last().interface->haveExternalOrder();
-}
-
-void Core::newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources)
-{
- if(openNewCopyEngineInstance(Move,false,protocolsUsedForTheSources)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- copyList.last().orderId<<orderId;
- copyList.last().engine->newMove(sources);
- copyList.last().interface->haveExternalOrder();
+ newTransfer(Ultracopier::Copy,orderId,protocolsUsedForTheSources,sources,protocolsUsedForTheDestination,destination);
}
void Core::newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: "+sources.join(";")+", dest: "+destination);
- //search to group the window
- int GroupWindowWhen=options->getOptionValue("Ultracopier","GroupWindowWhen").toInt();
- bool haveSameSource=false,haveSameDestination=false;
- if(GroupWindowWhen!=0)
- {
- int index=0;
- while(index<copyList.size())
- {
- if(!copyList.at(index).ignoreMode && copyList.at(index).mode==Move)
- {
- if(GroupWindowWhen!=5)
- {
- if(GroupWindowWhen!=2)
- haveSameSource=copyList.at(index).engine->haveSameSource(sources);
- if(GroupWindowWhen!=1)
- haveSameDestination=copyList.at(index).engine->haveSameDestination(destination);
- }
- if(
- GroupWindowWhen==5 ||
- (GroupWindowWhen==1 && haveSameSource) ||
- (GroupWindowWhen==2 && haveSameDestination) ||
- (GroupWindowWhen==3 && (haveSameSource && haveSameDestination)) ||
- (GroupWindowWhen==4 && (haveSameSource || haveSameDestination))
- )
- {
- /*protocols are same*/
- if(copyEngineList->protocolsSupportedByTheCopyEngine(copyList.at(index).engine,protocolsUsedForTheSources,protocolsUsedForTheDestination))
- {
- copyList[index].orderId<<orderId;
- copyList.at(index).engine->newCopy(sources,destination);
- copyList.at(index).interface->haveExternalOrder();
- return;
- }
- }
- }
- index++;
- }
- }
- //else open new windows
- if(openNewCopyEngineInstance(Move,false,protocolsUsedForTheSources,protocolsUsedForTheDestination)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- copyList.last().orderId<<orderId;
- copyList.last().engine->newMove(sources,destination);
- copyList.last().interface->haveExternalOrder();
+ newTransfer(Ultracopier::Move,orderId,protocolsUsedForTheSources,sources,protocolsUsedForTheDestination,destination);
+}
+
+void Core::newMoveWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources)
+{
+ if(openNewCopyEngineInstance(Ultracopier::Move,false,protocolsUsedForTheSources)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
+ copyList.last().orderId<<orderId;
+ copyList.last().engine->newMove(sources);
+ copyList.last().interface->haveExternalOrder();
}
/// \brief name to open the right copy engine
-void Core::addWindowCopyMove(const CopyMode &mode,const QString &name)
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: "+name);
- if(openNewCopyEngineInstance(mode,false,name)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- ActionOnManualOpen ActionOnManualOpen_value=(ActionOnManualOpen)options->getOptionValue("Ultracopier","ActionOnManualOpen").toInt();
- if(ActionOnManualOpen_value!=ActionOnManualOpen_Nothing)
- {
- if(ActionOnManualOpen_value==ActionOnManualOpen_Folder)
- copyList.last().engine->userAddFolder(mode);
- else
- copyList.last().engine->userAddFile(mode);
- }
+void Core::addWindowCopyMove(const Ultracopier::CopyMode &mode,const QString &name)
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+name);
+ if(openNewCopyEngineInstance(mode,false,name)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
+ ActionOnManualOpen ActionOnManualOpen_value=(ActionOnManualOpen)OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen")).toInt();
+ if(ActionOnManualOpen_value!=ActionOnManualOpen_Nothing)
+ {
+ if(ActionOnManualOpen_value==ActionOnManualOpen_Folder)
+ copyList.last().engine->userAddFolder(mode);
+ else
+ copyList.last().engine->userAddFile(mode);
+ }
}
/// \brief name to open the right copy engine
void Core::addWindowTransfer(const QString &name)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start"+name);
- if(openNewCopyEngineInstance(Copy,true,name)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")+name);
+ if(openNewCopyEngineInstance(Ultracopier::Copy,true,name)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
}
/** new transfer list pased by the CLI */
void Core::newTransferList(QString engine,QString mode,QString file)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("engine: %1, mode: %2, file: %3").arg(engine).arg(mode).arg(file));
- if(mode=="Transfer")
- {
- if(openNewCopyEngineInstance(Copy,true,engine)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- }
- else if(mode=="Copy")
- {
- if(openNewCopyEngineInstance(Copy,false,engine)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- }
- else if(mode=="Move")
- {
- if(openNewCopyEngineInstance(Move,false,engine)==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to get a copy engine instance");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
- return;
- }
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"The argument for the mode is not understand");
- QMessageBox::critical(NULL,tr("Error"),tr("The argument for the mode is not understand"));
- return;
- }
- copyList.last().engine->newTransferList(file);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("engine: %1, mode: %2, file: %3").arg(engine).arg(mode).arg(file));
+ if(mode==QStringLiteral("Transfer"))
+ {
+ if(openNewCopyEngineInstance(Ultracopier::Copy,true,engine)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
+ }
+ else if(mode==QStringLiteral("Copy"))
+ {
+ if(openNewCopyEngineInstance(Ultracopier::Copy,false,engine)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
+ }
+ else if(mode==QStringLiteral("Move"))
+ {
+ if(openNewCopyEngineInstance(Ultracopier::Move,false,engine)==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance"));
+ return;
+ }
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The argument for the mode is not valid");
+ QMessageBox::critical(NULL,tr("Error"),tr("The argument for the mode is not valid"));
+ return;
+ }
+ copyList.last().engine->newTransferList(file);
}
void Core::loadInterface()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- //load the extra files to check the themes availability
- if(copyList.size()>0)
- {
- bool error=false;
- index=0;
- loop_size=copyList.size();
- while(index<loop_size)
- {
- copyList[index].interface=themes->getThemesInstance();
- if(copyList[index].interface==NULL)
- {
- copyInstanceCanceledByIndex(index);
- index--;
- error=true;
- }
- else
- {
- if(!copyList.at(index).ignoreMode)
- copyList.at(index).interface->forceCopyMode(copyList.at(index).mode);
- connectInterfaceAndSync(copyList.count()-1);
- copyList.at(index).engine->syncTransferList();
- }
- index++;
- }
- if(error)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to load the interface, copy aborted");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to load the interface, copy aborted"));
- }
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ //load the extra files to check the themes availability
+ if(copyList.size()>0)
+ {
+ bool error=false;
+ int index=0;
+ while(index<copyList.size())
+ {
+ copyList[index].interface=ThemesManager::themesManager->getThemesInstance();
+ if(copyList.at(index).interface==NULL)
+ {
+ copyInstanceCanceledByIndex(index);
+ error=true;
+ }
+ else
+ {
+ if(!copyList.at(index).ignoreMode)
+ copyList.at(index).interface->forceCopyMode(copyList.at(index).mode);
+ connectInterfaceAndSync(copyList.count()-1);
+ copyList.at(index).engine->syncTransferList();
+ index++;
+ }
+ }
+ if(error)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the interface, copy aborted");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to load the interface, copy aborted"));
+ }
+ }
}
void Core::unloadInterface()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- index=0;
- loop_size=copyList.size();
- while(index<loop_size)
- {
- if(copyList.at(index).interface!=NULL)
- {
- disconnectInterface(index);
- delete copyList.at(index).interface;
- copyList[index].interface=NULL;
- copyList[index].copyEngineIsSync=false;
- }
- index++;
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ const int &loop_size=copyList.size();
+ while(index<loop_size)
+ {
+ if(copyList.at(index).interface!=NULL)
+ {
+ //disconnectInterface(index);
+ delete copyList.at(index).interface;
+ copyList[index].interface=NULL;
+ copyList[index].copyEngineIsSync=false;
+ }
+ index++;
+ }
}
int Core::incrementId()
{
- do
- {
- nextId++;
- if(nextId>2000000)
- nextId=0;
- } while(idList.contains(nextId));
- return nextId;
+ do
+ {
+ nextId++;
+ if(nextId>2000000)
+ nextId=0;
+ } while(idList.contains(nextId));
+ return nextId;
}
/** open with specific source/destination
@@ -307,13 +287,13 @@ int Core::incrementId()
\param protocolsUsedForTheSources protocols used for sources
\param protocolsUsedForTheDestination protocols used for destination
*/
-int Core::openNewCopyEngineInstance(const CopyMode &mode,const bool &ignoreMode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination)
+int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- CopyEngineManager::returnCopyEngine returnInformations=copyEngineList->getCopyEngine(mode,protocolsUsedForTheSources,protocolsUsedForTheDestination);
- if(returnInformations.engine==NULL)
- return -1;
- return connectCopyEngine(mode,ignoreMode,returnInformations);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ CopyEngineManager::returnCopyEngine returnInformations=copyEngineList->getCopyEngine(mode,protocolsUsedForTheSources,protocolsUsedForTheDestination);
+ if(returnInformations.engine==NULL)
+ return -1;
+ return connectCopyEngine(mode,ignoreMode,returnInformations);
}
/** open with specific copy engine
@@ -322,649 +302,849 @@ int Core::openNewCopyEngineInstance(const CopyMode &mode,const bool &ignoreMode,
\param protocolsUsedForTheSources protocols used for sources
\param protocolsUsedForTheDestination protocols used for destination
*/
-int Core::openNewCopyEngineInstance(const CopyMode &mode,const bool &ignoreMode,const QString &name)
+int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QString &name)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, mode: "+QString::number(mode)+", name: "+name);
- CopyEngineManager::returnCopyEngine returnInformations=copyEngineList->getCopyEngine(mode,name);
- if(returnInformations.engine==NULL)
- return -1;
- return connectCopyEngine(mode,ignoreMode,returnInformations);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, mode: "+QString::number(mode)+", name: "+name);
+ CopyEngineManager::returnCopyEngine returnInformations=copyEngineList->getCopyEngine(mode,name);
+ if(returnInformations.engine==NULL)
+ return -1;
+ return connectCopyEngine(mode,ignoreMode,returnInformations);
}
/** Connect the copy engine instance provided previously to the management */
-int Core::connectCopyEngine(const CopyMode &mode,bool ignoreMode,const CopyEngineManager::returnCopyEngine &returnInformations)
-{
- if(returnInformations.canDoOnlyCopy)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Mode force for unknow reason");
- ignoreMode=false;//force mode if need, normaly not used
- }
- CopyInstance newItem;
- newItem.engine=returnInformations.engine;
- if(newItem.engine!=NULL)
- {
- PluginInterface_Themes *theme=themes->getThemesInstance();
- if(theme!=NULL)
- {
- newItem.id=incrementId();
- newItem.lastProgression=0;
- newItem.interface=theme;
- newItem.ignoreMode=ignoreMode;
- newItem.mode=mode;
- newItem.type=returnInformations.type;
- newItem.transferListOperation=returnInformations.transferListOperation;
- newItem.baseTime=0;
- newItem.numberOfFile=0;
- newItem.numberOfTransferedFile=0;
- newItem.currentProgression=0;
- newItem.totalProgression=0;
- newItem.action=Idle;
- newItem.lastProgression=0;//store the real byte transfered, used in time remaining calculation
- newItem.isPaused=false;
- newItem.baseTime=0;//stored in ms
- newItem.isRunning=false;
- newItem.haveError=false;
- newItem.lastConditionalSync.start();
- newItem.nextConditionalSync=new QTimer();
- newItem.nextConditionalSync->setSingleShot(true);
- newItem.copyEngineIsSync=true;
-
- if(!ignoreMode)
- {
- newItem.interface->forceCopyMode(mode);
- newItem.engine->forceMode(mode);
- }
- if(copyList.size()==0)
- forUpateInformation.start();
- copyList << newItem;
- connectEngine(copyList.count()-1);
- connectInterfaceAndSync(copyList.count()-1);
- return newItem.id;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to load the interface, copy aborted");
- delete newItem.engine;
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to load the interface, copy aborted"));
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to load the copy engine, copy aborted");
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to load the copy engine, copy aborted"));
- }
- return -1;
+int Core::connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,const CopyEngineManager::returnCopyEngine &returnInformations)
+{
+ if(returnInformations.canDoOnlyCopy)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Mode force for unknow reason");
+ ignoreMode=false;//force mode if need, normaly not used
+ }
+ CopyInstance newItem;
+ newItem.engine=returnInformations.engine;
+ if(newItem.engine!=NULL)
+ {
+ PluginInterface_Themes *theme=ThemesManager::themesManager->getThemesInstance();
+ if(theme!=NULL)
+ {
+ newItem.id=incrementId();
+ newItem.lastProgression=0;
+ newItem.interface=theme;
+ newItem.ignoreMode=ignoreMode;
+ newItem.mode=mode;
+ newItem.type=returnInformations.type;
+ newItem.transferListOperation=returnInformations.transferListOperation;
+ newItem.numberOfFile=0;
+ newItem.numberOfTransferedFile=0;
+ newItem.currentProgression=0;
+ newItem.totalProgression=0;
+ newItem.action=Ultracopier::Idle;
+ newItem.lastProgression=0;//store the real byte transfered, used in time remaining calculation
+ newItem.isPaused=false;
+ newItem.isRunning=false;
+ newItem.haveError=false;
+ newItem.lastConditionalSync.start();
+ newItem.nextConditionalSync=new QTimer();
+ newItem.nextConditionalSync->setSingleShot(true);
+ newItem.copyEngineIsSync=true;
+ newItem.canceled=false;
+
+ switch(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("remainingTimeAlgorithm")).toUInt())
+ {
+ default:
+ case 0:
+ newItem.remainingTimeAlgo=Ultracopier::RemainingTimeAlgo_Traditional;
+ break;
+ case 1:
+ newItem.remainingTimeAlgo=Ultracopier::RemainingTimeAlgo_Logarithmic;
+ {
+ int index=0;
+ while(index<ULTRACOPIER_MAXREMAININGTIMECOL)
+ {
+ RemainingTimeLogarithmicColumn remainingTimeLogarithmicColumn;
+ remainingTimeLogarithmicColumn.totalSize=0;
+ remainingTimeLogarithmicColumn.transferedSize=0;
+ newItem.remainingTimeLogarithmicValue << remainingTimeLogarithmicColumn;
+ index++;
+ }
+ }
+ break;
+ }
+
+ if(!ignoreMode)
+ {
+ newItem.interface->forceCopyMode(mode);
+ newItem.engine->forceMode(mode);
+ }
+ if(copyList.size()==0)
+ forUpateInformation.start();
+ copyList << newItem;
+ connectEngine(copyList.count()-1);
+ connectInterfaceAndSync(copyList.count()-1);
+ return newItem.id;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the interface, copy aborted");
+ delete newItem.engine;
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to load the interface, copy aborted"));
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the copy engine, copy aborted");
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to load the copy engine, copy aborted"));
+ }
+ return -1;
}
void Core::resetSpeedDetectedEngine()
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- resetSpeedDetected(index);
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ resetSpeedDetected(index);
}
void Core::resetSpeedDetectedInterface()
{
- int index=indexCopySenderInterface();
- if(index!=-1)
- resetSpeedDetected(index);
+ int index=indexCopySenderInterface();
+ if(index!=-1)
+ resetSpeedDetected(index);
}
void Core::resetSpeedDetected(const int &index)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start on %1").arg(index));
- copyList[index].runningTime.restart();
- copyList[index].lastSpeedDetected.clear();
- copyList[index].lastSpeedTime.clear();
-}
-
-void Core::actionInProgess(const EngineActionInProgress &action)
-{
- index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("action: %1, from %2").arg(action).arg(index));
- //drop here the duplicate action
- if(copyList[index].action==action)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("The copy engine have send 2x the same EngineActionInProgress"));
- return;
- }
- //update time runing for time remaning caculation
- if(action==Copying || action==CopyingAndListing)
- {
- if(!copyList.at(index).isRunning)
- {
- copyList[index].isRunning=true;
- copyList[index].runningTime.restart();
- }
- }
- else
- {
- if(copyList.at(index).isRunning)
- {
- copyList[index].isRunning=false;
- copyList[index].baseTime+=copyList[index].runningTime.elapsed();
- }
- }
- //do sync
- periodicSynchronization(index);
- copyList[index].action=action;
- if(copyList.at(index).interface!=NULL)
- copyList.at(index).interface->actionInProgess(action);
- if(action==Idle)
- {
- index_sub_loop=0;
- loop_size=copyList.at(index).orderId.size();
- while(index_sub_loop<loop_size)
- {
- emit copyCanceled(copyList.at(index).orderId.at(index_sub_loop));
- index_sub_loop++;
- }
- copyList[index].orderId.clear();
- resetSpeedDetected(index);
- }
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the interface sender");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start on %1").arg(index));
+ switch(copyList.at(index).remainingTimeAlgo)
+ {
+ case Ultracopier::RemainingTimeAlgo_Logarithmic:
+ {
+ int sub_index=0;
+ while(sub_index<ULTRACOPIER_MAXREMAININGTIMECOL)
+ {
+ copyList[index].remainingTimeLogarithmicValue[sub_index].lastProgressionSpeed.clear();
+ copyList[index].remainingTimeLogarithmicValue[sub_index].totalSize=0;
+ copyList[index].remainingTimeLogarithmicValue[sub_index].transferedSize=0;
+ sub_index++;
+ }
+ }
+ default:
+ case Ultracopier::RemainingTimeAlgo_Traditional:
+ copyList[index].lastSpeedDetected.clear();
+ copyList[index].lastSpeedTime.clear();
+ copyList[index].lastAverageSpeedDetected.clear();
+ copyList[index].lastAverageSpeedTime.clear();
+ break;
+ }
}
-void Core::newFolderListing(const QString &path)
+void Core::doneTime(const QList<QPair<quint64,quint32> > &timeList)
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- copyList[index].folderListing=path;
- copyList.at(index).interface->newFolderListing(path);
- }
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ switch(copyList.at(index).remainingTimeAlgo)
+ {
+ case Ultracopier::RemainingTimeAlgo_Logarithmic:
+ if(copyList.at(index).remainingTimeLogarithmicValue.size()<ULTRACOPIER_MAXREMAININGTIMECOL)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("bug, copyList.at(index).remainingTimeLogarithmicValue.size() %1 <ULTRACOPIER_MAXREMAININGTIMECOL").arg(copyList.at(index).remainingTimeLogarithmicValue.size()));
+ else
+ {
+ int size=timeList.size();
+ int sub_index=0;
+ while(sub_index<size)
+ {
+ const QPair<quint64,quint32> &timeUnit=timeList.at(sub_index);
+ const quint8 &col=fileCatNumber(timeUnit.first);
+ if(copyList.at(index).remainingTimeLogarithmicValue.size()<=col)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("bug, copyList.at(index).remainingTimeLogarithmicValue.size() %1 < col %2").arg(copyList.at(index).remainingTimeLogarithmicValue.size()).arg(col));
+ break;
+ }
+ else
+ {
+ if(timeUnit.second>0)
+ {
+ copyList[index].remainingTimeLogarithmicValue[col].lastProgressionSpeed << timeUnit.first/timeUnit.second;
+ if(copyList[index].remainingTimeLogarithmicValue[col].lastProgressionSpeed.size()>ULTRACOPIER_MAXVALUESPEEDSTORED)
+ copyList[index].remainingTimeLogarithmicValue[col].lastProgressionSpeed.removeFirst();
+ }
+ }
+ sub_index++;
+ }
+ }
+ default:
+ case Ultracopier::RemainingTimeAlgo_Traditional:
+ break;
+ }
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the interface sender");
}
-void Core::newCollisionAction(const QString &action)
+void Core::actionInProgess(const Ultracopier::EngineActionInProgress &action)
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- copyList[index].collisionAction=action;
- copyList.at(index).interface->newCollisionAction(action);
- }
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("action: %1, from %2").arg(action).arg(index));
+ //drop here the duplicate action
+ if(copyList.at(index).action==action)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("The copy engine have send 2x the same EngineActionInProgress"));
+ return;
+ }
+ //update time runing for time remaning caculation
+ if(action==Ultracopier::Copying || action==Ultracopier::CopyingAndListing)
+ {
+ if(!copyList.at(index).isRunning)
+ copyList[index].isRunning=true;
+ }
+ else
+ {
+ if(copyList.at(index).isRunning)
+ copyList[index].isRunning=false;
+ }
+ //do sync
+ periodicSynchronizationWithIndex(index);
+ copyList[index].action=action;
+ if(copyList.at(index).interface!=NULL)
+ copyList.at(index).interface->actionInProgess(action);
+ if(action==Ultracopier::Idle)
+ {
+ int index_sub_loop=0;
+ const int &loop_size=copyList.at(index).orderId.size();
+ while(index_sub_loop<loop_size)
+ {
+ emit copyCanceled(copyList.at(index).orderId.at(index_sub_loop));
+ index_sub_loop++;
+ }
+ copyList[index].orderId.clear();
+ resetSpeedDetected(index);
+ }
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the interface sender");
}
-void Core::newErrorAction(const QString &action)
+void Core::newFolderListing(const QString &path)
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- copyList[index].errorAction=action;
- copyList.at(index).interface->newErrorAction(action);
- }
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ copyList[index].folderListing=path;
+ copyList.at(index).interface->newFolderListing(path);
+ }
}
void Core::isInPause(const bool &isPaused)
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- if(!isPaused)
- resetSpeedDetected(index);
- copyList[index].isPaused=isPaused;
- copyList.at(index).interface->isInPause(isPaused);
- }
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ if(!isPaused)
+ resetSpeedDetected(index);
+ copyList[index].isPaused=isPaused;
+ copyList.at(index).interface->isInPause(isPaused);
+ }
}
/// \brief get the right copy instance (copy engine + interface), by signal emited from copy engine
int Core::indexCopySenderCopyEngine()
{
- QObject * senderObject=sender();
- if(senderObject==NULL)
- {
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Qt sender() NULL");
- return -1;
- }
- index=0;
- loop_size=copyList.size();
- while(index<loop_size)
- {
- if(copyList.at(index).engine==senderObject)
- return index;
- index++;
- }
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Sender not located in the list");
- return -1;
+ const QObject * senderObject=sender();
+ if(senderObject==NULL)
+ {
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender() NULL");
+ return -1;
+ }
+ int index=0;
+ const int &loop_size=copyList.size();
+ while(index<loop_size)
+ {
+ if(copyList.at(index).engine==senderObject)
+ return index;
+ index++;
+ }
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Sender not located in the list");
+ return -1;
}
/// \brief get the right copy instance (copy engine + interface), by signal emited from interface
int Core::indexCopySenderInterface()
{
- QObject * senderObject=sender();
- if(senderObject==NULL)
- {
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Qt sender() NULL");
- return -1;
- }
- index=0;
- loop_size=copyList.size();
- while(index<loop_size)
- {
- if(copyList.at(index).interface==senderObject)
- return index;
- index++;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to locate QObject * sender");
- PluginInterface_Themes * interface = qobject_cast<PluginInterface_Themes *>(senderObject);
- if(interface==NULL)
- {
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Qt sender themes NULL");
- return -1;
- }
- index=0;
- while(index<loop_size)
- {
- if(copyList.at(index).interface==interface)
- return index;
- index++;
- }
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Sender not located in the list");
- return -1;
+ QObject * senderObject=sender();
+ if(senderObject==NULL)
+ {
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender() NULL");
+ return -1;
+ }
+ int index=0;
+ const int &loop_size=copyList.size();
+ while(index<loop_size)
+ {
+ if(copyList.at(index).interface==senderObject)
+ return index;
+ index++;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to locate QObject * sender");
+ PluginInterface_Themes * interface = qobject_cast<PluginInterface_Themes *>(senderObject);
+ if(interface==NULL)
+ {
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender themes NULL");
+ return -1;
+ }
+ index=0;
+ while(index<loop_size)
+ {
+ if(copyList.at(index).interface==interface)
+ return index;
+ index++;
+ }
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Sender not located in the list");
+ return -1;
}
void Core::connectEngine(const int &index)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start with index: %1: %2").arg(index).arg((quint64)sender()));
- disconnectEngine(index);
-
- CopyInstance& currentCopyInstance=copyList[index];
- if(!connect(currentCopyInstance.engine,SIGNAL(newFolderListing(QString)), this,SLOT(newFolderListing(QString)),Qt::QueuedConnection))//to check to change
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for newFolderListing()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(newCollisionAction(QString)), this,SLOT(newCollisionAction(QString)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for newCollisionAction()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(newErrorAction(QString)), this,SLOT(newErrorAction(QString)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for newErrorAction()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(actionInProgess(EngineActionInProgress)), this,SLOT(actionInProgess(EngineActionInProgress)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for actionInProgess()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(isInPause(bool)), this,SLOT(isInPause(bool)),Qt::QueuedConnection))//to check to change
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for isInPause()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(cancelAll()), this,SLOT(copyInstanceCanceledByEngine()),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for cancelAll()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(error(QString,quint64,QDateTime,QString)), this,SLOT(error(QString,quint64,QDateTime,QString)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for error()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(rmPath(QString)), this,SLOT(rmPath(QString)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for rmPath()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(mkPath(QString)), this,SLOT(mkPath(QString)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for mkPath()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(syncReady()), this,SLOT(syncReady()),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for syncReady()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(canBeDeleted()), this,SLOT(deleteCopyEngine()),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the engine can not work correctly: %1: %2 for syncReady()").arg(index).arg((quint64)sender()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start with index: %1: %2").arg(index).arg((quint64)sender()));
+ //disconnectEngine(index);
+
+ CopyInstance& currentCopyInstance=copyList[index];
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::newFolderListing, this,&Core::newFolderListing,Qt::QueuedConnection))//to check to change
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for newFolderListing()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::actionInProgess, this,&Core::actionInProgess,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for actionInProgess()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::isInPause, this,&Core::isInPause,Qt::QueuedConnection))//to check to change
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for isInPause()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::cancelAll, this,&Core::copyInstanceCanceledByEngine,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for cancelAll()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::error, this,&Core::error,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for error()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::rmPath, this,&Core::rmPath,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for rmPath()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::mkPath, this,&Core::mkPath,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for mkPath()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::syncReady, this,&Core::syncReady,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for syncReady()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::canBeDeleted, this,&Core::deleteCopyEngine,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for syncReady()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::doneTime, this,&Core::doneTime,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for doneTime()").arg(index).arg((quint64)sender()));
}
void Core::connectInterfaceAndSync(const int &index)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start with index: %1: %2").arg(index).arg((quint64)sender()));
- disconnectInterface(index);
-
- CopyInstance& currentCopyInstance=copyList[index];
- if(!connect(currentCopyInstance.interface,SIGNAL(pause()), currentCopyInstance.engine,SLOT(pause())))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for pause()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(resume()), currentCopyInstance.engine,SLOT(resume())))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for resume()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(skip(quint64)), currentCopyInstance.engine,SLOT(skip(quint64))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for skip()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(sendErrorAction(QString)), currentCopyInstance.engine,SLOT(setErrorAction(QString))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for sendErrorAction()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(newSpeedLimitation(qint64)), currentCopyInstance.engine,SLOT(setSpeedLimitation(qint64))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for newSpeedLimitation()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(sendCollisionAction(QString)), currentCopyInstance.engine,SLOT(setCollisionAction(QString))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for sendCollisionAction()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(userAddFolder(CopyMode)), currentCopyInstance.engine,SLOT(userAddFolder(CopyMode))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for userAddFolder()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(userAddFile(CopyMode)), currentCopyInstance.engine,SLOT(userAddFile(CopyMode))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for userAddFile()").arg(index).arg((quint64)sender()));
-
- if(!connect(currentCopyInstance.interface,SIGNAL(removeItems(QList<int>)), currentCopyInstance.engine,SLOT(removeItems(QList<int>))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for removeItems()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(moveItemsOnTop(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsOnTop(QList<int>))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for moveItemsOnTop()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(moveItemsUp(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsUp(QList<int>))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for moveItemsUp()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(moveItemsDown(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsDown(QList<int>))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for moveItemsDown()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(moveItemsOnBottom(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsOnBottom(QList<int>))))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for moveItemsOnBottom()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(exportTransferList()), currentCopyInstance.engine,SLOT(exportTransferList())))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for exportTransferList()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(importTransferList()), currentCopyInstance.engine,SLOT(importTransferList())))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for importTransferList()").arg(index).arg((quint64)sender()));
-
- if(!connect(currentCopyInstance.interface,SIGNAL(newSpeedLimitation(qint64)), this,SLOT(resetSpeedDetectedInterface())))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for newSpeedLimitation()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(resume()), this,SLOT(resetSpeedDetectedInterface())))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for resume()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(cancel()), this,SLOT(copyInstanceCanceledByInterface()),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for cancel()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.interface,SIGNAL(urlDropped(QList<QUrl>)), this,SLOT(urlDropped(QList<QUrl>)),Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for urlDropped()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(newActionOnList(QList<returnActionOnCopyList>)),this,SLOT(getActionOnList(QList<returnActionOnCopyList>)), Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for newActionOnList()").arg(index).arg((quint64)sender()));
-
- if(!connect(currentCopyInstance.engine,SIGNAL(pushFileProgression(QList<ProgressionItem>)), currentCopyInstance.interface,SLOT(setFileProgression(QList<ProgressionItem>)), Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for pushFileProgression()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(pushGeneralProgression(quint64,quint64)), currentCopyInstance.interface,SLOT(setGeneralProgression(quint64,quint64)), Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for pushGeneralProgression()").arg(index).arg((quint64)sender()));
- if(!connect(currentCopyInstance.engine,SIGNAL(pushGeneralProgression(quint64,quint64)), this,SLOT(pushGeneralProgression(quint64,quint64)), Qt::QueuedConnection))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,QString("error at connect, the interface can not work correctly: %1: %2 for pushGeneralProgression() for this").arg(index).arg((quint64)sender()));
-
- currentCopyInstance.interface->setSpeedLimitation(currentCopyInstance.engine->getSpeedLimitation());
- currentCopyInstance.interface->setErrorAction(currentCopyInstance.engine->getErrorAction());
- currentCopyInstance.interface->setCollisionAction(currentCopyInstance.engine->getCollisionAction());
- currentCopyInstance.interface->setCopyType(currentCopyInstance.type);
- currentCopyInstance.interface->setTransferListOperation(currentCopyInstance.transferListOperation);
- currentCopyInstance.interface->actionInProgess(currentCopyInstance.action);
- currentCopyInstance.interface->isInPause(currentCopyInstance.isPaused);
- if(currentCopyInstance.haveError)
- currentCopyInstance.interface->errorDetected();
- QWidget *tempWidget=currentCopyInstance.interface->getOptionsEngineWidget();
- if(tempWidget!=NULL)
- currentCopyInstance.interface->getOptionsEngineEnabled(currentCopyInstance.engine->getOptionsEngine(tempWidget));
- //important, to have the modal dialog
- currentCopyInstance.engine->setInterfacePointer(currentCopyInstance.interface);
-
- //put entry into the interface
- currentCopyInstance.engine->syncTransferList();
-
- //force the updating, without wait the timer
- periodicSynchronization(index);
-}
-
-void Core::disconnectEngine(const int &index)
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start with index: %1").arg(index));
-// CopyInstance& currentCopyInstance=copyList[index];
-/* disconnect(currentCopyInstance.engine,SIGNAL(newFolderListing(QString)), this,SLOT(newFolderListing(QString)));//to check to change
- disconnect(currentCopyInstance.engine,SIGNAL(newCollisionAction(QString)), this,SLOT(newCollisionAction(QString)));
- disconnect(currentCopyInstance.engine,SIGNAL(newErrorAction(QString)), this,SLOT(newErrorAction(QString)));
- disconnect(currentCopyInstance.engine,SIGNAL(actionInProgess(EngineActionInProgress)), this,SLOT(actionInProgess(EngineActionInProgress)));
- disconnect(currentCopyInstance.engine,SIGNAL(isInPause(bool)), this,SLOT(isInPause(bool)));//to check to change
- disconnect(currentCopyInstance.engine,SIGNAL(cancelAll()), this,SLOT(copyInstanceCanceledByEngine()));
- disconnect(currentCopyInstance.engine,SIGNAL(error(QString,quint64,QDateTime,QString)), this,SLOT(error(QString,quint64,QDateTime,QString)));
- disconnect(currentCopyInstance.engine,SIGNAL(rmPath(QString)), this,SLOT(rmPath(QString)));
- disconnect(currentCopyInstance.engine,SIGNAL(mkPath(QString)), this,SLOT(mkPath(QString)));*/
-
-}
-
-void Core::disconnectInterface(const int &index)
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start with index: %1").arg(index));
- Q_UNUSED(index);
-/* CopyInstance& currentCopyInstance=copyList[index];
- disconnect(currentCopyInstance.interface,SIGNAL(pause()), currentCopyInstance.engine,SLOT(pause()));
- disconnect(currentCopyInstance.interface,SIGNAL(resume()), currentCopyInstance.engine,SLOT(resume()));
- disconnect(currentCopyInstance.interface,SIGNAL(skip(quint64)), currentCopyInstance.engine,SLOT(skip(quint64)));
- disconnect(currentCopyInstance.interface,SIGNAL(sendErrorAction(QString)), currentCopyInstance.engine,SLOT(setErrorAction(QString)));
- disconnect(currentCopyInstance.interface,SIGNAL(newSpeedLimitation(qint64)), currentCopyInstance.engine,SLOT(setSpeedLimitation(qint64)));
- disconnect(currentCopyInstance.interface,SIGNAL(sendCollisionAction(QString)), currentCopyInstance.engine,SLOT(setCollisionAction(QString)));
- disconnect(currentCopyInstance.interface,SIGNAL(userAddFolder(CopyMode)), currentCopyInstance.engine,SLOT(userAddFolder(CopyMode)));
- disconnect(currentCopyInstance.interface,SIGNAL(userAddFile(CopyMode)), currentCopyInstance.engine,SLOT(userAddFile(CopyMode)));
-
- disconnect(currentCopyInstance.interface,SIGNAL(removeItems(QList<int>)), currentCopyInstance.engine,SLOT(removeItems(QList<int>)));
- disconnect(currentCopyInstance.interface,SIGNAL(moveItemsOnTop(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsOnTop(QList<int>)));
- disconnect(currentCopyInstance.interface,SIGNAL(moveItemsUp(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsUp(QList<int>)));
- disconnect(currentCopyInstance.interface,SIGNAL(moveItemsDown(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsDown(QList<int>)));
- disconnect(currentCopyInstance.interface,SIGNAL(moveItemsOnBottom(QList<int>)), currentCopyInstance.engine,SLOT(moveItemsOnBottom(QList<int>)));
-
- disconnect(currentCopyInstance.interface,SIGNAL(newSpeedLimitation(qint64)), this,SLOT(resetSpeedDetectedInterface()));
- disconnect(currentCopyInstance.interface,SIGNAL(resume()), this,SLOT(resetSpeedDetectedInterface()));
- disconnect(currentCopyInstance.interface,SIGNAL(cancel()), this,SLOT(copyInstanceCanceledByInterface()));
- disconnect(currentCopyInstance.interface,SIGNAL(urlDropped(QList<QUrl>)), this,SLOT(urlDropped(QList<QUrl>)));
-
- disconnect(currentCopyInstance.engine,SIGNAL(newActionOnList(QList<returnActionOnCopyList>)), currentCopyInstance.interface,SLOT(getActionOnList(QList<returnActionOnCopyList>)));
- disconnect(currentCopyInstance.engine,SIGNAL(pushFileProgression(QList<ProgressionItem>)), currentCopyInstance.interface,SLOT(setFileProgression(QList<ProgressionItem>)));
- disconnect(currentCopyInstance.engine,SIGNAL(pushGeneralProgression(quint64,quint64)), currentCopyInstance.interface,SLOT(setGeneralProgression(quint64,quint64)));*/
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start with index: %1: %2").arg(index).arg((quint64)sender()));
+ //disconnectInterface(index);
+
+ CopyInstance& currentCopyInstance=copyList[index];
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::pause, currentCopyInstance.engine,&PluginInterface_CopyEngine::pause))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pause()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::resume, currentCopyInstance.engine,&PluginInterface_CopyEngine::resume))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for resume()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::skip, currentCopyInstance.engine,&PluginInterface_CopyEngine::skip))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for skip()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::newSpeedLimitation, currentCopyInstance.engine,&PluginInterface_CopyEngine::setSpeedLimitation))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for newSpeedLimitation()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::userAddFolder, currentCopyInstance.engine,&PluginInterface_CopyEngine::userAddFolder))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for userAddFolder()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::userAddFile, currentCopyInstance.engine,&PluginInterface_CopyEngine::userAddFile))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for userAddFile()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::removeItems, currentCopyInstance.engine,&PluginInterface_CopyEngine::removeItems))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for removeItems()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsOnTop, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsOnTop))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsOnTop()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsUp, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsUp))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsUp()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsDown, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsDown))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsDown()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsOnBottom, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsOnBottom))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsOnBottom()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::exportTransferList, currentCopyInstance.engine,&PluginInterface_CopyEngine::exportTransferList))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for exportTransferList()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::exportErrorIntoTransferList, currentCopyInstance.engine,&PluginInterface_CopyEngine::exportErrorIntoTransferList))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for exportErrorIntoTransferList()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::importTransferList, currentCopyInstance.engine,&PluginInterface_CopyEngine::importTransferList))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for importTransferList()").arg(index).arg((quint64)sender()));
+
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::newSpeedLimitation, this,&Core::resetSpeedDetectedInterface))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for newSpeedLimitation()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::resume, this,&Core::resetSpeedDetectedInterface))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for resume()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::cancel, this,&Core::copyInstanceCanceledByInterface,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for cancel()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::urlDropped, this,&Core::urlDropped,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for urlDropped()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::newActionOnList,this,&Core::getActionOnList, Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for newActionOnList()").arg(index).arg((quint64)sender()));
+
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushFileProgression, currentCopyInstance.interface,&PluginInterface_Themes::setFileProgression, Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pushFileProgression()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushGeneralProgression, currentCopyInstance.interface,&PluginInterface_Themes::setGeneralProgression, Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pushGeneralProgression()").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushGeneralProgression, this,&Core::pushGeneralProgression, Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pushGeneralProgression() for this").arg(index).arg((quint64)sender()));
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::errorToRetry, currentCopyInstance.interface,&PluginInterface_Themes::errorToRetry, Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for errorToRetry() for this").arg(index).arg((quint64)sender()));
+
+ currentCopyInstance.interface->setSupportSpeedLimitation(currentCopyInstance.engine->supportSpeedLimitation());
+ currentCopyInstance.interface->setCopyType(currentCopyInstance.type);
+ currentCopyInstance.interface->setTransferListOperation(currentCopyInstance.transferListOperation);
+ currentCopyInstance.interface->actionInProgess(currentCopyInstance.action);
+ currentCopyInstance.interface->isInPause(currentCopyInstance.isPaused);
+ if(currentCopyInstance.haveError)
+ currentCopyInstance.interface->errorDetected();
+ QWidget *tempWidget=currentCopyInstance.interface->getOptionsEngineWidget();
+ if(tempWidget!=NULL)
+ currentCopyInstance.interface->getOptionsEngineEnabled(currentCopyInstance.engine->getOptionsEngine(tempWidget));
+ //important, to have the modal dialog
+ currentCopyInstance.engine->setInterfacePointer(currentCopyInstance.interface);
+
+ //put entry into the interface
+ currentCopyInstance.engine->syncTransferList();
+
+ //force the updating, without wait the timer
+ periodicSynchronizationWithIndex(index);
}
void Core::periodicSynchronization()
{
- index_sub_loop=0;
- loop_size=copyList.size();
- while(index_sub_loop<loop_size)
- {
- if(copyList.at(index_sub_loop).action==Copying || copyList.at(index_sub_loop).action==CopyingAndListing)
- periodicSynchronization(index_sub_loop);
- index_sub_loop++;
- }
-}
-
-void Core::periodicSynchronization(const int &index)
-{
- CopyInstance& currentCopyInstance=copyList[index];
- if(currentCopyInstance.engine==NULL || currentCopyInstance.interface==NULL)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"some thread is null");
- return;
- }
-
- /** ***************** Do time calcul ******************* **/
- if(!currentCopyInstance.isPaused)
- {
- //calcul the last difference of the transfere
- realByteTransfered=currentCopyInstance.engine->realByteTransfered();
- diffCopiedSize=0;
- if(realByteTransfered>=currentCopyInstance.lastProgression)
- diffCopiedSize=realByteTransfered-currentCopyInstance.lastProgression;
- currentCopyInstance.lastProgression=realByteTransfered;
-
- // algo 1:
- // ((double)currentProgression)/totalProgression -> example: done 80% -> 0.8
- // baseTime+runningTime -> example: done into 80s, remaining time: 80/0.8-80=80*(1/0.8-1)=20s
- // algo 2 (not used):
- // remaining byte/current speed
-
- transferAddedTime=currentCopyInstance.baseTime+currentCopyInstance.runningTime.elapsed();
-
- //remaining time: (total byte - lastProgression)/byte per ms since the start
- if(currentCopyInstance.totalProgression==0 || currentCopyInstance.currentProgression==0)
- currentCopyInstance.interface->remainingTime(-1);
- else
- currentCopyInstance.interface->remainingTime(transferAddedTime*((double)currentCopyInstance.totalProgression/(double)currentCopyInstance.currentProgression-1)/1000);
-
- //do the speed calculation
- if(lastProgressionTime.isNull())
- lastProgressionTime.start();
- else
- {
- if((currentCopyInstance.action==Copying || currentCopyInstance.action==CopyingAndListing))
- {
- currentCopyInstance.lastSpeedTime << lastProgressionTime.elapsed();
- currentCopyInstance.lastSpeedDetected << diffCopiedSize;
- while(currentCopyInstance.lastSpeedDetected.size()>ULTRACOPIER_MAXVALUESPEEDSTORED)
- {
- currentCopyInstance.lastSpeedTime.removeFirst();
- currentCopyInstance.lastSpeedDetected.removeFirst();
- }
- totTime=0;
- totSpeed=0;
- index_sub_loop=0;
- loop_size=currentCopyInstance.lastSpeedDetected.size();
- while(index_sub_loop<loop_size)
- {
- totTime+=currentCopyInstance.lastSpeedTime.at(index_sub_loop);
- totSpeed+=currentCopyInstance.lastSpeedDetected.at(index_sub_loop);
- index_sub_loop++;
- }
- totTime/=1000;
- currentCopyInstance.interface->detectedSpeed(totSpeed/totTime);
- }
- lastProgressionTime.restart();
- }
- }
+ int index_sub_loop=0;
+ const int &loop_size=copyList.size();
+ while(index_sub_loop<loop_size)
+ {
+ if(copyList.at(index_sub_loop).action==Ultracopier::Copying || copyList.at(index_sub_loop).action==Ultracopier::CopyingAndListing)
+ periodicSynchronizationWithIndex(index_sub_loop);
+ index_sub_loop++;
+ }
+}
+
+void Core::periodicSynchronizationWithIndex(const int &index)
+{
+ CopyInstance& currentCopyInstance=copyList[index];
+ if(currentCopyInstance.engine==NULL || currentCopyInstance.interface==NULL)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"some thread is null");
+ return;
+ }
+
+ /** ***************** Do time calcul ******************* **/
+ if(!currentCopyInstance.isPaused)
+ {
+ //calcul the last difference of the transfere
+ realByteTransfered=currentCopyInstance.engine->realByteTransfered();
+ quint64 diffCopiedSize=0;
+ if(realByteTransfered>=currentCopyInstance.lastProgression)
+ diffCopiedSize=realByteTransfered-currentCopyInstance.lastProgression;
+ currentCopyInstance.lastProgression=realByteTransfered;
+
+ // algo 1:
+ // ((double)currentProgression)/totalProgression -> example: done 80% -> 0.8
+ // baseTime+runningTime -> example: done into 80s, remaining time: 80/0.8-80=80*(1/0.8-1)=20s
+ // algo 2 (not used):
+ // remaining byte/current speed
+
+ //remaining time: (total byte - lastProgression)/byte per ms since the start
+ /*if(currentCopyInstance.totalProgression==0 || currentCopyInstance.currentProgression==0)
+ currentCopyInstance.interface->remainingTime(-1);
+ else if((currentCopyInstance.totalProgression-currentCopyInstance.currentProgression)>1024)
+ currentCopyInstance.interface->remainingTime(transferAddedTime*((double)currentCopyInstance.totalProgression/(double)currentCopyInstance.currentProgression-1)/1000);*/
+
+ //do the speed calculation
+ if(lastProgressionTime.isNull())
+ lastProgressionTime.start();
+ else
+ {
+ if((currentCopyInstance.action==Ultracopier::Copying || currentCopyInstance.action==Ultracopier::CopyingAndListing))
+ {
+ currentCopyInstance.lastSpeedTime << lastProgressionTime.elapsed();
+ currentCopyInstance.lastSpeedDetected << diffCopiedSize;
+ currentCopyInstance.lastAverageSpeedTime << lastProgressionTime.elapsed();
+ currentCopyInstance.lastAverageSpeedDetected << diffCopiedSize;
+ while(currentCopyInstance.lastSpeedTime.size()>ULTRACOPIER_MAXVALUESPEEDSTORED)
+ currentCopyInstance.lastSpeedTime.removeFirst();
+ while(currentCopyInstance.lastSpeedDetected.size()>ULTRACOPIER_MAXVALUESPEEDSTORED)
+ currentCopyInstance.lastSpeedDetected.removeFirst();
+ while(currentCopyInstance.lastAverageSpeedTime.size()>ULTRACOPIER_MAXVALUESPEEDSTOREDTOREMAININGTIME)
+ currentCopyInstance.lastAverageSpeedTime.removeFirst();
+ while(currentCopyInstance.lastAverageSpeedDetected.size()>ULTRACOPIER_MAXVALUESPEEDSTOREDTOREMAININGTIME)
+ currentCopyInstance.lastAverageSpeedDetected.removeFirst();
+ double totTime=0,totAverageTime=0;
+ double totSpeed=0,totAverageSpeed=0;
+
+ //current speed
+ int index_sub_loop=0;
+ int loop_size=currentCopyInstance.lastSpeedDetected.size();
+ while(index_sub_loop<loop_size)
+ {
+ totTime+=currentCopyInstance.lastSpeedTime.at(index_sub_loop);
+ totSpeed+=currentCopyInstance.lastSpeedDetected.at(index_sub_loop);
+ index_sub_loop++;
+ }
+ totTime/=1000;
+
+ //speed to calculate the remaining time
+ index_sub_loop=0;
+ loop_size=currentCopyInstance.lastAverageSpeedDetected.size();
+ while(index_sub_loop<loop_size)
+ {
+ totAverageTime+=currentCopyInstance.lastAverageSpeedTime.at(index_sub_loop);
+ totAverageSpeed+=currentCopyInstance.lastAverageSpeedDetected.at(index_sub_loop);
+ index_sub_loop++;
+ }
+ totAverageTime/=1000;
+
+ if(totTime>0)
+ if(loop_size>=ULTRACOPIER_MINVALUESPEED)
+ currentCopyInstance.interface->detectedSpeed(totSpeed/totTime);
+
+ if(totAverageTime>0)
+ if(loop_size>=ULTRACOPIER_MINVALUESPEEDTOREMAININGTIME)
+ {
+ if(currentCopyInstance.remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Traditional)
+ {
+ if(totSpeed>0)
+ {
+ //remaining time: (total byte - lastProgression)/byte per ms since the start
+ if(currentCopyInstance.totalProgression==0 || currentCopyInstance.currentProgression==0)
+ currentCopyInstance.interface->remainingTime(-1);
+ else if((currentCopyInstance.totalProgression-currentCopyInstance.currentProgression)>1024)
+ currentCopyInstance.interface->remainingTime((currentCopyInstance.totalProgression-currentCopyInstance.currentProgression)/(totAverageSpeed/totAverageTime));
+ }
+ else
+ currentCopyInstance.interface->remainingTime(-1);
+ }
+ else if(currentCopyInstance.remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ int remainingTimeValue=0;
+ //calculate for each file class
+ index_sub_loop=0;
+ loop_size=currentCopyInstance.remainingTimeLogarithmicValue.size();
+ while(index_sub_loop<loop_size)
+ {
+ const RemainingTimeLogarithmicColumn &remainingTimeLogarithmicColumn=currentCopyInstance.remainingTimeLogarithmicValue.at(index_sub_loop);
+ //normal detect
+ const quint64 &remainingSize=remainingTimeLogarithmicColumn.totalSize-remainingTimeLogarithmicColumn.transferedSize;
+ if(remainingTimeLogarithmicColumn.lastProgressionSpeed.size()>=ULTRACOPIER_MINVALUESPEED)
+ {
+ int average_speed=0;
+ int temp_loop_index=0;
+ while(temp_loop_index<remainingTimeLogarithmicColumn.lastProgressionSpeed.size())
+ {
+ average_speed+=remainingTimeLogarithmicColumn.lastProgressionSpeed.at(temp_loop_index);
+ temp_loop_index++;
+ }
+ average_speed/=remainingTimeLogarithmicColumn.lastProgressionSpeed.size();
+ remainingTimeValue+=remainingSize/average_speed;
+ }
+ //fallback
+ else
+ {
+ if(totSpeed>0)
+ {
+ //remaining time: (total byte - lastProgression)/byte per ms since the start
+ if(currentCopyInstance.totalProgression==0 || currentCopyInstance.currentProgression==0)
+ remainingTimeValue+=1;
+ else if((currentCopyInstance.totalProgression-currentCopyInstance.currentProgression)>1024)
+ remainingTimeValue+=remainingSize/totAverageSpeed;
+ }
+ else
+ remainingTimeValue+=1;
+ }
+ index_sub_loop++;
+ }
+ currentCopyInstance.interface->remainingTime(remainingTimeValue);
+ }
+ else
+ {}//error case
+ }
+ }
+ lastProgressionTime.restart();
+ }
+ }
+}
+
+quint8 Core::fileCatNumber(quint64 size)
+{
+ //all is in base 10 to understand more easily
+ //drop the big value
+ if(size>ULTRACOPIER_REMAININGTIME_BIGFILEMEGABYTEBASE10*1000*1000)
+ size=ULTRACOPIER_REMAININGTIME_BIGFILEMEGABYTEBASE10*1000*1000;
+ size=size/100;//to group all the too small file into the value 0
+ return log10(size);
}
/// \brief the copy engine have canceled the transfer
void Core::copyInstanceCanceledByEngine()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- copyInstanceCanceledByIndex(index);
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ copyInstanceCanceledByIndex(index);
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
}
/// \brief the interface have canceled the transfer
void Core::copyInstanceCanceledByInterface()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=indexCopySenderInterface();
- if(index!=-1)
- copyInstanceCanceledByIndex(index);
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=indexCopySenderInterface();
+ if(index!=-1)
+ copyInstanceCanceledByIndex(index);
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
}
/// \brief the transfer have been canceled
void Core::copyInstanceCanceledByIndex(const int &index)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, remove with the index: "+QString::number(index));
- disconnectEngine(index);
- disconnectInterface(index);
- CopyInstance& currentCopyInstance=copyList[index];
- currentCopyInstance.engine->cancel();
- delete currentCopyInstance.nextConditionalSync;
- currentCopyInstance.engine->cancel();
- delete currentCopyInstance.interface;
- index_sub_loop=0;
- loop_size=currentCopyInstance.orderId.size();
- while(index_sub_loop<loop_size)
- {
- emit copyCanceled(currentCopyInstance.orderId.at(index_sub_loop));
- index_sub_loop++;
- }
- currentCopyInstance.orderId.clear();
- copyList.removeAt(index);
- if(copyList.size()==0)
- forUpateInformation.stop();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"copyList.size(): "+QString::number(copyList.size()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, remove with the index: "+QString::number(index));
+ //disconnectEngine(index);
+ //disconnectInterface(index);
+ copyList[index].canceled=true;
+ CopyInstance& currentCopyInstance=copyList[index];
+ currentCopyInstance.engine->cancel();
+ delete currentCopyInstance.nextConditionalSync;
+ delete currentCopyInstance.interface;
+ int index_sub_loop=0;
+ const int &loop_size=currentCopyInstance.orderId.size();
+ while(index_sub_loop<loop_size)
+ {
+ emit copyCanceled(currentCopyInstance.orderId.at(index_sub_loop));
+ index_sub_loop++;
+ }
+ currentCopyInstance.orderId.clear();
+ copyList.removeAt(index);
+ if(copyList.size()==0)
+ forUpateInformation.stop();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyList.size(): "+QString::number(copyList.size()));
}
/// \brief only when the copy engine say it's ready to delete them self, it call this
void Core::deleteCopyEngine()
{
- QObject * senderObject=sender();
- if(senderObject==NULL)
- {
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Qt sender() NULL");
- return;
- }
- PluginInterface_CopyEngine * copyEngine = static_cast<PluginInterface_CopyEngine *>(senderObject);
- if(copyEngine==NULL)
- {
- //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Qt sender() NULL");
- return;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, delete the copy engine");
- delete copyEngine;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"stop, delete the copy engine");
+ QObject * senderObject=sender();
+ if(senderObject==NULL)
+ {
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender() NULL");
+ return;
+ }
+ PluginInterface_CopyEngine * copyEngine = static_cast<PluginInterface_CopyEngine *>(senderObject);
+ if(copyEngine==NULL)
+ {
+ //QMessageBox::critical(NULL,tr("Internal error"),tr("A communication error occured between the interface and the copy plugin. Please report this bug."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender() NULL");
+ return;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, delete the copy engine");
+ delete copyEngine;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"stop, delete the copy engine");
}
//error occurred
void Core::error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error)
{
- log.error(path,size,mtime,error);
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- copyList[index].haveError=true;
- copyList.at(index).interface->errorDetected();
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ log.error(path,size,mtime,error);
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ copyList[index].haveError=true;
+ copyList.at(index).interface->errorDetected();
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
}
//for the extra logging
void Core::rmPath(const QString &path)
{
- log.rmPath(path);
+ log.rmPath(path);
}
void Core::mkPath(const QString &path)
{
- log.mkPath(path);
+ log.mkPath(path);
}
/// \brief to rsync after a new interface connection
void Core::syncReady()
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- copyList[index].copyEngineIsSync=true;
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ copyList[index].copyEngineIsSync=true;
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
}
-void Core::getActionOnList(const QList<returnActionOnCopyList> & actionList)
+void Core::getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> &actionList)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- if(copyList[index].copyEngineIsSync)
- copyList[index].interface->getActionOnList(actionList);
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ //send the the interface
+ const int &index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start2"));
+ if(copyList.at(index).copyEngineIsSync)
+ copyList.at(index).interface->getActionOnList(actionList);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start3"));
+ //log to the file and compute the remaining time
+ if(log.logTransfer() || copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start4"));
+ int sub_index=0;
+ const int &size=actionList.size();
+ if(log.logTransfer() && copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start5"));
+ while(sub_index<size)
+ {
+ const Ultracopier::ReturnActionOnCopyList &returnAction=actionList.at(sub_index);
+ switch(returnAction.type)
+ {
+ case Ultracopier::PreOperation:
+ log.newTransferStart(returnAction.addAction);
+ break;
+ case Ultracopier::RemoveItem:
+ if(returnAction.userAction.moveAt==0)
+ log.newTransferStop(returnAction.addAction);
+ else
+ log.transferSkip(returnAction.addAction);
+ if(copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ const quint8 &col=fileCatNumber(returnAction.addAction.size);
+ copyList[index].remainingTimeLogarithmicValue[col].transferedSize+=returnAction.addAction.size;
+ }
+ break;
+ case Ultracopier::AddingItem:
+ if(copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ const quint8 &col=fileCatNumber(returnAction.addAction.size);
+ copyList[index].remainingTimeLogarithmicValue[col].totalSize+=returnAction.addAction.size;
+ }
+ break;
+ default:
+ break;
+ }
+ sub_index++;
+ }
+ }
+ else if(log.logTransfer())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start6"));
+ while(sub_index<size)
+ {
+ const Ultracopier::ReturnActionOnCopyList &returnAction=actionList.at(sub_index);
+ switch(returnAction.type)
+ {
+ case Ultracopier::PreOperation:
+ log.newTransferStart(returnAction.addAction);
+ break;
+ case Ultracopier::RemoveItem:
+ if(returnAction.userAction.moveAt==0)
+ log.newTransferStop(returnAction.addAction);
+ else
+ log.transferSkip(returnAction.addAction);
+ if(copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ const quint8 &col=fileCatNumber(returnAction.addAction.size);
+ copyList[index].remainingTimeLogarithmicValue[col].transferedSize+=returnAction.addAction.size;
+ }
+ break;
+ default:
+ break;
+ }
+ sub_index++;
+ }
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start7"));
+ while(sub_index<size)
+ {
+ const Ultracopier::ReturnActionOnCopyList &returnAction=actionList.at(sub_index);
+ switch(returnAction.type)
+ {
+ case Ultracopier::RemoveItem:
+ if(copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ const quint8 &col=fileCatNumber(returnAction.addAction.size);
+ copyList[index].remainingTimeLogarithmicValue[col].transferedSize+=returnAction.addAction.size;
+ }
+ break;
+ case Ultracopier::AddingItem:
+ if(copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic)
+ {
+ const quint8 &col=fileCatNumber(returnAction.addAction.size);
+ copyList[index].remainingTimeLogarithmicValue[col].totalSize+=returnAction.addAction.size;
+ }
+ break;
+ default:
+ break;
+ }
+ sub_index++;
+ }
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start8"));
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start9"));
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start end"));
}
void Core::pushGeneralProgression(const quint64 &current,const quint64 &total)
{
- int index=indexCopySenderCopyEngine();
- if(index!=-1)
- {
- copyList[index].currentProgression=current;
- copyList[index].totalProgression=total;
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ int index=indexCopySenderCopyEngine();
+ if(index!=-1)
+ {
+ copyList[index].currentProgression=current;
+ copyList[index].totalProgression=total;
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
}
/// \brief used to drag and drop files
void Core::urlDropped(const QList<QUrl> &urls)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=indexCopySenderInterface();
- if(index!=-1)
- {
- QStringList sources;
- int index_loop=0;
- while(index_loop<urls.size())
- {
- if(!urls.at(index_loop).isEmpty())
- sources << urls.at(index_loop).toLocalFile();
- index_loop++;
- }
- if(sources.size()==0)
- return;
- else
- {
- if(copyList.at(index).ignoreMode)
- {
- QMessageBox::StandardButton reply=QMessageBox::question(copyList.at(index).interface,tr("Transfer mode"),tr("Do you want do as a copy? Else if you reply no, it will be moved."),QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel,QMessageBox::Cancel);
- if(reply==QMessageBox::Yes)
- copyList.at(index).engine->newCopy(sources);
- if(reply==QMessageBox::No)
- copyList.at(index).engine->newMove(sources);
- }
- else
- {
- if(copyList.at(index).mode==Copy)
- copyList.at(index).engine->newCopy(sources);
- else
- copyList.at(index).engine->newMove(sources);
- }
- }
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to locate the copy engine sender");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=indexCopySenderInterface();
+ if(index!=-1)
+ {
+ QStringList sources;
+ int index_loop=0;
+ while(index_loop<urls.size())
+ {
+ if(!urls.at(index_loop).isEmpty())
+ sources << urls.at(index_loop).toLocalFile();
+ index_loop++;
+ }
+ if(sources.size()==0)
+ return;
+ else
+ {
+ if(copyList.at(index).ignoreMode)
+ {
+ QMessageBox::StandardButton reply=QMessageBox::question(copyList.at(index).interface,tr("Transfer mode"),tr("Do you want to copy? If no, it will be moved."),QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel,QMessageBox::Cancel);
+ if(reply==QMessageBox::Yes)
+ copyList.at(index).engine->newCopy(sources);
+ if(reply==QMessageBox::No)
+ copyList.at(index).engine->newMove(sources);
+ }
+ else
+ {
+ if(copyList.at(index).mode==Ultracopier::Copy)
+ copyList.at(index).engine->newCopy(sources);
+ else
+ copyList.at(index).engine->newMove(sources);
+ }
+ }
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender");
}
diff --git a/Core.h b/Core.h
index a3a9c2a..3b2928c 100644
--- a/Core.h
+++ b/Core.h
@@ -1,8 +1,6 @@
/** \file Core.h
\brief Define the class definition for core, the Copy of each copy/move window
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef CORE_H
@@ -20,7 +18,6 @@
#include "Environment.h"
#include "StructEnumDefinition.h"
#include "CopyEngineManager.h"
-#include "GlobalClass.h"
#include "LogThread.h"
#include "interface/PluginInterface_CopyEngine.h"
#include "interface/PluginInterface_Themes.h"
@@ -28,159 +25,172 @@
/** \brief Define the class definition for core, the Copy of each copy/move window
This class provide a core for dispatch the event of signal/slot, it checks too if not other instance is running */
-class Core : public QObject, public GlobalClass
+class Core : public QObject
{
- Q_OBJECT
- public:
- /// \brief Initate the core of one copy or move window, dispatch the event specific at this window
- Core(CopyEngineManager *copyEngineList);
- private:
- CopyEngineManager *copyEngineList;
- struct RunningTransfer
- {
- ItemOfCopyList item;
- bool progression;
- };
- struct CopyInstance
- {
- int id;
- PluginInterface_CopyEngine * engine;
- PluginInterface_Themes * interface;
- bool ignoreMode;
- CopyMode mode;
- quint64 numberOfFile;
- quint64 numberOfTransferedFile;
- quint64 currentProgression,totalProgression;//store the file byte transfered, used into the remaining time
- EngineActionInProgress action;
- quint64 lastProgression;//store the real byte transfered, used in speed calculation
- QList<quint64> lastSpeedDetected;//stored in bytes
- QList<double> lastSpeedTime;//stored in ms
- QList<RunningTransfer> transferItemList;//full info of started item, to have wich progression to poll
- QList<quint32> orderId;//external order send via listener plugin
- QString folderListing;
- QString collisionAction;
- QString errorAction;
- bool isPaused;
- quint64 baseTime;//stored in ms
- QTime runningTime;
- bool isRunning;
- CopyType type;
- TransferListOperation transferListOperation;
- bool haveError;
- QTime lastConditionalSync;
- QTimer *nextConditionalSync;
- bool copyEngineIsSync;
- };
- QList<CopyInstance> copyList;
- /** open with specific source/destination
- \param move Copy or move
- \param ignoreMode if need ignore the mode
- \param protocolsUsedForTheSources protocols used for sources
- \param protocolsUsedForTheDestination protocols used for destination
- */
- int openNewCopyEngineInstance(const CopyMode &mode,const bool &ignoreMode,const QStringList &protocolsUsedForTheSources=QStringList(),const QString &protocolsUsedForTheDestination="");
- /** open with specific copy engine
- \param move Copy or move
- \param ignoreMode if need ignore the mode
- \param protocolsUsedForTheSources protocols used for sources
- \param protocolsUsedForTheDestination protocols used for destination
- */
- int openNewCopyEngineInstance(const CopyMode &mode,const bool &ignoreMode,const QString &name);
-
- /// \brief get the right copy instance (copy engine + interface), by signal emited from copy engine
- int indexCopySenderCopyEngine();
- /// \brief get the right copy instance (copy engine + interface), by signal emited from interface
- int indexCopySenderInterface();
-
- void connectEngine(const int &index);
- void connectInterfaceAndSync(const int &index);
- void disconnectEngine(const int &index);
- void disconnectInterface(const int &index);
-
- /** \brief update at periodic interval, the synchronization between copy engine and interface, but for specific entry
- \see forUpateInformation */
- void periodicSynchronization(const int &index);
-
- //for the internal management
- int incrementId();
- int nextId;
- QList<int> idList;
- QTime lastProgressionTime;
- QTimer forUpateInformation;///< used to call \see periodicSynchronization()
- void resetSpeedDetected(const int &index);
-
- /** Connect the copy engine instance provided previously to the management */
- int connectCopyEngine(const CopyMode &mode,bool ignoreMode,const CopyEngineManager::returnCopyEngine &returnInformations);
-
- LogThread log;///< To save the log like mkpath, rmpath, error, copy, ...
- //temp variable
- int index,index_sub_loop,loop_size,loop_sub_size;
- double totTime;
- double totSpeed;
- quint64 realByteTransfered;
- quint64 transferSpeed;
- quint64 transferAddedTime;
- quint64 diffCopiedSize;
- signals:
- void copyFinished(const quint32 & orderId,bool withError);
- void copyCanceled(const quint32 & orderId);
- public slots:
- /** \brief do copy with sources, but ask the destination */
- void newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources);
- /** \brief do copy with sources and destination */
- void newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination);
- /** \brief do move with sources, but ask the destination */
- void newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources);
- /** \brief do move with sources and destination */
- void newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination);
- /** \brief open copy/move windows with specific engine */
- void addWindowCopyMove(const CopyMode &mode,const QString &name);
- /** \brief open transfer (copy+move) windows with specific engine */
- void addWindowTransfer(const QString &name);
- /** new transfer list pased by the CLI */
- void newTransferList(QString engine,QString mode,QString file);
- private slots:
- /// \brief the copy engine have canceled the transfer
- void copyInstanceCanceledByEngine();
- /// \brief the interface have canceled the transfer
- void copyInstanceCanceledByInterface();
- /// \brief the transfer have been canceled
- void copyInstanceCanceledByIndex(const int &index);
- /// \brief only when the copy engine say it's ready to delete them self, it call this
- void deleteCopyEngine();
-
- // some stat update
- void actionInProgess(const EngineActionInProgress &action);
- void newFolderListing(const QString &path);
- void newCollisionAction(const QString &action);
- void newErrorAction(const QString &action);
- void isInPause(const bool&);
-
- /** \brief update at periodic interval, the synchronization between copy engine and interface
- \see forUpateInformation */
- void periodicSynchronization();
-
- //reset some information
- void resetSpeedDetectedEngine();
- void resetSpeedDetectedInterface();
-
- //load the interface
- void loadInterface();
- void unloadInterface();
-
- //error occurred
- void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error);
- //for the extra logging
- void rmPath(const QString &path);
- void mkPath(const QString &path);
-
- /// \brief used to drag and drop files
- void urlDropped(const QList<QUrl> &urls);
- /// \brief to rsync after a new interface connection
- void syncReady();
-
- void getActionOnList(const QList<returnActionOnCopyList> & actionList);
- void pushGeneralProgression(const quint64 &current,const quint64 &total);
+ Q_OBJECT
+ public:
+ /// \brief Initate the core of one copy or move window, dispatch the event specific at this window
+ Core(CopyEngineManager *copyEngineList);
+ ~Core();
+ private:
+ CopyEngineManager *copyEngineList;
+ struct RunningTransfer
+ {
+ Ultracopier::ItemOfCopyList item;
+ bool progression;
+ };
+ struct RemainingTimeLogarithmicColumn
+ {
+ QList<int> lastProgressionSpeed;
+ quint64 totalSize;
+ quint64 transferedSize;
+ };
+
+ struct CopyInstance
+ {
+ int id;
+ PluginInterface_CopyEngine * engine;
+ PluginInterface_Themes * interface;
+ bool ignoreMode;
+ Ultracopier::CopyMode mode;
+ quint64 numberOfFile;
+ quint64 numberOfTransferedFile;
+ quint64 currentProgression,totalProgression;//store the file byte transfered, used into the remaining time
+ Ultracopier::EngineActionInProgress action;
+ quint64 lastProgression;//store the real byte transfered, used in speed calculation
+ QList<RunningTransfer> transferItemList;//full info of started item, to have wich progression to poll
+ QList<quint32> orderId;//external order send via listener plugin
+ QString folderListing;
+ QString collisionAction;
+ QString errorAction;
+ bool isPaused;
+ bool isRunning;
+ Ultracopier::CopyType type;
+ Ultracopier::TransferListOperation transferListOperation;
+ bool haveError;
+ QTime lastConditionalSync;
+ QTimer *nextConditionalSync;
+ bool copyEngineIsSync;
+ bool canceled;//to not try groun when is in canceling
+
+ Ultracopier::RemainingTimeAlgo remainingTimeAlgo;
+
+ /** for RemainingTimeAlgo_Traditional **/
+ //this speed is for instant speed
+ QList<quint64> lastSpeedDetected;//stored in bytes
+ QList<double> lastSpeedTime;//stored in ms
+ //this speed is average speed on more time to calculate the remaining time
+ QList<quint64> lastAverageSpeedDetected;//stored in bytes
+ QList<double> lastAverageSpeedTime;//stored in ms
+
+ /** for RemainingTimeAlgo_Logarithmic **/
+ QList<RemainingTimeLogarithmicColumn> remainingTimeLogarithmicValue;
+ };
+ QList<CopyInstance> copyList;
+ /** open with specific source/destination
+ \param move Copy or move
+ \param ignoreMode if need ignore the mode
+ \param protocolsUsedForTheSources protocols used for sources
+ \param protocolsUsedForTheDestination protocols used for destination
+ */
+ int openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QStringList &protocolsUsedForTheSources=QStringList(),const QString &protocolsUsedForTheDestination="");
+ /** open with specific copy engine
+ \param move Copy or move
+ \param ignoreMode if need ignore the mode
+ \param protocolsUsedForTheSources protocols used for sources
+ \param protocolsUsedForTheDestination protocols used for destination
+ */
+ int openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QString &name);
+
+ /// \brief get the right copy instance (copy engine + interface), by signal emited from copy engine
+ int indexCopySenderCopyEngine();
+ /// \brief get the right copy instance (copy engine + interface), by signal emited from interface
+ int indexCopySenderInterface();
+
+ void connectEngine(const int &index);
+ void connectInterfaceAndSync(const int &index);
+ //void disconnectEngine(const int &index);
+ //void disconnectInterface(const int &index);
+
+ /** \brief update at periodic interval, the synchronization between copy engine and interface, but for specific entry
+ \see forUpateInformation */
+ void periodicSynchronizationWithIndex(const int &index);
+
+ //for the internal management
+ int incrementId();
+ int nextId;
+ QList<int> idList;
+ QTime lastProgressionTime;
+ QTimer forUpateInformation;///< used to call \see periodicSynchronization()
+ void resetSpeedDetected(const int &index);
+
+ /** Connect the copy engine instance provided previously to the management */
+ int connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,const CopyEngineManager::returnCopyEngine &returnInformations);
+
+ LogThread log;///< To save the log like mkpath, rmpath, error, copy, ...
+ quint64 realByteTransfered;
+
+ static quint8 fileCatNumber(quint64 size);
+ signals:
+ void copyFinished(const quint32 & orderId,bool withError) const;
+ void copyCanceled(const quint32 & orderId) const;
+ public slots:
+ /** \brief do copy with sources, but ask the destination */
+ void newCopyWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources);
+ void newTransfer(const Ultracopier::CopyMode &mode,const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination);
+ /** \brief do copy with sources and destination */
+ void newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination);
+ /** \brief do move with sources, but ask the destination */
+ void newMoveWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources);
+ /** \brief do move with sources and destination */
+ void newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination);
+ /** \brief open copy/move windows with specific engine */
+ void addWindowCopyMove(const Ultracopier::CopyMode &mode,const QString &name);
+ /** \brief open transfer (copy+move) windows with specific engine */
+ void addWindowTransfer(const QString &name);
+ /** new transfer list pased by the CLI */
+ void newTransferList(QString engine,QString mode,QString file);
+ private slots:
+ /// \brief the copy engine have canceled the transfer
+ void copyInstanceCanceledByEngine();
+ /// \brief the interface have canceled the transfer
+ void copyInstanceCanceledByInterface();
+ /// \brief the transfer have been canceled
+ void copyInstanceCanceledByIndex(const int &index);
+ /// \brief only when the copy engine say it's ready to delete them self, it call this
+ void deleteCopyEngine();
+
+ // some stat update
+ void actionInProgess(const Ultracopier::EngineActionInProgress &action);
+ void newFolderListing(const QString &path);
+ void isInPause(const bool&);
+
+ /** \brief update at periodic interval, the synchronization between copy engine and interface
+ \see forUpateInformation */
+ void periodicSynchronization();
+
+ //reset some information
+ void resetSpeedDetectedEngine();
+ void resetSpeedDetectedInterface();
+
+ //load the interface
+ void loadInterface();
+ void unloadInterface();
+
+ //error occurred
+ void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error);
+ //for the extra logging
+ void rmPath(const QString &path);
+ void mkPath(const QString &path);
+
+ /// \brief used to drag and drop files
+ void urlDropped(const QList<QUrl> &urls);
+ /// \brief to rsync after a new interface connection
+ void syncReady();
+ void doneTime(const QList<QPair<quint64,quint32> > &timeList);
+
+ void getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> & actionList);
+ void pushGeneralProgression(const quint64 &current,const quint64 &total);
};
#endif // CORE_H
diff --git a/DebugEngine.cpp b/DebugEngine.cpp
index 4fe6314..2cdfaab 100644
--- a/DebugEngine.cpp
+++ b/DebugEngine.cpp
@@ -1,25 +1,27 @@
/** \file DebugEngine.cpp
\brief Define the class for the debug
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include <QDir>
-#include <QFSFileEngine>
#include <QMessageBox>
#include <QFileDialog>
#include <QLocalSocket>
+#include <QRegularExpression>
#include "Variable.h"
#include "DebugEngine.h"
#include "ExtraSocket.h"
+#ifdef WIN32
+# define __func__ __FUNCTION__
+#endif
+
/// \brief The local macro: ULTRACOPIER_DEBUGCONSOLE
#if defined (__FILE__) && defined (__LINE__)
- #define ULTRACOPIER_DEBUGCONSOLE(a,b) addDebugInformation(a,__func__,b,__FILE__,__LINE__)
+# define ULTRACOPIER_DEBUGCONSOLE(a,b) addDebugInformation(a,__func__,b,__FILE__,__LINE__)
#else
- #define ULTRACOPIER_DEBUGCONSOLE(a,b) addDebugInformation(a,__func__,b)
+# define ULTRACOPIER_DEBUGCONSOLE(a,b) addDebugInformation(a,__func__,b)
#endif
#ifdef ULTRACOPIER_DEBUG
@@ -27,360 +29,365 @@
/// \brief initiate the ultracopier event dispatcher and check if no other session is running
DebugEngine::DebugEngine()
{
- addDebugInformationCallNumber=0;
- //Load the first content
- debugHtmlContent+="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
- debugHtmlContent+="<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">";
- debugHtmlContent+="<head>";
- debugHtmlContent+="<meta name=\"Language\" content=\"en\" />";
- debugHtmlContent+="<meta http-equiv=\"content-language\" content=\"english\" />";
- debugHtmlContent+="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />";
- debugHtmlContent+="<style type=\"text/css\">";
- debugHtmlContent+="body{font-family:\"DejaVu Sans Mono\";font-size:9pt;}";
- debugHtmlContent+=".Information td{color:#7485df;}";
- debugHtmlContent+=".Critical td{color:#ff0c00;background-color:#FFFE8C;}";
- debugHtmlContent+=".Warning td{color:#efa200;}";
- debugHtmlContent+=".Notice td{color:#999;}";
- debugHtmlContent+=".time{font-weight:bold;}";
- debugHtmlContent+=".Note{font-weight:bold;font-size:1.5em}";
- debugHtmlContent+=".function{font-style:italic;text-decoration:underline}";
- debugHtmlContent+=".location{padding-right:15px;}";
- debugHtmlContent+="td {white-space:nowrap;}";
- debugHtmlContent+="</style>";
- debugHtmlContent+="<title>Ultracopier "+QString(ULTRACOPIER_VERSION)+" "+QString(ULTRACOPIER_PLATFORM_NAME)+", debug report</title>";
- debugHtmlContent+="</head>";
- debugHtmlContent+="<body>";
- debugHtmlContent+="<table>";
- //Load the start time at now
- startTime.start();
- //Load the log file end
- endOfLogFile="</table></body></html>";
- //check if other instance is running, then switch to memory backend
- if(tryConnect())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Notice,"currentBackend: File because other session is runing");
- currentBackend=Memory;
- return;
- }
- //The lock and log file path is not defined
- bool fileNameIsLoaded=false;
- #ifdef ULTRACOPIER_VERSION_PORTABLE
- #ifdef ULTRACOPIER_VERSION_PORTABLEAPPS
- //Load the data folder path
- QDir dir(QCoreApplication::applicationDirPath());
- dir.cdUp();
- dir.cdUp();
- dir.cd("Data");
- logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html");
- lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock");
- fileNameIsLoaded=true;
- #else
- //Load the ultracopier path
- QDir dir(QCoreApplication::applicationDirPath());
- logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html");
- lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock");
- fileNameIsLoaded=true;
- #endif
- #else
- #ifdef Q_OS_WIN32
- #define EXTRA_HOME_PATH "\\ultracopier\\"
- #else
- #define EXTRA_HOME_PATH "/.config/Ultracopier/"
- #endif
- //Load the user path only if exists and writable
- QDir dir(QFSFileEngine::homePath()+EXTRA_HOME_PATH);
- bool errorFound=false;
- //If user's directory not exists create it
- if(!dir.exists())
- {
- //If failed not load the file
- if(!dir.mkpath(dir.absolutePath()))
- {
- errorFound=true;
- puts(qPrintable("Unable to make path: "+dir.absolutePath()+", disable file log"));
- }
- }
- //If no error found set the file name
- if(errorFound==false)
- {
- fileNameIsLoaded=true;
- logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html");
- lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock");
- }
- errorFound=false;
- #endif
- //If the file name is loaded
- if(fileNameIsLoaded)
- {
- //If the previous file is here, then crash previous, ask if the user want to save
- if(lockFile.exists() && logFile.exists())
- {
- //Try open the file as read only to propose save it as the user
- //Don't ask it if unable to write, because unable to remove, then alert at all start
- if(removeTheLockFile())
- {
- //Ask to the user
- QMessageBox::StandardButton reply = QMessageBox::question(NULL,"Save the previous report","Ultracopier seam have crashed, do you want save the previous report for report it to the forum?",QMessageBox::Yes|QMessageBox::No,QMessageBox::No);
- if(reply==QMessageBox::Yes)
- saveBugReport();
- }
- else
- puts(qPrintable(logFile.fileName()+" unable to open it as read"));
- }
- //Now try to create and open the log file and lock file
- if(!lockFile.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Unbuffered))
- {
- currentBackend=Memory;
- puts(qPrintable(lockFile.fileName()+" unable to open it as write, log into file disabled"));
- }
- else
- {
- if(!logFile.open(QIODevice::ReadWrite|QIODevice::Truncate|QIODevice::Unbuffered))
- {
- currentBackend=Memory;
- puts(qPrintable(logFile.fileName()+" unable to open it as write, log into file disabled"));
- removeTheLockFile();
- }
- else
- {
- currentBackend=File;
- logFile.write(debugHtmlContent.toUtf8());
- }
- }
- }
- if(currentBackend==File)
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Notice,"currentBackend: File");
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Notice,"currentBackend: Memory");
+ fileNameCleaner=QRegularExpression(QStringLiteral("\\.\\.?[/\\\\]([^/]+[/\\\\])?"));
+ quit=false;
+ QStringList ultracopierArguments=QCoreApplication::arguments();
+ if(ultracopierArguments.size()==2)
+ if(ultracopierArguments.last()=="quit")
+ quit=true;
+ addDebugInformationCallNumber=0;
+ //Load the first content
+ debugHtmlContent+="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
+ debugHtmlContent+="<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">";
+ debugHtmlContent+="<head>";
+ debugHtmlContent+="<meta name=\"Language\" content=\"en\" />";
+ debugHtmlContent+="<meta http-equiv=\"content-language\" content=\"english\" />";
+ debugHtmlContent+="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />";
+ debugHtmlContent+="<style type=\"text/css\">";
+ debugHtmlContent+="body{font-family:\"DejaVu Sans Mono\";font-size:9pt;}";
+ debugHtmlContent+=".Information td{color:#7485df;}";
+ debugHtmlContent+=".Critical td{color:#ff0c00;background-color:#FFFE8C;}";
+ debugHtmlContent+=".Warning td{color:#efa200;}";
+ debugHtmlContent+=".Notice td{color:#999;}";
+ debugHtmlContent+=".time{font-weight:bold;}";
+ debugHtmlContent+=".Note{font-weight:bold;font-size:1.5em}";
+ debugHtmlContent+=".function{font-style:italic;text-decoration:underline}";
+ debugHtmlContent+=".location{padding-right:15px;}";
+ debugHtmlContent+="td {white-space:nowrap;}";
+ debugHtmlContent+="</style>";
+ debugHtmlContent+="<title>";
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ debugHtmlContent+="Supercopier";
+ #else
+ debugHtmlContent+="Ultracopier";
+ #endif
+ debugHtmlContent+=" "+QString(ULTRACOPIER_VERSION)+" "+QString(ULTRACOPIER_PLATFORM_NAME)+", debug report</title>";
+ debugHtmlContent+="</head>";
+ debugHtmlContent+="<body>";
+ debugHtmlContent+="<table>";
+ //Load the start time at now
+ startTime.start();
+ //Load the log file end
+ endOfLogFile="</table></body></html>";
+ //check if other instance is running, then switch to memory backend
+ if(tryConnect())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Notice,"currentBackend: File because other session is runing");
+ currentBackend=Memory;
+ return;
+ }
+ //The lock and log file path is not defined
+ bool fileNameIsLoaded=false;
+ #ifdef ULTRACOPIER_VERSION_PORTABLE
+ #ifdef ULTRACOPIER_VERSION_PORTABLEAPPS
+ //Load the data folder path
+ QDir dir(QCoreApplication::applicationDirPath());
+ dir.cdUp();
+ dir.cdUp();
+ dir.cd("Data");
+ logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html");
+ lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock");
+ fileNameIsLoaded=true;
+ #else
+ //Load the ultracopier path
+ QDir dir(QCoreApplication::applicationDirPath());
+ logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html");
+ lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock");
+ fileNameIsLoaded=true;
+ #endif
+ #else
+ #ifdef Q_OS_WIN32
+ #define EXTRA_HOME_PATH "\\ultracopier\\"
+ #else
+ #define EXTRA_HOME_PATH "/.config/Ultracopier/"
+ #endif
+ //Load the user path only if exists and writable
+ QDir dir(QDir::homePath()+EXTRA_HOME_PATH);
+ bool errorFound=false;
+ //If user's directory not exists create it
+ if(!dir.exists())
+ {
+ //If failed not load the file
+ if(!dir.mkpath(dir.absolutePath()))
+ {
+ errorFound=true;
+ puts(qPrintable("Unable to make path: "+dir.absolutePath()+", disable file log"));
+ }
+ }
+ //If no error found set the file name
+ if(errorFound==false)
+ {
+ fileNameIsLoaded=true;
+ logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html");
+ lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock");
+ }
+ //errorFound=false;
+ #endif
+ //If the file name is loaded
+ if(fileNameIsLoaded)
+ {
+ //If the previous file is here, then crash previous, ask if the user want to save
+ if(lockFile.exists() && logFile.exists() && !quit)
+ {
+ //Try open the file as read only to propose save it as the user
+ //Don't ask it if unable to write, because unable to remove, then alert at all start
+ if(removeTheLockFile())
+ {
+ //Ask to the user
+ QMessageBox::StandardButton reply = QMessageBox::question(NULL,"Save the previous report",
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ QString("Supercopier")+
+ #else
+ QString("Ultracopier")+
+ #endif
+ " seam have crashed, do you want save the previous report for report it to the forum?",QMessageBox::Yes|QMessageBox::No,QMessageBox::No);
+ if(reply==QMessageBox::Yes)
+ saveBugReport();
+ }
+ else
+ puts(qPrintable(logFile.fileName()+" unable to open it as read"));
+ }
+ //Now try to create and open the log file and lock file
+ if(!lockFile.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Unbuffered))
+ {
+ currentBackend=Memory;
+ puts(qPrintable(lockFile.fileName()+" unable to open it as write, log into file disabled"));
+ }
+ else
+ {
+ if(!logFile.open(QIODevice::ReadWrite|QIODevice::Truncate|QIODevice::Unbuffered))
+ {
+ currentBackend=Memory;
+ puts(qPrintable(logFile.fileName()+" unable to open it as write, log into file disabled"));
+ removeTheLockFile();
+ }
+ else
+ {
+ logFile.resize(0);
+ currentBackend=File;
+ logFile.write(debugHtmlContent.toUtf8());
+ }
+ }
+ }
}
/// \brief Destroy the ultracopier event dispatcher
DebugEngine::~DebugEngine()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Notice,"start");
- if(currentBackend==File)
- {
- removeTheLockFile();
- //Finalize the log file
- logFile.write(endOfLogFile.toUtf8());
- logFile.close();
- }
+ if(currentBackend==File)
+ {
+ removeTheLockFile();
+ //Finalize the log file
+ logFile.write(endOfLogFile.toUtf8());
+ logFile.close();
+ }
}
-/// \brief ask to the user where save the bug report
+/// \brief ask to the user where save the bug report
void DebugEngine::saveBugReport()
{
- bool errorFound;
- do
- {
- errorFound=false;
- //Ask where it which save it
- QString fileName = QFileDialog::getSaveFileName(NULL,"Save file","ultracopier-bug-report.log.html","Log file (*.log.html)");
- if(fileName!="")
- {
- if(QFile::exists(fileName))
- {
- if(!QFile::remove(fileName))
- {
- errorFound=true;
- puts(qPrintable(fileName+" unable remove it"));
- QMessageBox::critical(NULL,"Error","Unable to save the bug report");
- }
- }
- if(!errorFound)
- {
- //Open the destination as write
- if(!logFile.copy(fileName))
- {
- errorFound=true;
- puts(qPrintable(fileName+" unable to open it as write: "+logFile.errorString()));
- QMessageBox::critical(NULL,"Error","Unable to save the bug report"+logFile.errorString());
- }
- }
- }
- } while(errorFound!=false);
+ bool errorFound;
+ do
+ {
+ errorFound=false;
+ //Ask where it which save it
+ QString fileName = QFileDialog::getSaveFileName(NULL,"Save file","ultracopier-bug-report.log.html","Log file (*.log.html)");
+ if(fileName!="")
+ {
+ if(QFile::exists(fileName))
+ {
+ if(!QFile::remove(fileName))
+ {
+ errorFound=true;
+ puts(qPrintable(fileName+" unable remove it"));
+ QMessageBox::critical(NULL,"Error","Unable to save the bug report");
+ }
+ }
+ if(!errorFound)
+ {
+ //Open the destination as write
+ if(!logFile.copy(fileName))
+ {
+ errorFound=true;
+ puts(qPrintable(fileName+" unable to open it as write: "+logFile.errorString()));
+ QMessageBox::critical(NULL,"Error","Unable to save the bug report"+logFile.errorString());
+ }
+ }
+ }
+ } while(errorFound!=false);
}
/// \brief Internal function to remove the lock file
bool DebugEngine::removeTheLockFile()
{
- //close the file and remove it
- lockFile.close();
- if(!lockFile.remove())
- {
- puts(qPrintable(lockFile.fileName()+" unable to remove it, crash report at the next start"));
- return false;
- }
- else
- return true;
+ //close the file and remove it
+ lockFile.close();
+ if(!lockFile.remove())
+ {
+ puts(qPrintable(lockFile.fileName()+" unable to remove it, crash report at the next start"));
+ return false;
+ }
+ else
+ return true;
}
-void DebugEngine::addDebugInformationStatic(const DebugLevel &level,const QString& function,const QString& text,const QString& file,const int& ligne,const QString& location)
+void DebugEngine::addDebugInformationStatic(const Ultracopier::DebugLevel &level,const QString& function,const QString& text,const QString& file,const int& ligne,const QString& location)
{
- DebugEngine *debug_engine_instance=DebugEngine::getInstance();
- DebugLevel_custom tempLevel=DebugLevel_custom_Information;
- switch(level)
- {
- case DebugLevel_Information:
- tempLevel=DebugLevel_custom_Information;
- break;
- case DebugLevel_Critical:
- tempLevel=DebugLevel_custom_Critical;
- break;
- case DebugLevel_Warning:
- tempLevel=DebugLevel_custom_Warning;
- break;
- case DebugLevel_Notice:
- tempLevel=DebugLevel_custom_Notice;
- break;
- default:
- tempLevel=DebugLevel_custom_Notice;
- }
- debug_engine_instance->addDebugInformation(tempLevel,function,text,file,ligne,location);
- DebugEngine::destroyInstanceAtTheLastCall();
+ if(DebugEngine::debugEngine==NULL)
+ {
+ qWarning() << QStringLiteral("After close: ") << function << file << ligne;
+ return;
+ }
+ DebugLevel_custom tempLevel=DebugLevel_custom_Information;
+ switch(level)
+ {
+ case Ultracopier::DebugLevel_Information:
+ tempLevel=DebugLevel_custom_Information;
+ break;
+ case Ultracopier::DebugLevel_Critical:
+ tempLevel=DebugLevel_custom_Critical;
+ break;
+ case Ultracopier::DebugLevel_Warning:
+ tempLevel=DebugLevel_custom_Warning;
+ break;
+ case Ultracopier::DebugLevel_Notice:
+ tempLevel=DebugLevel_custom_Notice;
+ break;
+ default:
+ tempLevel=DebugLevel_custom_Notice;
+ }
+ DebugEngine::debugEngine->addDebugInformation(tempLevel,function,text,file,ligne,location);
}
void DebugEngine::addDebugNote(const QString& text)
{
- DebugEngine *debug_engine_instance=DebugEngine::getInstance();
- debug_engine_instance->addDebugInformation(DebugLevel_custom_UserNote,"",text,"",-1,"Core");
- DebugEngine::destroyInstanceAtTheLastCall();
+ if(DebugEngine::debugEngine==NULL)
+ return;
+ DebugEngine::debugEngine->addDebugInformation(DebugLevel_custom_UserNote,QStringLiteral(""),text,QStringLiteral(""),-1,QStringLiteral("Core"));
}
/// \brief For add message info, this function is thread safe
void DebugEngine::addDebugInformation(const DebugLevel_custom &level,const QString& function,const QString& text,QString file,const int& ligne,const QString& location)
{
- //Remove the compiler extra patch generated
- file=file.remove(QRegExp("\\.\\.?[/\\\\]([^/]+[/\\\\])?"));
- QString addDebugInformation_lignestring=QString::number(ligne);
- QString addDebugInformation_fileString=file;
- if(ligne!=-1)
- addDebugInformation_fileString+=":"+addDebugInformation_lignestring;
- //Load the time from start
- QString addDebugInformation_time = QString::number(startTime.elapsed());
- QString addDebugInformation_htmlFormat;
- switch(level)
- {
- case DebugLevel_custom_Information:
- addDebugInformation_htmlFormat="<tr class=\"Information\"><td class=\"time\">"+addDebugInformation_time+"</span></td><td>"+addDebugInformation_fileString+"</td><td class=\"function\">"+function+"()</td><td class=\"location\">"+location+"</td><td>"+htmlEntities(text)+"</td></tr>\n";
- break;
- case DebugLevel_custom_Critical:
- addDebugInformation_htmlFormat="<tr class=\"Critical\"><td class=\"time\">"+addDebugInformation_time+"</span></td><td>"+addDebugInformation_fileString+"</td><td class=\"function\">"+function+"()</td><td class=\"location\">"+location+"</td><td>"+htmlEntities(text)+"</td></tr>\n";
- break;
- case DebugLevel_custom_Warning:
- addDebugInformation_htmlFormat="<tr class=\"Warning\"><td class=\"time\">"+addDebugInformation_time+"</span></td><td>"+addDebugInformation_fileString+"</td><td class=\"function\">"+function+"()</td><td class=\"location\">"+location+"</td><td>"+htmlEntities(text)+"</td></tr>\n";
- break;
- case DebugLevel_custom_Notice:
- addDebugInformation_htmlFormat="<tr class=\"Notice\"><td class=\"time\">"+addDebugInformation_time+"</span></td><td>"+addDebugInformation_fileString+"</td><td class=\"function\">"+function+"()</td><td class=\"location\">"+location+"</td><td>"+htmlEntities(text)+"</td></tr>\n";
- break;
- case DebugLevel_custom_UserNote:
- addDebugInformation_htmlFormat="<tr class=\"Note\"><td class=\"time\">"+addDebugInformation_time+"</span></td><td>"+addDebugInformation_fileString+"</td><td class=\"function\">"+function+"()</td><td class=\"location\">"+location+"</td><td>"+htmlEntities(text)+"</td></tr>\n";
- break;
- }
- //To prevent access of string in multi-thread
- {
- //Show the text in console
- QString addDebugInformation_textFormat;
- addDebugInformation_textFormat = "("+addDebugInformation_time.rightJustified(8,' ')+") ";
- if(file!="" && ligne!=-1)
- addDebugInformation_textFormat += file+":"+addDebugInformation_lignestring+":";
- addDebugInformation_textFormat += function+"(), (location: "+location+"): "+text;
- puts(qPrintable(addDebugInformation_textFormat));
- QMutexLocker lock_mutex(&mutex);
- if(currentBackend==File)
- {
- if(logFile.size()>64*1024*1024) // greater than 64MB
- puts("File log greater than 64MB, stop to record it!");
- else
- logFile.write(addDebugInformation_htmlFormat.toUtf8());
- }
- else
- {
- if(debugHtmlContent.size()<64*1024*1024)
- debugHtmlContent+=addDebugInformation_htmlFormat;
- else
- puts("String greater than 64MB, stop to record it!");
- }
- ItemOfDebug newItem;
- newItem.time=addDebugInformation_time;
- newItem.level=level;
- newItem.function=function;
- if(addDebugInformation_lignestring!="-1")
- newItem.file=file+":"+addDebugInformation_lignestring;
- else
- newItem.file=file;
- newItem.location=location;
- newItem.text=text;
- listItemOfDebug << newItem;
- }
- //Send the new line
- if(addDebugInformationCallNumber<ULTRACOPIER_DEBUG_MAX_GUI_LINE)
- {
- addDebugInformationCallNumber++;
- emit newDebugInformation();
- }
-}
-
-QList<DebugEngine::ItemOfDebug> DebugEngine::getItemList()
-{
- QList<DebugEngine::ItemOfDebug> returnedList;
- {
- QMutexLocker lock_mutex(&mutexList);
- returnedList=listItemOfDebug;
- listItemOfDebug.clear();
- }
- return returnedList;
+ if(DebugEngine::debugEngine==NULL)
+ {
+ qWarning() << QStringLiteral("After close: ") << function << file << ligne;
+ return;
+ }
+ //Remove the compiler extra patch generated
+ file=file.remove(fileNameCleaner);
+ QString addDebugInformation_lignestring=QString::number(ligne);
+ QString addDebugInformation_fileString=file;
+ if(ligne!=-1)
+ addDebugInformation_fileString+=QStringLiteral(":")+addDebugInformation_lignestring;
+ //Load the time from start
+ QString addDebugInformation_time = QString::number(startTime.elapsed());
+ QString addDebugInformation_htmlFormat;
+ bool important=true;
+ switch(level)
+ {
+ case DebugLevel_custom_Information:
+ addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Information\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n");
+ break;
+ case DebugLevel_custom_Critical:
+ addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Critical\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n");
+ break;
+ case DebugLevel_custom_Warning:
+ addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Warning\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n");
+ break;
+ case DebugLevel_custom_Notice:
+ {
+ addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Notice\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n");
+ important=false;
+ }
+ break;
+ case DebugLevel_custom_UserNote:
+ addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Note\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n");
+ break;
+ }
+ //To prevent access of string in multi-thread
+ {
+ //Show the text in console
+ QString addDebugInformation_textFormat;
+ addDebugInformation_textFormat = QStringLiteral("(")+addDebugInformation_time.rightJustified(8,' ')+QStringLiteral(") ");
+ if(file!="" && ligne!=-1)
+ addDebugInformation_textFormat += file+QStringLiteral(":")+addDebugInformation_lignestring+QStringLiteral(":");
+ addDebugInformation_textFormat += function+QStringLiteral("(), (location: ")+location+QStringLiteral("): ")+text;
+ QMutexLocker lock_mutex(&mutex);
+ if(currentBackend==File)
+ {
+ if(logFile.size()<ULTRACOPIER_DEBUG_MAX_ALL_SIZE*1024*1024 || (important && logFile.size()<ULTRACOPIER_DEBUG_MAX_IMPORTANT_SIZE*1024*1024))
+ {
+ puts(qPrintable(addDebugInformation_textFormat));
+ logFile.write(addDebugInformation_htmlFormat.toUtf8());
+ }
+ }
+ else
+ {
+ if(debugHtmlContent.size()<ULTRACOPIER_DEBUG_MAX_ALL_SIZE*1024*1024 || (important && debugHtmlContent.size()<ULTRACOPIER_DEBUG_MAX_IMPORTANT_SIZE*1024*1024))
+ {
+ puts(qPrintable(addDebugInformation_textFormat));
+ debugHtmlContent+=addDebugInformation_htmlFormat;
+ }
+ }
+ //Send the new line
+ if(addDebugInformationCallNumber<ULTRACOPIER_DEBUG_MAX_GUI_LINE)
+ {
+ addDebugInformationCallNumber++;
+ DebugModel::debugModel->addDebugInformation(startTime.elapsed(),level,function,text,file,ligne,location);
+ }
+ }
}
/// \brief Get the html text info for re-show it
QString DebugEngine::getTheDebugHtml()
{
- if(currentBackend==File)
- {
- logFile.seek(0);
- if(!logFile.isOpen())
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Warning,"The log file is not open");
- return QString().fromUtf8(logFile.readAll().data())+endOfLogFile;
- }
- else
- return debugHtmlContent+endOfLogFile;
+ if(currentBackend==File)
+ {
+ logFile.seek(0);
+ if(!logFile.isOpen())
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Warning,"The log file is not open");
+ return QString().fromUtf8(logFile.readAll().data())+endOfLogFile;
+ }
+ else
+ return debugHtmlContent+endOfLogFile;
}
/// \brief Get the html end
QString DebugEngine::getTheDebugEnd()
{
- return endOfLogFile;
+ return endOfLogFile;
}
/// \brief Drop the html entities
-QString DebugEngine::htmlEntities(QString text)
+QString DebugEngine::htmlEntities(const QString &text)
{
- text.replace('&',"&amp;");
- text.replace('"',"&quot;");
- text.replace('\'',"&#039;");
- text.replace('<',"&lt;");
- text.replace('>',"&gt;");
- return text;
+ QString newText(text);
+ newText.replace('&',"&amp;");
+ newText.replace('"',"&quot;");
+ newText.replace('\'',"&#039;");
+ newText.replace('<',"&lt;");
+ newText.replace('>',"&gt;");
+ return newText;
}
/// \brief return the current backend
DebugEngine::Backend DebugEngine::getCurrentBackend()
{
- return currentBackend;
+ return currentBackend;
}
bool DebugEngine::tryConnect()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Notice,"start");
- QLocalSocket localSocket;
- localSocket.connectToServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME),QIODevice::WriteOnly|QIODevice::Unbuffered);
- if(localSocket.waitForConnected(1000))
- {
- localSocket.disconnectFromServer();
- return true;
- }
- else
- return false;
+ QLocalSocket localSocket;
+ localSocket.connectToServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME),QIODevice::WriteOnly|QIODevice::Unbuffered);
+ if(localSocket.waitForConnected(1000))
+ {
+ localSocket.disconnectFromServer();
+ return true;
+ }
+ else
+ return false;
}
#endif
diff --git a/DebugEngine.h b/DebugEngine.h
index fb1eda9..e39470e 100644
--- a/DebugEngine.h
+++ b/DebugEngine.h
@@ -1,8 +1,6 @@
/** \file DebugEngine.h
\brief Define the class for the debug
\author alpha_one_x86
-\version 0.3
-\date 2010
\note This class don't need be thread safe because ultracopier is done with one thread, but I have implement some basic thread protection
\licence GPL3, see the file COPYING */
@@ -14,99 +12,116 @@
#include <QFile>
#include <QMutex>
#include <QTime>
+#include <QTimer>
#include <QList>
#include <QCoreApplication>
+#include <QAbstractTableModel>
+#include <QRegularExpression>
#include "Variable.h"
#include "PlatformMacro.h"
#include "StructEnumDefinition.h"
#include "StructEnumDefinition_UltracopierSpecific.h"
-#include "Singleton.h"
#ifdef ULTRACOPIER_DEBUG
+class DebugModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ /// \brief the transfer item displayed
+ struct DebugItem
+ {
+ int time;
+ DebugLevel_custom level;
+ QString function;
+ QString text;
+ QString file;
+ QString location;
+ };
+
+ static DebugModel *debugModel;
+ DebugModel();
+ ~DebugModel();
+
+ virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ virtual bool setData(const QModelIndex&, const QVariant&, int = Qt::EditRole);
+
+ void addDebugInformation(const int &time, const DebugLevel_custom &level, const QString& function, const QString& text, const QString &file="", const int& ligne=-1, const QString& location="Core");
+ void setupTheTimer();
+ QTimer *updateDisplayTimer;
+ bool displayed;
+ bool inWaitOfDisplay;
+private:
+ QList<DebugItem> list;
+private slots:
+ void updateDisplay();
+};
+
/** \brief Define the class for the debug
This class provide all needed for the debug mode of ultracopier */
-class DebugEngine : public QObject, public Singleton<DebugEngine>
+class DebugEngine : public QObject
{
- Q_OBJECT
- friend class Singleton<DebugEngine>;
- public:
- /** \brief Get the html text info for re-show it
- \note This function is thread safe */
- QString getTheDebugHtml();
- /// \brief Enumeration of backend
- enum Backend
- {
- Memory, //Do intensive usage of memory, used only if the file backend is not available
- File //Store all directly into file, at crash the backtrace is into the file
- };
- /// \brief return the current backend
- Backend getCurrentBackend();
- /// \brief Get the html end
- QString getTheDebugEnd();
- /** \brief For add message info, this function
- \note This function is reentrant */
- static void addDebugInformationStatic(const DebugLevel &level,const QString& function,const QString& text,const QString& file="",const int& ligne=-1,const QString& location="Core");
- static void addDebugNote(const QString& text);
- /** \brief structure for one debug item */
- struct ItemOfDebug
- {
- DebugLevel_custom level;
- QString time;
- QString file;
- QString function;
- QString location;
- QString text;
- };
- QList<ItemOfDebug> listItemOfDebug;
- QList<ItemOfDebug> getItemList();
- public slots:
- /** \brief ask to the user where save the bug report
- \warning This function can be only call by the graphical thread */
- void saveBugReport();
-
- void addDebugInformation(const DebugLevel_custom &level,const QString& fonction,const QString& text,QString file="",const int& ligne=-1,const QString& location="Core");
- private:
- /// \brief Initiate the ultracopier event dispatcher and check if no other session is running
- DebugEngine();
- /** \brief Destroy the ultracopier event dispatcher
- \note This function is thread safe */
- ~DebugEngine();
- /// \brief Path for log file
- QFile logFile;
- /// \brief Path for lock file
- QFile lockFile;
- /// \brief Internal function to remove the lock file
- bool removeTheLockFile();
- /** \brief Do thread safe part for the addDebugInformation()
- \see addDebugInformation() */
- QMutex mutex;
- QMutex mutexList;
- /// \brief For record the start time
- QTime startTime;
- /// \brief String for the end of log file
- QString endOfLogFile;
- /// \brief Drop the html entities
- QString htmlEntities(QString text);
- /// \brief To store the debug informations
- QString debugHtmlContent;
- /// \brief The current backend
- Backend currentBackend;
- /// try connect to send to the current running instance the arguements
- bool tryConnect();
- //temp variable
- /* can't because multiple thread can access at this variable
- QString addDebugInformation_lignestring;
- QString addDebugInformation_fileString;
- QString addDebugInformation_time;
- QString addDebugInformation_htmlFormat;
- QString addDebugInformation_textFormat;*/
- quint32 addDebugInformationCallNumber;
- signals:
- /// \brief Send that's when new debug info is added
- void newDebugInformation();
+ Q_OBJECT
+ public:
+ /// \brief Initiate the ultracopier event dispatcher and check if no other session is running
+ DebugEngine();
+ /** \brief Destroy the ultracopier event dispatcher
+ \note This function is thread safe */
+ ~DebugEngine();
+ /** \brief Get the html text info for re-show it
+ \note This function is thread safe */
+ QString getTheDebugHtml();
+ /// \brief Enumeration of backend
+ enum Backend
+ {
+ Memory, //Do intensive usage of memory, used only if the file backend is not available
+ File //Store all directly into file, at crash the backtrace is into the file
+ };
+ /// \brief return the current backend
+ Backend getCurrentBackend();
+ /// \brief Get the html end
+ QString getTheDebugEnd();
+ /** \brief For add message info, this function
+ \note This function is reentrant */
+ static void addDebugInformationStatic(const Ultracopier::DebugLevel &level,const QString& function,const QString& text,const QString& file="",const int& ligne=-1,const QString& location="Core");
+ static void addDebugNote(const QString& text);
+ static DebugEngine *debugEngine;
+ public slots:
+ /** \brief ask to the user where save the bug report
+ \warning This function can be only call by the graphical thread */
+ void saveBugReport();
+ void addDebugInformation(const DebugLevel_custom &level,const QString& fonction,const QString& text,QString file="",const int& ligne=-1,const QString& location="Core");
+ private:
+ /// \brief Path for log file
+ QFile logFile;
+ /// \brief Path for lock file
+ QFile lockFile;
+ /// \brief Internal function to remove the lock file
+ bool removeTheLockFile();
+ /** \brief Do thread safe part for the addDebugInformation()
+ \see addDebugInformation() */
+ QMutex mutex;
+ QMutex mutexList;
+ /// \brief For record the start time
+ QTime startTime;
+ /// \brief String for the end of log file
+ QString endOfLogFile;
+ /// \brief Drop the html entities
+ QString htmlEntities(const QString &text);
+ /// \brief To store the debug informations
+ QString debugHtmlContent;
+ /// \brief The current backend
+ Backend currentBackend;
+ /// try connect to send to the current running instance the arguements
+ bool tryConnect();
+ int addDebugInformationCallNumber;
+ bool quit;
+ QRegularExpression fileNameCleaner;
};
#endif // ULTRACOPIER_DEBUG
diff --git a/DebugEngineMacro.h b/DebugEngineMacro.h
index 9a96957..c3822cd 100644
--- a/DebugEngineMacro.h
+++ b/DebugEngineMacro.h
@@ -1,23 +1,25 @@
/** \file DebugEngineMacro.h
\brief Define the macro for the debug
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef DEBUGENGINEMACRO_H
#define DEBUGENGINEMACRO_H
+#ifdef WIN32
+# define __func__ __FUNCTION__
+#endif
+
/// \brief Macro for the debug log
#ifdef ULTRACOPIER_DEBUG
- #include "DebugEngine.h"
- #if defined (__FILE__) && defined (__LINE__)
- #define ULTRACOPIER_DEBUGCONSOLE(a,b) DebugEngine::addDebugInformationStatic(a,__func__,b,__FILE__,__LINE__)
- #else
- #define ULTRACOPIER_DEBUGCONSOLE(a,b) DebugEngine::addDebugInformationStatic(a,__func__,b)
- #endif
+# include "DebugEngine.h"
+# if defined (__FILE__) && defined (__LINE__)
+# define ULTRACOPIER_DEBUGCONSOLE(a,b) DebugEngine::addDebugInformationStatic(a,__func__,b,__FILE__,__LINE__)
+# else
+# define ULTRACOPIER_DEBUGCONSOLE(a,b) DebugEngine::addDebugInformationStatic(a,__func__,b)
+# endif
#else // ULTRACOPIER_DEBUG
- #define ULTRACOPIER_DEBUGCONSOLE(a,b) void()
+# define ULTRACOPIER_DEBUGCONSOLE(a,b) void()
#endif // ULTRACOPIER_DEBUG
#endif // DEBUGENGINEMACRO_H
diff --git a/DebugModel.cpp b/DebugModel.cpp
new file mode 100644
index 0000000..2a7b173
--- /dev/null
+++ b/DebugModel.cpp
@@ -0,0 +1,158 @@
+#include "DebugEngine.h"
+
+#include <QColor>
+
+#ifdef ULTRACOPIER_DEBUG
+
+#define COLUMN_COUNT 5
+
+// Model
+
+DebugModel::DebugModel()
+{
+ displayed = false;
+ inWaitOfDisplay = false;
+ updateDisplayTimer = NULL;
+}
+
+DebugModel::~DebugModel()
+{
+ if(updateDisplayTimer!=NULL)
+ delete updateDisplayTimer;
+}
+
+int DebugModel::columnCount( const QModelIndex& parent ) const
+{
+ return parent == QModelIndex() ? COLUMN_COUNT : 0;
+}
+
+QVariant DebugModel::data( const QModelIndex& index, int role ) const
+{
+ int row,column;
+ row=index.row();
+ column=index.column();
+ if(index.parent()!=QModelIndex() || row < 0 || row >= list.count() || column < 0 || column >= COLUMN_COUNT)
+ return QVariant();
+
+ const DebugItem& item = list.at(row);
+ if(role==Qt::UserRole)
+ return row;
+ else if(role==Qt::DisplayRole)
+ {
+ switch(column)
+ {
+ case 0:
+ return item.time;
+ break;
+ case 1:
+ return item.file;
+ break;
+ case 2:
+ return item.function;
+ break;
+ case 3:
+ return item.location;
+ break;
+ case 4:
+ return item.text;
+ break;
+ default:
+ return QVariant();
+ }
+ }
+ else if(role==Qt::DecorationRole)
+ return QVariant();
+ else if(role==Qt::ForegroundRole)
+ {
+ switch(item.level)
+ {
+ case DebugLevel_custom_Information:
+ return QColor(94,165,255);
+ break;
+ case DebugLevel_custom_Critical:
+ return QColor(255,0,0);
+ break;
+ case DebugLevel_custom_Warning:
+ return QColor(255,178,0);
+ break;
+ case DebugLevel_custom_Notice:
+ return QColor(128,128,128);
+ break;
+ case DebugLevel_custom_UserNote:
+ return QColor(0,0,0);
+ break;
+ }
+ return QVariant();
+ }
+ return QVariant();
+}
+
+int DebugModel::rowCount( const QModelIndex& parent ) const
+{
+ return parent == QModelIndex() ? list.count() : 0;
+}
+
+QVariant DebugModel::headerData( int section, Qt::Orientation orientation, int role ) const
+{
+ if ( role == Qt::DisplayRole && orientation == Qt::Horizontal && section >= 0 && section < COLUMN_COUNT ) {
+ switch ( section ) {
+ case 0:
+ return QStringLiteral("Time");
+ case 1:
+ return QStringLiteral("File");
+ case 2:
+ return QStringLiteral("Function");
+ case 3:
+ return QStringLiteral("Location");
+ case 4:
+ return QStringLiteral("Text");
+ }
+ }
+
+ return QAbstractTableModel::headerData( section, orientation, role );
+}
+
+bool DebugModel::setData( const QModelIndex&, const QVariant&, int)
+{
+ return false;
+}
+
+void DebugModel::addDebugInformation(const int &time,const DebugLevel_custom &level,const QString& function,const QString& text,const QString &file,const int& ligne,const QString& location)
+{
+ DebugItem item;
+ item.time=time;
+ item.level=level;
+ item.function=function;
+ item.text=text;
+ item.file=QStringLiteral("%1:%2").arg(file).arg(ligne);
+ item.location=location;
+ list << item;
+ if(!displayed)
+ {
+ displayed=true;
+ emit layoutChanged();
+ }
+ else
+ inWaitOfDisplay=true;
+}
+
+void DebugModel::setupTheTimer()
+{
+ if(updateDisplayTimer!=NULL)
+ return;
+ updateDisplayTimer=new QTimer();
+ connect(updateDisplayTimer,&QTimer::timeout,this,&DebugModel::updateDisplay);
+ updateDisplayTimer->start(100);
+}
+
+void DebugModel::updateDisplay()
+{
+ displayed=false;
+ if(!inWaitOfDisplay)
+ {
+ inWaitOfDisplay=false;
+ displayed=true;
+ emit layoutChanged();
+ }
+}
+#endif
diff --git a/Environment.h b/Environment.h
index dcbea70..d653c5f 100644
--- a/Environment.h
+++ b/Environment.h
@@ -1,8 +1,6 @@
/** \file Environment.h
\brief Define the environment variable and global function
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "Variable.h"
@@ -13,7 +11,11 @@
#include "DebugEngineMacro.h"
#ifdef ULTRACOPIER_VERSION_PORTABLE
- #define ULTRACOPIER_VERSION_PORTABLE_BOOL true
+ #define ULTRACOPIER_VERSION_PORTABLE_BOOL true
#else
- #define ULTRACOPIER_VERSION_PORTABLE_BOOL false
+ #define ULTRACOPIER_VERSION_PORTABLE_BOOL false
+#endif
+
+#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+#undef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
#endif
diff --git a/EventDispatcher.cpp b/EventDispatcher.cpp
index a19cfd4..744bc6a 100644
--- a/EventDispatcher.cpp
+++ b/EventDispatcher.cpp
@@ -1,167 +1,578 @@
/** \file EventDispatcher.cpp
\brief Define the class of the event dispatcher
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
-#include <QFSFileEngine>
#include <QCoreApplication>
#include <QMessageBox>
+#include <QWidget>
+#include <QStorageInfo>
#include "EventDispatcher.h"
#include "ExtraSocket.h"
#include "CompilerInfo.h"
+#include "ThemesManager.h"
#ifdef Q_OS_UNIX
- #include <unistd.h>
- #include <sys/types.h>
-#else
- #include <windows.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+#endif
+#ifdef Q_OS_WIN32
+ #ifndef NOMINMAX
+ #define NOMINMAX
+ #endif
+ #include <windows.h>
+ #include <tchar.h>
+ #include <stdio.h>
+ #include <strsafe.h>
+ typedef void (WINAPI *PGNSI) (LPSYSTEM_INFO);
+ typedef BOOL (WINAPI *PGPI) (DWORD, DWORD, DWORD, DWORD, PDWORD);
+#endif
+#ifdef Q_OS_MAC
+#include <QStringList>
+#include <QFile>
+#include <QDomDocument>
+#include <QDomElement>
+#endif
+
+#ifdef ULTRACOPIER_VERSION_ULTIMATE
+#include <QInputDialog>
#endif
/// \brief Initiate the ultracopier event dispatcher and check if no other session is running
EventDispatcher::EventDispatcher()
{
- copyServer=new CopyListener(&optionDialog);
- connect(&localListener,SIGNAL(cli(QStringList,bool,bool)),&cliParser,SLOT(cli(QStringList,bool,bool)),Qt::QueuedConnection);
- connect(themes, SIGNAL(newThemeOptions(QString,QWidget*,bool,bool)), &optionDialog, SLOT(newThemeOptions(QString,QWidget*,bool,bool)));
- connect(&cliParser, SIGNAL(newCopy(QStringList)), copyServer, SLOT(newCopy(QStringList)));
- connect(&cliParser, SIGNAL(newCopy(QStringList,QString)), copyServer, SLOT(newCopy(QStringList,QString)));
- connect(&cliParser, SIGNAL(newMove(QStringList)), copyServer, SLOT(newMove(QStringList)));
- connect(&cliParser, SIGNAL(newMove(QStringList,QString)), copyServer, SLOT(newMove(QStringList,QString)));
- copyMoveEventIdIndex=0;
- backgroundIcon=NULL;
- stopIt=false;
- sessionloader=new SessionLoader(&optionDialog);
- copyEngineList=new CopyEngineManager(&optionDialog);
- core=new Core(copyEngineList);
- qRegisterMetaType<CatchState>("CatchState");
- qRegisterMetaType<ListeningState>("ListeningState");
- qRegisterMetaType<QList<QUrl> >("QList<QUrl>");
- qRegisterMetaType<QList<ProgressionItem> >("QList<ProgressionItem>");
- qRegisterMetaType<QList<returnActionOnCopyList> >("QList<returnActionOnCopyList>");
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- //show the ultracopier information
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION);
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("Qt version: %1 (%2)").arg(qVersion()).arg(QT_VERSION));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME);
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("Application path: %1 (%2)").arg(QCoreApplication::applicationFilePath()).arg(QCoreApplication::applicationPid()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,COMPILERINFO);
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("Local socket: ")+ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME));
- //To lunch some initialization after QApplication::exec() to quit eventually
- lunchInitFunction.setInterval(0);
- lunchInitFunction.setSingleShot(true);
- connect(&lunchInitFunction,SIGNAL(timeout()),this,SLOT(initFunction()),Qt::QueuedConnection);
- lunchInitFunction.start();
- //add the options to use
- QList<QPair<QString, QVariant> > KeysList;
- //add the options hidden, will not show in options pannel
- KeysList.clear();
- KeysList.append(qMakePair(QString("Last_version_used"),QVariant("na")));
- KeysList.append(qMakePair(QString("ActionOnManualOpen"),QVariant(1)));
- KeysList.append(qMakePair(QString("GroupWindowWhen"),QVariant(0)));
- options->addOptionGroup("Ultracopier",KeysList);
- if(options->getOptionValue("Ultracopier","Last_version_used")!=QVariant("na") && options->getOptionValue("Ultracopier","Last_version_used")!=QVariant(ULTRACOPIER_VERSION))
- {
- //then ultracopier have been updated
- }
- options->setOptionValue("Ultracopier","Last_version_used",QVariant(ULTRACOPIER_VERSION));
- int a=options->getOptionValue("Ultracopier","ActionOnManualOpen").toInt();
- if(a<0 || a>2)
- options->setOptionValue("Ultracopier","ActionOnManualOpen",QVariant(1));
- a=options->getOptionValue("Ultracopier","GroupWindowWhen").toInt();
- if(a<0 || a>5)
- options->setOptionValue("Ultracopier","GroupWindowWhen",QVariant(0));
-
- KeysList.clear();
- KeysList.append(qMakePair(QString("List"),QVariant(QStringList() << "Ultracopier-0.3")));
- options->addOptionGroup("CopyEngine",KeysList);
-
- connect(&cliParser, SIGNAL(newTransferList(QString,QString,QString)),core, SLOT(newTransferList(QString,QString,QString)));
+ qRegisterMetaType<QList<Ultracopier::ReturnActionOnCopyList> >("QList<Ultracopier::ReturnActionOnCopyList>");
+ qRegisterMetaType<QList<Ultracopier::ProgressionItem> >("QList<Ultracopier::ProgressionItem>");
+ qRegisterMetaType<Ultracopier::EngineActionInProgress>("Ultracopier::EngineActionInProgress");
+ qRegisterMetaType<QList<QUrl> >("QList<QUrl>");
+ qRegisterMetaType<Ultracopier::ItemOfCopyList>("Ultracopier::ItemOfCopyList");
+ #ifdef ULTRACOPIER_CGMINER
+ qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
+ qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
+ #endif
+
+ copyServer=new CopyListener(&optionDialog);
+ connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection);
+ connect(ThemesManager::themesManager, &ThemesManager::newThemeOptions, &optionDialog, &OptionDialog::newThemeOptions);
+ connect(&cliParser, &CliParser::newCopyWithoutDestination, copyServer, &CopyListener::copyWithoutDestination);
+ connect(&cliParser, &CliParser::newCopy, copyServer, &CopyListener::copy);
+ connect(&cliParser, &CliParser::newMoveWithoutDestination, copyServer, &CopyListener::moveWithoutDestination);
+ connect(&cliParser, &CliParser::newMove, copyServer, &CopyListener::move);
+ connect(copyServer, &CopyListener::newClientList, &optionDialog, &OptionDialog::newClientList);
+ #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ connect(&cliParser, &CliParser::tryLoadPlugin, PluginsManager::pluginsManager, &PluginsManager::tryLoadPlugin);
+ #endif
+ copyMoveEventIdIndex=0;
+ backgroundIcon=NULL;
+ stopIt=false;
+
+
+ #ifndef ULTRACOPIER_VERSION_PORTABLE
+ sessionloader=new SessionLoader(&optionDialog);
+ #endif
+ copyEngineList=new CopyEngineManager(&optionDialog);
+ core=new Core(copyEngineList);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ //show the ultracopier information
+ #if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Windows version: %1").arg(GetOSDisplayString()));
+ #endif
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Qt version: %1 (%2)").arg(qVersion()).arg(QT_VERSION));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Application path: %1 (%2)").arg(QCoreApplication::applicationFilePath()).arg(QCoreApplication::applicationPid()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,COMPILERINFO);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Local socket: ")+ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME));
+ #ifdef ULTRACOPIER_CGMINER
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("With cgminer"));
+ #endif
+ #if defined(ULTRACOPIER_DEBUG) && defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE)
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Version as all in one"));
+ QObjectList objectList=QPluginLoader::staticInstances();
+ int index=0;
+ while(index<objectList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("static plugin: %1").arg(objectList.at(index)->metaObject()->className()));
+ index++;
+ }
+ #else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Version as all in one, direct"));
+ #endif
+ #endif
+
+ {
+ const QList<QStorageInfo> mountedVolumesList=QStorageInfo::mountedVolumes();
+ int index=0;
+ while(index<mountedVolumesList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("mountSysPoint: %1").arg(mountedVolumesList.at(index).rootPath()));
+ index++;
+ }
+ if(mountedVolumesList.isEmpty())
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("mountSysPoint is empty"));
+ }
+
+ //To lunch some initialization after QApplication::exec() to quit eventually
+ lunchInitFunction.setInterval(0);
+ lunchInitFunction.setSingleShot(true);
+ connect(&lunchInitFunction,&QTimer::timeout,this,&EventDispatcher::initFunction,Qt::QueuedConnection);
+ lunchInitFunction.start();
+ if(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"))!=QVariant(QStringLiteral("na")) && OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"))!=QVariant(ULTRACOPIER_VERSION))
+ {
+ //then ultracopier have been updated
+ }
+ OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"),QVariant(ULTRACOPIER_VERSION));
+ int a=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen")).toInt();
+ if(a<0 || a>2)
+ OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen"),QVariant(1));
+ a=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen")).toInt();
+ if(a<0 || a>5)
+ OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen"),QVariant(0));
+
+ #ifdef ULTRACOPIER_VERSION_ULTIMATE
+ #ifdef ULTRACOPIER_ILLEGAL
+ static bool crackedVersion=true;
+ #else
+ static bool crackedVersion=false;
+ #endif
+ if(!crackedVersion)
+ {
+ while(1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultimate key"));
+ QString key=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("key")).toString();
+ if(!key.isEmpty())
+ {
+ QCryptographicHash hash(QCryptographicHash::Sha224);
+ hash.addData(QStringLiteral("U2NgvbKVrVwlaXnx").toUtf8());
+ hash.addData(key.toUtf8());
+ const QByteArray &result=hash.result();
+ if(!result.isEmpty() && result.at(0)==0x00 && result.at(1)==0x00)
+ break;
+ }
+ key=QInputDialog::getText(NULL,tr("Key"),tr("Give the key of this software, more information on <a href=\"http://ultracopier.first-world.info/\">ultracopier.first-world.info</a>"));
+ if(key.isEmpty())
+ {
+ QCoreApplication::quit();
+ stopIt=true;
+ return;
+ }
+ {
+ QCryptographicHash hash(QCryptographicHash::Sha224);
+ hash.addData(QStringLiteral("U2NgvbKVrVwlaXnx").toUtf8());
+ hash.addData(key.toUtf8());
+ const QByteArray &result=hash.result();
+ if(!result.isEmpty() && result.at(0)==0x00 && result.at(1)==0x00)
+ {
+ OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("key"),key);
+ break;
+ }
+ }
+ }
+ }
+ #endif
+
+ connect(&cliParser, &CliParser::newTransferList,core, &Core::newTransferList);
}
/// \brief Destroy the ultracopier event dispatcher
EventDispatcher::~EventDispatcher()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- if(core!=NULL)
- delete core;
- if(copyEngineList!=NULL)
- delete copyEngineList;
- if(sessionloader!=NULL)
- delete sessionloader;
- if(backgroundIcon!=NULL)
- delete backgroundIcon;
- delete copyServer;
+ if(core!=NULL)
+ {
+ delete core;
+ core=NULL;
+ }
+ if(copyEngineList!=NULL)
+ {
+ delete copyEngineList;
+ copyEngineList=NULL;
+ }
+ #ifndef ULTRACOPIER_VERSION_PORTABLE
+ if(sessionloader!=NULL)
+ {
+ delete sessionloader;
+ sessionloader=NULL;
+ }
+ #endif
+ if(backgroundIcon!=NULL)
+ {
+ delete backgroundIcon;
+ backgroundIcon=NULL;
+ }
+ if(copyServer!=NULL)
+ {
+ delete copyServer;
+ copyServer=NULL;
+ }
}
/// \brief return if need be close
bool EventDispatcher::shouldBeClosed()
{
- return stopIt;
+ return stopIt;
}
/// \brief Quit ultracopier
void EventDispatcher::quit()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Will quit ultracopier");
- //disconnect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),this,SLOT(quit()));
- QCoreApplication::exit();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Will quit ultracopier"));
+ //disconnect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),this,SLOT(quit()));
+ QCoreApplication::exit();
}
/// \brief Called when event loop is setup
void EventDispatcher::initFunction()
{
- if(core==NULL || copyEngineList==NULL)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"Unable to initialize correctly the software");
- return;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Initialize the variable of event loop");
- connect(copyServer, SIGNAL(newCopy(quint32,QStringList,QStringList)), core, SLOT(newCopy(quint32,QStringList,QStringList)));
- connect(copyServer, SIGNAL(newCopy(quint32,QStringList,QStringList,QString,QString)), core, SLOT(newCopy(quint32,QStringList,QStringList,QString,QString)));
- connect(copyServer, SIGNAL(newMove(quint32,QStringList,QStringList)), core, SLOT(newMove(quint32,QStringList,QStringList)));
- connect(copyServer, SIGNAL(newMove(quint32,QStringList,QStringList,QString,QString)), core, SLOT(newMove(quint32,QStringList,QStringList,QString,QString)));
- connect(core, SIGNAL(copyFinished(quint32,bool)), copyServer, SLOT(copyFinished(quint32,bool)));
- connect(core, SIGNAL(copyCanceled(quint32)), copyServer, SLOT(copyCanceled(quint32)));
- if(localListener.tryConnect())
- {
- stopIt=true;
- //why before removed???
- QCoreApplication::quit();
- return;
- }
- localListener.listenServer();
- //load the systray icon
- if(backgroundIcon==NULL)
- {
- backgroundIcon=new SystrayIcon();
- //connect the slot
- //quit is for this object
-// connect(core, SIGNAL(newCanDoOnlyCopy(bool)), backgroundIcon, SLOT(newCanDoOnlyCopy(bool)));
- connect(backgroundIcon, SIGNAL(quit()),this,SLOT(quit()));
- //show option is for OptionEngine object
- connect(backgroundIcon, SIGNAL(showOptions()), &optionDialog, SLOT(show()));
- connect(copyServer, SIGNAL(listenerReady(ListeningState,bool,bool)), backgroundIcon, SLOT(listenerReady(ListeningState,bool,bool)));
- connect(copyServer, SIGNAL(pluginLoaderReady(CatchState,bool,bool)), backgroundIcon, SLOT(pluginLoaderReady(CatchState,bool,bool)));
- connect(backgroundIcon, SIGNAL(tryCatchCopy()), copyServer, SLOT(listen()));
- connect(backgroundIcon, SIGNAL(tryUncatchCopy()), copyServer, SLOT(close()));
- if(options->getOptionValue("CopyListener","CatchCopyAsDefault").toBool())
- copyServer->listen();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+QString::number(copyServer->oneListenerIsLoaded()));
- //backgroundIcon->readyToListen(copyServer.oneListenerIsLoaded());
-
- connect(backgroundIcon, SIGNAL(addWindowCopyMove(CopyMode,QString)), core, SLOT(addWindowCopyMove(CopyMode,QString)));
- connect(backgroundIcon, SIGNAL(addWindowTransfer(QString)), core, SLOT(addWindowTransfer(QString)));
- connect(copyEngineList, SIGNAL(addCopyEngine(QString,bool)), backgroundIcon, SLOT(addCopyEngine(QString,bool)));
- connect(copyEngineList, SIGNAL(removeCopyEngine(QString)), backgroundIcon, SLOT(removeCopyEngine(QString)));
- copyEngineList->setIsConnected();
- copyServer->resendState();
- }
- //conntect the last chance signal before quit
- connect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),this,SLOT(quit()));
- //connect the slot for the help dialog
- connect(backgroundIcon,SIGNAL(showHelp()),&theHelp,SLOT(show()));
+ if(core==NULL || copyEngineList==NULL)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Unable to initialize correctly the software");
+ return;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Initialize the variable of event loop");
+ connect(copyServer, &CopyListener::newCopyWithoutDestination, core, &Core::newCopyWithoutDestination,Qt::DirectConnection);
+ connect(copyServer, &CopyListener::newCopy, core, &Core::newCopy,Qt::DirectConnection);
+ connect(copyServer, &CopyListener::newMoveWithoutDestination, core, &Core::newMoveWithoutDestination,Qt::DirectConnection);
+ connect(copyServer, &CopyListener::newMove, core, &Core::newMove,Qt::DirectConnection);
+ connect(core, &Core::copyFinished, copyServer, &CopyListener::copyFinished,Qt::DirectConnection);
+ connect(core, &Core::copyCanceled, copyServer, &CopyListener::copyCanceled,Qt::DirectConnection);
+ if(localListener.tryConnect())
+ {
+ stopIt=true;
+ QCoreApplication::exit(1);//by 1, return process is in progress
+ return;
+ }
+ localListener.listenServer();
+ //load the systray icon
+ if(backgroundIcon==NULL)
+ {
+ backgroundIcon=new SystrayIcon();
+ //connect the slot
+ //quit is for this object
+// connect(core, &Core::newCanDoOnlyCopy, backgroundIcon, &SystrayIcon::newCanDoOnlyCopy,Qt::DirectConnection);
+ connect(backgroundIcon, &SystrayIcon::quit,this,&EventDispatcher::quit);
+ //show option is for OptionEngine object
+ connect(backgroundIcon, &SystrayIcon::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection);
+ connect(&cliParser, &CliParser::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection);
+ connect(copyServer, &CopyListener::listenerReady, backgroundIcon, &SystrayIcon::listenerReady,Qt::DirectConnection);
+ connect(copyServer, &CopyListener::pluginLoaderReady, backgroundIcon, &SystrayIcon::pluginLoaderReady,Qt::DirectConnection);
+ connect(backgroundIcon, &SystrayIcon::tryCatchCopy, copyServer, &CopyListener::listen,Qt::DirectConnection);
+ connect(backgroundIcon, &SystrayIcon::tryUncatchCopy, copyServer, &CopyListener::close,Qt::DirectConnection);
+ if(OptionEngine::optionEngine->getOptionValue("CopyListener","CatchCopyAsDefault").toBool())
+ copyServer->listen();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+QString::number(copyServer->oneListenerIsLoaded()));
+ //backgroundIcon->readyToListen(copyServer.oneListenerIsLoaded());
+
+ #ifdef ULTRACOPIER_DEBUG
+ connect(backgroundIcon, &SystrayIcon::saveBugReport, DebugEngine::debugEngine, &DebugEngine::saveBugReport,Qt::QueuedConnection);
+ #endif
+ connect(backgroundIcon, &SystrayIcon::addWindowCopyMove, core, &Core::addWindowCopyMove,Qt::DirectConnection);
+ connect(backgroundIcon, &SystrayIcon::addWindowTransfer, core, &Core::addWindowTransfer,Qt::DirectConnection);
+ connect(copyEngineList, &CopyEngineManager::addCopyEngine, backgroundIcon, &SystrayIcon::addCopyEngine,Qt::DirectConnection);
+ connect(copyEngineList, &CopyEngineManager::removeCopyEngine, backgroundIcon, &SystrayIcon::removeCopyEngine,Qt::DirectConnection);
+ #ifdef ULTRACOPIER_INTERNET_SUPPORT
+ connect(&internetUpdater,&InternetUpdater::newUpdate, backgroundIcon, &SystrayIcon::newUpdate);
+ #endif
+ copyEngineList->setIsConnected();
+ copyServer->resendState();
+ }
+ //conntect the last chance signal before quit
+ connect(QCoreApplication::instance(),&QCoreApplication::aboutToQuit,this,&EventDispatcher::quit,Qt::DirectConnection);
+ //connect the slot for the help dialog
+ connect(backgroundIcon,&SystrayIcon::showHelp,&theHelp,&HelpDialog::show);
+ #ifdef ULTRACOPIER_DEBUG
+ DebugModel::debugModel->setupTheTimer();
+ #endif
}
+#ifdef Q_OS_WIN32
+QString EventDispatcher::GetOSDisplayString()
+{
+ QString Os;
+ OSVERSIONINFOEX osvi;
+ SYSTEM_INFO si;
+ PGNSI pGNSI;
+ PGPI pGPI;
+ BOOL bOsVersionInfoEx;
+ DWORD dwType;
+
+ ZeroMemory(&si, sizeof(SYSTEM_INFO));
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
+
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
+
+ if(bOsVersionInfoEx == NULL)
+ return QStringLiteral("Os detection blocked");
+
+ // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
+
+ pGNSI = (PGNSI) GetProcAddress(
+ GetModuleHandle(TEXT("kernel32.dll")),
+ "GetNativeSystemInfo");
+ if(NULL != pGNSI)
+ pGNSI(&si);
+ else GetSystemInfo(&si);
+
+ if(VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion>4)
+ {
+ if(osvi.dwMajorVersion==6)
+ {
+ switch(osvi.dwMinorVersion)
+ {
+ case 0:
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Windows Vista ");
+ else Os+=QStringLiteral("Windows Server 2008 ");
+ break;
+ case 1:
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Windows 7 ");
+ else Os+=QStringLiteral("Windows Server 2008 R2 ");
+ break;
+ case 2:
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Windows 8 ");
+ else Os+=QStringLiteral("Windows Server 2012 ");
+ break;
+ default:
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Windows (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
+ else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
+ break;
+ }
+
+ pGPI = (PGPI) GetProcAddress(
+ GetModuleHandle(TEXT("kernel32.dll")),
+ "GetProductInfo");
+
+ pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
+
+ switch(dwType)
+ {
+ case PRODUCT_ULTIMATE:
+ Os+=QStringLiteral("Ultimate Edition");
+ break;
+ case PRODUCT_PROFESSIONAL:
+ Os+=QStringLiteral("Professional");
+ break;
+ case PRODUCT_HOME_PREMIUM:
+ Os+=QStringLiteral("Home Premium Edition");
+ break;
+ case PRODUCT_HOME_BASIC:
+ Os+=QStringLiteral("Home Basic Edition");
+ break;
+ case PRODUCT_ENTERPRISE:
+ Os+=QStringLiteral("Enterprise Edition");
+ break;
+ case PRODUCT_BUSINESS:
+ Os+=QStringLiteral("Business Edition");
+ break;
+ case PRODUCT_STARTER:
+ Os+=QStringLiteral("Starter Edition");
+ break;
+ case PRODUCT_CLUSTER_SERVER:
+ Os+=QStringLiteral("Cluster Server Edition");
+ break;
+ case PRODUCT_DATACENTER_SERVER:
+ Os+=QStringLiteral("Datacenter Edition");
+ break;
+ case PRODUCT_DATACENTER_SERVER_CORE:
+ Os+=QStringLiteral("Datacenter Edition (core installation)");
+ break;
+ case PRODUCT_ENTERPRISE_SERVER:
+ Os+=QStringLiteral("Enterprise Edition");
+ break;
+ case PRODUCT_ENTERPRISE_SERVER_CORE:
+ Os+=QStringLiteral("Enterprise Edition (core installation)");
+ break;
+ case PRODUCT_ENTERPRISE_SERVER_IA64:
+ Os+=QStringLiteral("Enterprise Edition for Itanium-based Systems");
+ break;
+ case PRODUCT_SMALLBUSINESS_SERVER:
+ Os+=QStringLiteral("Small Business Server");
+ break;
+ case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
+ Os+=QStringLiteral("Small Business Server Premium Edition");
+ break;
+ case PRODUCT_STANDARD_SERVER:
+ Os+=QStringLiteral("Standard Edition");
+ break;
+ case PRODUCT_STANDARD_SERVER_CORE:
+ Os+=QStringLiteral("Standard Edition (core installation)");
+ break;
+ case PRODUCT_WEB_SERVER:
+ Os+=QStringLiteral("Web Server Edition");
+ break;
+ }
+ }
+ else if(osvi.dwMajorVersion==5)
+ {
+ switch(osvi.dwMinorVersion)
+ {
+ case 0:
+ Os+=QStringLiteral("Windows 2000 ");
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Professional");
+ else
+ {
+ if(osvi.wSuiteMask & VER_SUITE_DATACENTER)
+ Os+=QStringLiteral("Datacenter Server");
+ else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
+ Os+=QStringLiteral("Advanced Server");
+ else Os+=QStringLiteral("Server");
+ }
+ break;
+ case 1:
+ Os+=QStringLiteral("Windows XP ");
+ if(osvi.wSuiteMask & VER_SUITE_PERSONAL)
+ Os+=QStringLiteral("Home Edition");
+ else Os+=QStringLiteral("Professional");
+ break;
+ case 2:
+ if(GetSystemMetrics(SM_SERVERR2))
+ Os+=QStringLiteral("Windows Server 2003 R2, ");
+ else if(osvi.wSuiteMask & VER_SUITE_STORAGE_SERVER )
+ Os+=QStringLiteral("Windows Storage Server 2003");
+ else if(osvi.wSuiteMask & VER_SUITE_WH_SERVER )
+ Os+=QStringLiteral("Windows Home Server");
+ else if(osvi.wProductType==VER_NT_WORKSTATION && si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
+ Os+=QStringLiteral("Windows XP Professional x64 Edition");
+ else Os+=QStringLiteral("Windows Server 2003, ");
+ // Test for the server type.
+ if(osvi.wProductType!=VER_NT_WORKSTATION )
+ {
+ if(si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64)
+ {
+ if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
+ Os+=QStringLiteral("Datacenter Edition for Itanium-based Systems");
+ else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
+ Os+=QStringLiteral("Enterprise Edition for Itanium-based Systems");
+ }
+ else if(si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
+ {
+ if(osvi.wSuiteMask & VER_SUITE_DATACENTER)
+ Os+=QStringLiteral("Datacenter x64 Edition");
+ else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
+ Os+=QStringLiteral("Enterprise x64 Edition");
+ else Os+=QStringLiteral("Standard x64 Edition");
+ }
+ else
+ {
+ if(osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER)
+ Os+=QStringLiteral("Compute Cluster Edition");
+ else if( osvi.wSuiteMask & VER_SUITE_DATACENTER)
+ Os+=QStringLiteral("Datacenter Edition");
+ else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
+ Os+=QStringLiteral("Enterprise Edition");
+ else if(osvi.wSuiteMask & VER_SUITE_BLADE)
+ Os+=QStringLiteral("Web Edition");
+ else Os+=QStringLiteral("Standard Edition");
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Windows (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
+ else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
+ }
+
+ // Include service pack (if any) and build number.
+ QString QszCSDVersion=QString::fromUtf16((ushort*)osvi.szCSDVersion);
+ if(!QszCSDVersion.isEmpty())
+ Os+=QStringLiteral(" %1").arg(QszCSDVersion);
+ Os+=QStringLiteral(" (build %1)").arg(osvi.dwBuildNumber);
+ if(osvi.dwMajorVersion >= 6)
+ {
+ if(si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
+ Os+=QStringLiteral(", 64-bit");
+ else if(si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL)
+ Os+=QStringLiteral(", 32-bit");
+ }
+ }
+ else
+ {
+ if(osvi.wProductType==VER_NT_WORKSTATION)
+ Os+=QStringLiteral("Windows (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
+ else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
+ }
+ return Os;
+}
+#endif
+
+#ifdef Q_OS_MAC
+QString EventDispatcher::GetOSDisplayString()
+{
+ QStringList key;
+ QStringList string;
+ QFile xmlFile(QStringLiteral("/System/Library/CoreServices/SystemVersion.plist"));
+ if(xmlFile.open(QIODevice::ReadOnly))
+ {
+ QString content=xmlFile.readAll();
+ xmlFile.close();
+ QString errorStr;
+ int errorLine;
+ int errorColumn;
+ QDomDocument domDocument;
+ if (!domDocument.setContent(content, false, &errorStr,&errorLine,&errorColumn))
+ return QStringLiteral("Mac OS X");
+ else
+ {
+ QDomElement root = domDocument.documentElement();
+ if(root.tagName()!=QStringLiteral("plist"))
+ return QStringLiteral("Mac OS X");
+ else
+ {
+ if(root.isElement())
+ {
+ QDomElement SubChild=root.firstChildElement(QStringLiteral("dict"));
+ while(!SubChild.isNull())
+ {
+ if(SubChild.isElement())
+ {
+ QDomElement SubChild2=SubChild.firstChildElement(QStringLiteral("key"));
+ while(!SubChild2.isNull())
+ {
+ if(SubChild2.isElement())
+ key << SubChild2.text();
+ else
+ return QStringLiteral("Mac OS X");
+ SubChild2 = SubChild2.nextSiblingElement(QStringLiteral("key"));
+ }
+ SubChild2=SubChild.firstChildElement(QStringLiteral("string"));
+ while(!SubChild2.isNull())
+ {
+ if(SubChild2.isElement())
+ string << SubChild2.text();
+ else
+ return QStringLiteral("Mac OS X");
+ SubChild2 = SubChild2.nextSiblingElement(QStringLiteral("string"));
+ }
+ }
+ else
+ return QStringLiteral("Mac OS X");
+ SubChild = SubChild.nextSiblingElement(QStringLiteral("property"));
+ }
+ }
+ else
+ return QStringLiteral("Mac OS X");
+ }
+ }
+ }
+ if(key.size()!=string.size())
+ return QStringLiteral("Mac OS X");
+ int index=0;
+ while(index<key.size())
+ {
+ if(key.at(index)==QStringLiteral("ProductVersion"))
+ return QStringLiteral("Mac OS X ")+string.at(index);
+ index++;
+ }
+ return QStringLiteral("Mac OS X");
+}
+#endif
diff --git a/EventDispatcher.h b/EventDispatcher.h
index 35a5d07..b597c90 100644
--- a/EventDispatcher.h
+++ b/EventDispatcher.h
@@ -1,8 +1,6 @@
/** \file EventDispatcher.h
\brief Define the class of the event dispatcher
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef EVENT_DISPATCHER_H
@@ -17,11 +15,15 @@
#include "Environment.h"
#include "Core.h"
-#include "GlobalClass.h"
#include "SystrayIcon.h"
#include "OptionEngine.h"
#include "HelpDialog.h"
+#ifndef ULTRACOPIER_VERSION_PORTABLE
#include "SessionLoader.h"
+#endif
+#ifdef ULTRACOPIER_INTERNET_SUPPORT
+#include "InternetUpdater.h"
+#endif
#include "CopyListener.h"
#include "OptionDialog.h"
#include "CopyEngineManager.h"
@@ -31,57 +33,65 @@
/** \brief Define the class of the event dispatcher
This class provide a core for dispatch the event of signal/slot, it checks too if not other instance is running */
-class EventDispatcher : public QObject, public GlobalClass
+class EventDispatcher : public QObject
{
- Q_OBJECT
- public:
- /// \brief Initiate the ultracopier event dispatcher and check if no other session is running
- EventDispatcher();
- /// \brief Destroy the ultracopier event dispatcher
- ~EventDispatcher();
- /// \brief return if need be close
- bool shouldBeClosed();
- public slots:
- /// \brief Quit ultracopier
- void quit();
- signals:
- /** \brief Send that's caught state have changed for CatchedState::Uncatched or CatchedState::Semicatched or CatchedState::Catched
- \see CatchState
- \see tryCatchCopy()
- \see tryUncatchCopy()
- \param State is the new state */
- void catchCopyStateChanged(CatchState state);
- /** \brief Send that's copy/move task is finished in returning the copyMoveEventId
- \see routeCopyMoveEvent()
- \param copyMoveEventId The task id generated by routeCopyMoveEvent() */
- void copyMoveEventIsFinish(int copyMoveEventId);
- private:
- /// \brief To have counter for increment the copyMoveEventId at each request
- int copyMoveEventIdIndex;
- /// \brief To store windows windows session
- struct CoreSession
- {
- Core * CoreWindow;
- QList<int> copyMoveEventIdManaged;
- };
- /// \brief the systray icon
- SystrayIcon *backgroundIcon;
- /// \brief To lunch event only when the event loop is setup
- QTimer lunchInitFunction;
- /// \brief the help dialog
- HelpDialog theHelp;
- /// \brief the session loader
- SessionLoader *sessionloader;
- bool stopIt;
- CopyListener *copyServer;
- Core *core;
- OptionDialog optionDialog;
- CopyEngineManager *copyEngineList;
- LocalListener localListener;
- CliParser cliParser;
- private slots:
- /// \brief Called when event loop is setup
- void initFunction();
+ Q_OBJECT
+ public:
+ /// \brief Initiate the ultracopier event dispatcher and check if no other session is running
+ EventDispatcher();
+ /// \brief Destroy the ultracopier event dispatcher
+ ~EventDispatcher();
+ /// \brief return if need be close
+ bool shouldBeClosed();
+ #if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
+ static QString GetOSDisplayString();
+ #endif
+ public slots:
+ /// \brief Quit ultracopier
+ void quit();
+ signals:
+ /** \brief Send that's caught state have changed for CatchedState::Uncatched or CatchedState::Semicatched or CatchedState::Catched
+ \see CatchState
+ \see tryCatchCopy()
+ \see tryUncatchCopy()
+ \param State is the new state */
+ void catchCopyStateChanged(Ultracopier::CatchState state) const;
+ /** \brief Send that's copy/move task is finished in returning the copyMoveEventId
+ \see routeCopyMoveEvent()
+ \param copyMoveEventId The task id generated by routeCopyMoveEvent() */
+ void copyMoveEventIsFinish(int copyMoveEventId) const;
+ private:
+ /// \brief To have counter for increment the copyMoveEventId at each request
+ int copyMoveEventIdIndex;
+ /// \brief To store windows windows session
+ struct CoreSession
+ {
+ Core * CoreWindow;
+ QList<int> copyMoveEventIdManaged;
+ };
+ /// \brief the systray icon
+ SystrayIcon *backgroundIcon;
+ /// \brief To lunch event only when the event loop is setup
+ QTimer lunchInitFunction;
+ /// \brief the help dialog
+ HelpDialog theHelp;
+ #ifndef ULTRACOPIER_VERSION_PORTABLE
+ /// \brief the session loader
+ SessionLoader *sessionloader;
+ #endif
+ bool stopIt;
+ CopyListener *copyServer;
+ Core *core;
+ OptionDialog optionDialog;
+ #ifdef ULTRACOPIER_INTERNET_SUPPORT
+ InternetUpdater internetUpdater;
+ #endif
+ CopyEngineManager *copyEngineList;
+ LocalListener localListener;
+ CliParser cliParser;
+ private slots:
+ /// \brief Called when event loop is setup
+ void initFunction();
};
#endif // EVENT_DISPATCHER_H
diff --git a/ExtraSocket.cpp b/ExtraSocket.cpp
index 08b0979..8175c5f 100644
--- a/ExtraSocket.cpp
+++ b/ExtraSocket.cpp
@@ -1,32 +1,60 @@
/** \file ExtraSocket.h
\brief Define the socket of ultracopier
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "ExtraSocket.h"
+#include <QByteArray>
+#include <stdio.h>
QString ExtraSocket::pathSocket(const QString &name)
{
#ifdef Q_OS_UNIX
- return name+"-"+QString::number(getuid());
+ return name+QStringLiteral("-")+QString::number(getuid());
#else
- QString userName;
- DWORD size=0;
- if(GetUserNameW(NULL,&size) || (GetLastError()!=ERROR_INSUFFICIENT_BUFFER))
- {
- }
- else
- {
- WCHAR * userNameW=new WCHAR[size];
- if(GetUserNameW(userNameW,&size))
- {
- userName.fromWCharArray(userNameW,size*2);
- userName=QString(QByteArray((char*)userNameW,size*2-2).toHex());
- }
- delete userNameW;
- }
- return name+"-"+userName;
+ QString userName;
+
+ /* bad way for catchcopy compatibility
+ char uname[1024];
+ DWORD len=1023;
+ if(GetUserNameA(uname, &len)!=FALSE)
+ userName=QString::fromLatin1(toHex(uname));*/
+
+ QChar charTemp;
+ DWORD size=255;
+ WCHAR * userNameW=new WCHAR[size];
+ if(GetUserNameW(userNameW,&size))
+ {
+ QByteArray tempArray;
+ userName=QString::fromWCharArray(userNameW,size-1);
+ int index=0;
+ while(index<userName.size())
+ {
+ tempArray+=userName.at(index).cell();
+ tempArray+=userName.at(index).row();
+ index++;
+ }
+ userName=tempArray.toHex();
+ }
+ delete userNameW;
+ return name+QStringLiteral("-")+userName;
#endif
}
+
+// Dump UTF16 (little endian)
+char * ExtraSocket::toHex(const char *str)
+{
+ char *p, *sz;
+ size_t len;
+ if (str==NULL)
+ return NULL;
+ len= strlen(str);
+ p = sz = (char *) malloc((len+1)*4);
+ for (size_t i=0; i<len; i++)
+ {
+ sprintf(p, "%.2x00", str[i]);
+ p+=4;
+ }
+ *p=0;
+ return sz;
+}
diff --git a/ExtraSocket.h b/ExtraSocket.h
index 56229c7..4fa15e1 100644
--- a/ExtraSocket.h
+++ b/ExtraSocket.h
@@ -1,8 +1,6 @@
/** \file ExtraSocket.h
\brief Define the socket for ultracopier
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef EXTRASOCKET_H
@@ -11,18 +9,22 @@
#include <QString>
#ifdef Q_OS_UNIX
- #include <unistd.h>
- #include <sys/types.h>
+ #include <unistd.h>
+ #include <sys/types.h>
#else
- #include <windows.h>
+ #ifndef NOMINMAX
+ #define NOMINMAX
+ #endif
+ #include <windows.h>
#endif
/** \brief class to have general socket options */
class ExtraSocket
{
public:
- /** \brief class to return always the same socket resolution */
- static QString pathSocket(const QString &name);
+ /** \brief class to return always the same socket resolution */
+ static QString pathSocket(const QString &name);
+ static char * toHex(const char *str);
};
#endif // EXTRASOCKET_H
diff --git a/FacilityEngine.cpp b/FacilityEngine.cpp
index 30c5168..ca6d467 100644
--- a/FacilityEngine.cpp
+++ b/FacilityEngine.cpp
@@ -2,207 +2,240 @@
\brief To implement the facility engine, the interface is defined into FacilityInterface()
\see FacilityInterface()
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "FacilityEngine.h"
#if defined (Q_OS_WIN32)
-#include <windows.h>
+ #ifndef NOMINMAX
+ #define NOMINMAX
+ #endif
+ #include <windows.h>
#endif
+FacilityEngine FacilityEngine::facilityEngine;
+
FacilityEngine::FacilityEngine()
{
- retranslate();
+ retranslate();
}
/// \brief To force the text re-translation
void FacilityEngine::retranslate()
{
- //undirect translated string
- Translation_perSecond="/"+tr("s");
- Translation_tooBig=tr("Too big");
- Translation_B=tr("B");
- Translation_KB=tr("KB");
- Translation_MB=tr("MB");
- Translation_GB=tr("GB");
- Translation_TB=tr("TB");
- Translation_PB=tr("PB");
- Translation_EB=tr("EB");
- Translation_ZB=tr("ZB");
- Translation_YB=tr("YB");
- Translation_SimplifiedRemaningTime_LessThan10s=tr("Less than %10 seconds");
- Translation_SimplifiedRemaningTime_AboutSeconds=tr("About %10 seconds remaining");
- Translation_SimplifiedRemaningTime_AboutMinutes=tr("About %1 minutes remaining");
- Translation_SimplifiedRemaningTime_AboutHours=tr("About %1 hours remaining");
- //load the translations tab
- translations["Copy engine"]=tr("Copy engine");
- translations["Copy"]=tr("Copy");
- translations["Move"]=tr("Move");
- translations["Pause"]=tr("Pause");
- translations["Resume"]=tr("Resume");
- translations["Skip"]=tr("Skip");
- translations["Unlimited"]=tr("Unlimited");
- translations["Source"]=tr("Source");
- translations["Size"]=tr("Size");
- translations["Destination"]=tr("Destination");
- translations["Quit"]=tr("Quit");
- translations["Target"]=tr("Target");
- translations["Time remaining:"]=tr("Time remaining:");
- translations["Listing"]=tr("Listing");
- translations["Copying"]=tr("Copying");
- translations["Listing and copying"]=tr("Listing and copying");
- translations["Time remaining:"]=tr("Time remaining:");
- //for copy engine
- translations["Ask"]=tr("Ask");
- translations["Skip"]=tr("Skip");
- translations["Overwrite"]=tr("Overwrite");
- translations["Overwrite if newer"]=tr("Overwrite if newer");
- translations["Overwrite if the last modification dates are different"]=tr("Overwrite if the last modification dates are different");
- translations["Rename"]=tr("Rename");
- translations["Put to end of the list"]=tr("Put to end of the list");
- translations["Select source directory"]=tr("Select source directory");
- translations["Select destination directory"]=tr("Select destination directory");
- translations["Internal error"]=tr("Internal error");
- translations["Select one or more files to open"]=tr("Select one or more files to open");
- translations["All files"]=tr("All files");
- translations["Save transfer list"]=tr("Save transfer list");
- translations["Open transfer list"]=tr("Open transfer list");
- translations["Transfer list"]=tr("Transfer list");
- translations["Error"]=tr("Error");
- translations["Not supported on this platform"]=tr("Not supported on this platform");
+ //undirect translated string
+ Translation_perSecond=QStringLiteral("/")+tr("s");
+ Translation_tooBig=tr("Too big");
+ Translation_B=tr("B");
+ Translation_KB=tr("KB");
+ Translation_MB=tr("MB");
+ Translation_GB=tr("GB");
+ Translation_TB=tr("TB");
+ Translation_PB=tr("PB");
+ Translation_EB=tr("EB");
+ Translation_ZB=tr("ZB");
+ Translation_YB=tr("YB");
+ Translation_SimplifiedRemaningTime_LessThan10s=tr("Less than %10 seconds");
+ Translation_SimplifiedRemaningTime_AboutSeconds=tr("About %10 seconds remaining");
+ Translation_SimplifiedRemaningTime_AboutMinutes=tr("About %1 minutes remaining");
+ Translation_SimplifiedRemaningTime_AboutHours=tr("About %1 hours remaining");
+ //load the translations tab
+ translations["Copy engine"]=tr("Copy engine");
+ //: a copy
+ translations["Copy"]=tr("Copy");
+ //: a transfer
+ translations["Transfer"]=tr("Transfer");
+ //: a move
+ translations["Move"]=tr("Move");
+ translations["Start"]=tr("Start");
+ translations["Pause"]=tr("Pause");
+ translations["Resume"]=tr("Resume");
+ translations["Skip"]=tr("Skip");
+ translations["Unlimited"]=tr("Unlimited");
+ translations["Source"]=tr("Source");
+ translations["Size"]=tr("Size");
+ translations["Destination"]=tr("Destination");
+ translations["Quit"]=tr("Quit");
+ translations["Target"]=tr("Target");
+ translations["Time remaining:"]=tr("Time remaining:");
+ translations["Listing"]=tr("Listing");
+ translations["Copying"]=tr("Copying");
+ translations["Listing and copying"]=tr("Listing and copying");
+ translations["Time remaining:"]=tr("Time remaining:");
+ //for copy engine
+ translations["Ask"]=tr("Ask");
+ translations["Skip"]=tr("Skip");
+ translations["Overwrite"]=tr("Overwrite");
+ translations["Overwrite if newer"]=tr("Overwrite if newer");
+ translations["Overwrite if the last modification dates are different"]=tr("Overwrite if the last modification dates are different");
+ translations["Rename"]=tr("Rename");
+ translations["Put to the end of the list"]=tr("Put to the end of the list");
+ translations["Select source directory"]=tr("Select source directory");
+ translations["Select destination directory"]=tr("Select destination directory");
+ translations["Internal error"]=tr("Internal error");
+ translations["Select one or more files to open"]=tr("Select one or more files to open");
+ translations["All files"]=tr("All files");
+ translations["Save transfer list"]=tr("Save transfer list");
+ translations["Open transfer list"]=tr("Open transfer list");
+ translations["Transfer list"]=tr("Transfer list");
+ translations["Error"]=tr("Error");
+ translations["Not supported on this platform"]=tr("Not supported on this platform");
+ translations["Completed in %1"]=tr("Completed in %1");
}
/// \brief convert size in Byte to String
-QString FacilityEngine::sizeToString(const double &size)
+QString FacilityEngine::sizeToString(const double &size) const
{
- double size_temp=size;
- if(size_temp<1024)
- return QString::number(size_temp)+sizeUnitToString(SizeUnit_byte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_KiloByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_MegaByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_GigaByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_TeraByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_PetaByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_ExaByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_ZettaByte);
- if((size_temp=size_temp/1024)<1024)
- return adaptString(size_temp)+sizeUnitToString(SizeUnit_YottaByte);
- return Translation_tooBig;
+ double size_temp=size;
+ if(size_temp<1024)
+ return QString::number(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_byte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_KiloByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_MegaByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_GigaByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_TeraByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_PetaByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_ExaByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_ZettaByte);
+ if((size_temp=size_temp/1024)<1024)
+ return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_YottaByte);
+ return Translation_tooBig;
}
-QString FacilityEngine::adaptString(const float &size)
+QString FacilityEngine::adaptString(const float &size) const
{
- if(size>=100)
- return QString::number(size,'f',0);
- else
- return QString::number(size,'g',3);
+ if(size>=100)
+ return QString::number(size,'f',0);
+ else
+ return QString::number(size,'g',3);
}
/// \brief convert size unit to String
-QString FacilityEngine::sizeUnitToString(const SizeUnit &sizeUnit)
+QString FacilityEngine::sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const
{
- switch(sizeUnit)
- {
- case SizeUnit_byte:
- return Translation_B;
- case SizeUnit_KiloByte:
- return Translation_KB;
- case SizeUnit_MegaByte:
- return Translation_MB;
- case SizeUnit_GigaByte:
- return Translation_GB;
- case SizeUnit_TeraByte:
- return Translation_TB;
- case SizeUnit_PetaByte:
- return Translation_PB;
- case SizeUnit_ExaByte:
- return Translation_EB;
- case SizeUnit_ZettaByte:
- return Translation_ZB;
- case SizeUnit_YottaByte:
- return Translation_YB;
- default:
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"sizeUnit: "+QString::number(sizeUnit));
- return "???";
- }
+ switch(sizeUnit)
+ {
+ case Ultracopier::SizeUnit_byte:
+ return Translation_B;
+ case Ultracopier::SizeUnit_KiloByte:
+ return Translation_KB;
+ case Ultracopier::SizeUnit_MegaByte:
+ return Translation_MB;
+ case Ultracopier::SizeUnit_GigaByte:
+ return Translation_GB;
+ case Ultracopier::SizeUnit_TeraByte:
+ return Translation_TB;
+ case Ultracopier::SizeUnit_PetaByte:
+ return Translation_PB;
+ case Ultracopier::SizeUnit_ExaByte:
+ return Translation_EB;
+ case Ultracopier::SizeUnit_ZettaByte:
+ return Translation_ZB;
+ case Ultracopier::SizeUnit_YottaByte:
+ return Translation_YB;
+ default:
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"sizeUnit: "+QString::number(sizeUnit));
+ return "???";
+ }
}
/// \brief translate the text
-QString FacilityEngine::translateText(const QString &text)
+QString FacilityEngine::translateText(const QString &text) const
{
- if(translations.contains(text))
- return translations[text];
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"text: "+text);
- return text;
- }
+ if(translations.contains(text))
+ return translations.value(text);
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"translation not found: "+text);
+ return text;
+ }
}
/// \brief speed to string in byte per seconds
-QString FacilityEngine::speedToString(const double &speed)
+QString FacilityEngine::speedToString(const double &speed) const
{
- return sizeToString(speed)+Translation_perSecond;
+ return sizeToString(speed)+Translation_perSecond;
}
/// \brief Decompose the time in second
-TimeDecomposition FacilityEngine::secondsToTimeDecomposition(const quint32 &seconds)
+Ultracopier::TimeDecomposition FacilityEngine::secondsToTimeDecomposition(const quint32 &seconds) const
{
- quint32 seconds_temp=seconds;
- TimeDecomposition returnValue;
- returnValue.second=seconds_temp%60;
- seconds_temp-=returnValue.second;
- seconds_temp/=60;
- returnValue.minute=seconds_temp%60;
- seconds_temp-=returnValue.minute;
- seconds_temp/=60;
- returnValue.hour=seconds_temp;
- return returnValue;
+ quint32 seconds_temp=seconds;
+ Ultracopier::TimeDecomposition returnValue;
+ returnValue.second=seconds_temp%60;
+ seconds_temp-=returnValue.second;
+ seconds_temp/=60;
+ returnValue.minute=seconds_temp%60;
+ seconds_temp-=returnValue.minute;
+ seconds_temp/=60;
+ returnValue.hour=seconds_temp;
+ return returnValue;
}
/// \brief have the functionality
-bool FacilityEngine::haveFunctionality(const QString &fonctionnality)
+bool FacilityEngine::haveFunctionality(const QString &fonctionnality) const
{
- #if defined (Q_OS_WIN32)
- if(fonctionnality=="shutdown")
- return true;
- #endif
- Q_UNUSED(fonctionnality);
- return false;
+ #if defined (Q_OS_WIN32)
+ if(fonctionnality=="shutdown")
+ return true;
+ #endif
+ Q_UNUSED(fonctionnality);
+ return false;
}
/// \brief call the fonctionnality
QVariant FacilityEngine::callFunctionality(const QString &fonctionnality,const QStringList &args)
{
- #if defined (Q_OS_WIN32)
- ExitWindowsEx(EWX_POWEROFF | EWX_FORCE,0);
- system("shutdown /s /f /t 0");
- #endif
- Q_UNUSED(fonctionnality);
- Q_UNUSED(args);
- return QVariant();
+ #if defined (Q_OS_WIN32)
+ ExitWindowsEx(EWX_POWEROFF | EWX_FORCE,0);
+ system("shutdown /s /f /t 0");
+ #endif
+ Q_UNUSED(fonctionnality);
+ Q_UNUSED(args);
+ return QVariant();
}
/// \brief Do the simplified time
-QString FacilityEngine::simplifiedRemainingTime(const quint32 &seconds)
+QString FacilityEngine::simplifiedRemainingTime(const quint32 &seconds) const
+{
+ if(seconds<50)
+ {
+ if(seconds<10)
+ return Translation_SimplifiedRemaningTime_LessThan10s.arg(seconds/10+1);
+ else
+ return Translation_SimplifiedRemaningTime_AboutSeconds.arg(seconds/10+1);
+ }
+ if(seconds<3600)
+ return Translation_SimplifiedRemaningTime_AboutMinutes.arg(seconds/60);
+ return Translation_SimplifiedRemaningTime_AboutHours.arg(seconds/3600);
+}
+
+/// \brief Return ultimate url, empty is not found or already ultimate
+QString FacilityEngine::ultimateUrl() const
+{
+ #ifdef ULTRACOPIER_VERSION_ULTIMATE
+ return QString();
+ #else
+ #if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
+ return QStringLiteral("http://ultracopier.first-world.info/shop.html");
+ #else
+ return QString();
+ #endif
+ #endif
+}
+
+/// \brief Return the software name
+QString FacilityEngine::softwareName() const
{
- if(seconds<50)
- {
- if(seconds<10)
- return Translation_SimplifiedRemaningTime_LessThan10s.arg(seconds/10+1);
- else
- return Translation_SimplifiedRemaningTime_AboutSeconds.arg(seconds/10+1);
- }
- if(seconds<3600)
- return Translation_SimplifiedRemaningTime_AboutMinutes.arg(seconds/60);
- return Translation_SimplifiedRemaningTime_AboutHours.arg(seconds/3600);
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ return QStringLiteral("Supercopier");
+ #else
+ return QStringLiteral("Ultracopier");
+ #endif
}
diff --git a/FacilityEngine.h b/FacilityEngine.h
index d5a6145..1ab658f 100644
--- a/FacilityEngine.h
+++ b/FacilityEngine.h
@@ -2,8 +2,6 @@
\brief To implement the facility engine, the interface is defined into FacilityInterface()
\see FacilityInterface()
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef FACILITYENGINE_H
@@ -23,49 +21,55 @@ This class is used into some plugin like copy engine plugin, to all into one pla
*/
class FacilityEngine : public FacilityInterface
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit FacilityEngine();
- /// \brief convert size in Byte to String
- QString sizeToString(const double &size);
- /// \brief convert size unit to String
- QString sizeUnitToString(const SizeUnit &sizeUnit);
- /// \brief translate the text
- QString translateText(const QString &text);
- /// \brief speed to string in byte per seconds
- QString speedToString(const double &speed);
- /// \brief Decompose the time in second
- TimeDecomposition secondsToTimeDecomposition(const quint32 &seconds);
- /// \brief have the fonctionnality
- bool haveFunctionality(const QString &fonctionnality);
- /// \brief call the fonctionnality
- QVariant callFunctionality(const QString &fonctionnality,const QStringList &args=QStringList());
- /// \brief Do the simplified time
- QString simplifiedRemainingTime(const quint32 &seconds);
+ explicit FacilityEngine();
+ /// \brief convert size in Byte to String
+ QString sizeToString(const double &size) const;
+ /// \brief convert size unit to String
+ QString sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const;
+ /// \brief translate the text
+ QString translateText(const QString &text) const;
+ /// \brief speed to string in byte per seconds
+ QString speedToString(const double &speed) const;
+ /// \brief Decompose the time in second
+ Ultracopier::TimeDecomposition secondsToTimeDecomposition(const quint32 &seconds) const;
+ /// \brief have the fonctionnality
+ bool haveFunctionality(const QString &fonctionnality) const;
+ /// \brief call the fonctionnality
+ QVariant callFunctionality(const QString &fonctionnality,const QStringList &args=QStringList());
+ /// \brief Do the simplified time
+ QString simplifiedRemainingTime(const quint32 &seconds) const;
+ /// \brief Return ultimate url, empty is not found or already ultimate
+ QString ultimateUrl() const;
+ /// \brief Return the software name
+ QString softwareName() const;
+
+ static FacilityEngine facilityEngine;
private:
- //undirect translated string
- QString Translation_perSecond;
- QString Translation_tooBig;
- QString Translation_B;
- QString Translation_KB;
- QString Translation_MB;
- QString Translation_GB;
- QString Translation_TB;
- QString Translation_PB;
- QString Translation_EB;
- QString Translation_ZB;
- QString Translation_YB;
- //simplified remaining time
- QString Translation_SimplifiedRemaningTime_LessThan10s;
- QString Translation_SimplifiedRemaningTime_AboutSeconds;
- QString Translation_SimplifiedRemaningTime_AboutMinutes;
- QString Translation_SimplifiedRemaningTime_AboutHours;
- //internal fonction
- QString adaptString(const float &nb);
- QHash<QString,QString> translations;
+ //undirect translated string
+ QString Translation_perSecond;
+ QString Translation_tooBig;
+ QString Translation_B;
+ QString Translation_KB;
+ QString Translation_MB;
+ QString Translation_GB;
+ QString Translation_TB;
+ QString Translation_PB;
+ QString Translation_EB;
+ QString Translation_ZB;
+ QString Translation_YB;
+ //simplified remaining time
+ QString Translation_SimplifiedRemaningTime_LessThan10s;
+ QString Translation_SimplifiedRemaningTime_AboutSeconds;
+ QString Translation_SimplifiedRemaningTime_AboutMinutes;
+ QString Translation_SimplifiedRemaningTime_AboutHours;
+ //internal fonction
+ inline QString adaptString(const float &nb) const;
+ QHash<QString,QString> translations;
public slots:
- /// \brief To force the text re-translation
- void retranslate();
+ /// \brief To force the text re-translation
+ void retranslate();
};
#endif // FACILITYENGINE_H
diff --git a/GlobalClass.cpp b/GlobalClass.cpp
deleted file mode 100644
index 0f1c52a..0000000
--- a/GlobalClass.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/** \file GlobalClass.cpp
-\brief Define the class for all the class different of ResourcesManager, DebugEngine, ThemesManager, OptionEngine can have object of this class at the global scope
-\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
-
-#include "GlobalClass.h"
-
-/// \brief The constructor where set the global variable to the good pointer
-GlobalClass::GlobalClass()
-{
- //load the debug engine, themes and resources, after reused in all the program and all class derive from GlobalClass
- #ifdef ULTRACOPIER_DEBUG
- debug_engine_instance=DebugEngine::getInstance();
- #endif // ULTRACOPIER_DEBUG
- resources=ResourcesManager::getInstance();
- plugins=PluginsManager::getInstance();
- options=OptionEngine::getInstance();
- themes=ThemesManager::getInstance();
- languages=LanguagesManager::getInstance();
-}
-
-/// \brief The destructor where destroy the variable if the object no more longer used
-GlobalClass::~GlobalClass()
-{
- //destroy the resources variable if not more used
- LanguagesManager::destroyInstanceAtTheLastCall();
- ThemesManager::destroyInstanceAtTheLastCall();
- OptionEngine::destroyInstanceAtTheLastCall();
- PluginsManager::destroyInstanceAtTheLastCall();
- ResourcesManager::destroyInstanceAtTheLastCall();
- #ifdef ULTRACOPIER_DEBUG
- DebugEngine::destroyInstanceAtTheLastCall();
- #endif // ULTRACOPIER_DEBUG
-}
-
-
-
-
diff --git a/GlobalClass.h b/GlobalClass.h
deleted file mode 100644
index 21dd12e..0000000
--- a/GlobalClass.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/** \file GlobalClass.h
-\brief Define the class for all the class different of ResourcesManager, DebugEngine, ThemesManager, OptionEngine have object of this class at the global scope
-\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
-
-#ifndef GLOBAL_CLASS_H
-#define GLOBAL_CLASS_H
-
-#include "Environment.h"
-#include "ThemesManager.h"
-#include "ResourcesManager.h"
-#include "OptionEngine.h"
-#include "LanguagesManager.h"
-#include "PluginsManager.h"
-
-#include "interface/OptionInterface.h"
-
-/// \brief Define the class for the debug and global variables heritage
-class GlobalClass
-{
- public:
- /// \brief The constructor where set the global variable to the good pointer
- GlobalClass();
- /// \brief The destructor where destroy the variable if the unique instance is no more longer used
- ~GlobalClass();
- protected:
- //for the themes
- ThemesManager *themes;
- //for the resources linked with the themes
- ResourcesManager *resources;
- //for the options
- OptionEngine *options;
- //for the languages
- LanguagesManager *languages;
- //for the plugins
- PluginsManager *plugins;
- #ifdef ULTRACOPIER_DEBUG
- DebugEngine *debug_engine_instance;
- #endif // ULTRACOPIER_DEBUG
-};
-
-#endif // GLOBAL_CLASS_H
diff --git a/HelpDialog.cpp b/HelpDialog.cpp
index 2d06d54..f821eac 100644
--- a/HelpDialog.cpp
+++ b/HelpDialog.cpp
@@ -1,8 +1,6 @@
/** \file HelpDialog.cpp
\brief Define the help dialog
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "HelpDialog.h"
@@ -12,169 +10,140 @@
/// \brief Construct the object
HelpDialog::HelpDialog() :
- ui(new Ui::HelpDialog)
+ ui(new Ui::HelpDialog)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- ui->setupUi(this);
- reloadTextValue();
- #ifdef ULTRACOPIER_DEBUG
- connect(debug_engine_instance,SIGNAL(newDebugInformation()),this,SLOT(addDebugText()));
- connect(ui->pushButtonSaveBugReport,SIGNAL(clicked()),debug_engine_instance,SLOT(saveBugReport()));
- #else // ULTRACOPIER_DEBUG
- ui->lineEditInsertDebug->hide();
- ui->debugView->hide();
- ui->pushButtonSaveBugReport->hide();
- ui->pushButtonCrash->hide();
- this->setMaximumSize(QSize(500,128));
- /*timeToSetText.setInterval(250);
- timeToSetText.setSingleShot(true);
- connect(&timeToSetText,SIGNAL(timeout()),this,SLOT(showDebugText()));*/
- ui->pushButtonClose->hide();
- #endif // ULTRACOPIER_DEBUG
- //connect the about Qt
- connect(ui->pushButtonAboutQt,SIGNAL(toggled(bool)),qApp,SLOT(aboutQt()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ui->setupUi(this);
+ reloadTextValue();
+ #ifdef ULTRACOPIER_DEBUG
+ ui->debugView->setModel(DebugModel::debugModel);
+ connect(ui->pushButtonSaveBugReport,&QPushButton::clicked,DebugEngine::debugEngine,&DebugEngine::saveBugReport);
+ #else // ULTRACOPIER_DEBUG
+ ui->lineEditInsertDebug->hide();
+ ui->debugView->hide();
+ ui->pushButtonSaveBugReport->hide();
+ ui->pushButtonCrash->hide();
+ this->setMaximumSize(QSize(500,128));
+ /*timeToSetText.setInterval(250);
+ timeToSetText.setSingleShot(true);
+ connect(&timeToSetText,QTimer::timeout,this,&DebugEngine::showDebugText);*/
+ ui->pushButtonClose->hide();
+ #endif // ULTRACOPIER_DEBUG
+ //connect the about Qt
+ connect(ui->pushButtonAboutQt,&QPushButton::toggled,&QApplication::aboutQt);
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ setWindowTitle(tr("About Supercopier"));
+ #else
+ setWindowTitle(tr("About Ultracopier"));
+ #endif
}
/// \brief Destruct the object
HelpDialog::~HelpDialog()
{
- delete ui;
+ delete ui;
}
/// \brief To re-translate the ui
void HelpDialog::changeEvent(QEvent *e)
{
- QDialog::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- ui->retranslateUi(this);
- reloadTextValue();
- break;
- default:
- break;
- }
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ui->retranslateUi(this);
+ reloadTextValue();
+ break;
+ default:
+ break;
+ }
}
/// \brief To reload the text value
void HelpDialog::reloadTextValue()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QString text=ui->label_ultracopier->text();
- #ifdef ULTRACOPIER_VERSION_ULTIMATE
- text=text.replace("%1",QString("Ultimate %1").arg(ULTRACOPIER_VERSION));
- #else
- text=text.replace("%1",ULTRACOPIER_VERSION);
- #endif
- ui->label_ultracopier->setText(text);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ QString text=ui->label_ultracopier->text();
+ #ifdef ULTRACOPIER_VERSION_ULTIMATE
+ text=text.replace(QStringLiteral("%1"),QStringLiteral("Ultimate %1").arg(ULTRACOPIER_VERSION));
+ #else
+ text=text.replace(QStringLiteral("%1"),ULTRACOPIER_VERSION);
+ #endif
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ text=text.replace(QStringLiteral("Ultracopier"),QStringLiteral("Supercopier"),Qt::CaseInsensitive);
+ #endif
+ ui->label_ultracopier->setText(text);
- text=ui->label_description->text();
- #ifdef ULTRACOPIER_VERSION_PORTABLE
- #ifdef ULTRACOPIER_VERSION_PORTABLEAPPS
- text=text.replace("%1",tr("For http://portableapps.com/"));
- #else
- text=text.replace("%1",tr("Portable version"));
- #endif
- #else
- text=text.replace("%1",tr("Normal version"));
- #endif
- ui->label_description->setText(text);
+ text=ui->label_description->text();
+ #ifdef ULTRACOPIER_VERSION_PORTABLE
+ #ifdef ULTRACOPIER_VERSION_PORTABLEAPPS
+ text=text.replace(QStringLiteral("%1"),tr("For http://portableapps.com/"));
+ #else
+ #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ text=text.replace(QStringLiteral("%1"),tr("Portable and all in one version"));
+ #else
+ text=text.replace(QStringLiteral("%1"),tr("Portable version"));
+ #endif
+ #endif
+ #else
+ #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ text=text.replace(QStringLiteral("%1"),tr("All in one version"));
+ #else
+ text=text.replace(QStringLiteral("%1"),tr("Normal version"));
+ #endif
+ #endif
+ ui->label_description->setText(text);
- text=ui->label_site->text();
- //: This site need be the official site of ultracopier, into the right languages, english if not exists
- text=text.replace("%1",tr("http://ultracopier.first-world.info/"));
- ui->label_site->setText(text);
+ text=ui->label_site->text();
+ //: This site need be the official site of ultracopier, into the right languages, english if not exists
+ text=text.replace(QStringLiteral("%1"),getWebSite());
+ ui->label_site->setText(text);
- text=ui->label_platform->text();
- text=text.replace("%1",ULTRACOPIER_PLATFORM_NAME);
- ui->label_platform->setText(text);
+ text=ui->label_platform->text();
+ text=text.replace(QStringLiteral("%1"),ULTRACOPIER_PLATFORM_NAME);
+ ui->label_platform->setText(text);
}
-#ifdef ULTRACOPIER_DEBUG
-/// \brief Add debug text
-void HelpDialog::addDebugText()
+QString HelpDialog::getWebSite()
{
- QList<DebugEngine::ItemOfDebug> returnedList=debug_engine_instance->getItemList();
- QTreeWidgetItem * item;
- QBrush brush;
- QFont functionFont;
- functionFont.setItalic(true);
- functionFont.setUnderline(true);
- QFont timeFont;
- timeFont.setBold(true);
- QFont noteFont;
- noteFont.setBold(true);
- noteFont.setPointSize(15);
- int index=0;
- int loop_size=returnedList.size();
- while(index<loop_size)
- {
- item=new QTreeWidgetItem(ui->debugView,QStringList()
- << returnedList.at(index).time
- << returnedList.at(index).file
- << returnedList.at(index).function
- << returnedList.at(index).location
- << returnedList.at(index).text);
- switch(returnedList.at(index).level)
- {
- case DebugLevel_custom_Information:
- brush=QBrush(QColor(94,165,255));
- break;
- case DebugLevel_custom_Critical:
- brush=QBrush(QColor(255,0,0));
- break;
- case DebugLevel_custom_Warning:
- brush=QBrush(QColor(255,178,0));
- break;
- case DebugLevel_custom_Notice:
- brush=QBrush(QColor(128,128,128));
- break;
- case DebugLevel_custom_UserNote:
- brush=QBrush(QColor(0,0,0));
- break;
- }
- item->setForeground(0,brush);
- item->setFont(0,timeFont);
- item->setForeground(1,brush);
- item->setForeground(2,brush);
- item->setFont(2,functionFont);
- item->setForeground(3,brush);
- item->setForeground(4,brush);
- if(returnedList.at(index).level==DebugLevel_custom_UserNote)
- {
- item->setFont(0,noteFont);
- item->setFont(1,noteFont);
- item->setFont(2,noteFont);
- item->setFont(3,noteFont);
- item->setFont(4,noteFont);
- }
- ui->debugView->insertTopLevelItem(ui->debugView->columnCount(),item);
- index++;
- }
- if(loop_size==ULTRACOPIER_DEBUG_MAX_GUI_LINE)
- {
- item=new QTreeWidgetItem(ui->debugView,QStringList() << "...");
- ui->debugView->insertTopLevelItem(ui->debugView->columnCount(),item);
- }
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ return tr("http://ultracopier.first-world.info/")+QStringLiteral("supercopier.html");
+ #else
+ return tr("http://ultracopier.first-world.info/");
+ #endif
}
-void HelpDialog::on_lineEditInsertDebug_returnPressed()
+
+QString HelpDialog::getUpdateUrl()
{
- DebugEngine::addDebugNote(ui->lineEditInsertDebug->text());
- ui->lineEditInsertDebug->clear();
- ui->debugView->scrollToBottom();
+ #if defined(ULTRACOPIER_VERSION_ULTIMATE)
+ return tr("http://ultracopier.first-world.info/shop.html");
+ #else
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ return tr("http://ultracopier.first-world.info/")+QStringLiteral("supercopier.html");
+ #else
+ return tr("http://ultracopier.first-world.info/download.html");
+ #endif
+ #endif
}
+#ifdef ULTRACOPIER_DEBUG
+void HelpDialog::on_lineEditInsertDebug_returnPressed()
+{
+ DebugEngine::addDebugNote(ui->lineEditInsertDebug->text());
+ ui->lineEditInsertDebug->clear();
+ ui->debugView->scrollToBottom();
+}
#endif // ULTRACOPIER_DEBUG
void HelpDialog::on_pushButtonAboutQt_clicked()
{
- QApplication::aboutQt();
+ QApplication::aboutQt();
}
void HelpDialog::on_pushButtonCrash_clicked()
{
- int a=0;
- int *b=NULL;
- *b=3/a;
+ int a=0;
+ int *b=NULL;
+ *b=3/a;
}
diff --git a/HelpDialog.h b/HelpDialog.h
index 43cbc7f..2a2fd32 100644
--- a/HelpDialog.h
+++ b/HelpDialog.h
@@ -1,8 +1,6 @@
/** \file HelpDialog.h
\brief Define the help dialog
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef DIALOG_H
@@ -16,35 +14,35 @@
#include "ui_HelpDialog.h"
#include "Environment.h"
-#include "GlobalClass.h"
namespace Ui {
- class HelpDialog;
+ class HelpDialog;
}
/** \brief Help dialog, and some user oriented repport/debug function */
-class HelpDialog : public QDialog, public GlobalClass {
- Q_OBJECT
- public:
- /// \brief Construct the object
- HelpDialog();
- /// \brief Destruct the object
- ~HelpDialog();
- protected:
- /// \brief To re-translate the ui
- void changeEvent(QEvent *e);
- private:
- Ui::HelpDialog *ui;
- /// \brief To reload the text value
- void reloadTextValue();
- private slots:
- #ifdef ULTRACOPIER_DEBUG
- /// \brief Add debug text
- void addDebugText();
- void on_lineEditInsertDebug_returnPressed();
- #endif // ULTRACOPIER_DEBUG
- void on_pushButtonAboutQt_clicked();
- void on_pushButtonCrash_clicked();
+class HelpDialog : public QDialog {
+ Q_OBJECT
+ public:
+ /// \brief Construct the object
+ HelpDialog();
+ /// \brief Destruct the object
+ ~HelpDialog();
+ static QString getWebSite();
+ static QString getUpdateUrl();
+ protected:
+ /// \brief To re-translate the ui
+ void changeEvent(QEvent *e);
+ private:
+ Ui::HelpDialog *ui;
+ /// \brief To reload the text value
+ void reloadTextValue();
+ private slots:
+ #ifdef ULTRACOPIER_DEBUG
+ /// \brief Add debug text
+ void on_lineEditInsertDebug_returnPressed();
+ #endif // ULTRACOPIER_DEBUG
+ void on_pushButtonAboutQt_clicked();
+ void on_pushButtonCrash_clicked();
};
#endif // DIALOG_H
diff --git a/HelpDialog.ui b/HelpDialog.ui
index 1826120..5d42f18 100644
--- a/HelpDialog.ui
+++ b/HelpDialog.ui
@@ -16,11 +16,8 @@
<height>16777214</height>
</size>
</property>
- <property name="windowTitle">
- <string>About ultracopier</string>
- </property>
<property name="windowIcon">
- <iconset resource="resources/resources.qrc">
+ <iconset resource="resources/ultracopier-resources.qrc">
<normaloff>:/ultracopier-16x16.png</normaloff>:/ultracopier-16x16.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -44,7 +41,7 @@
</size>
</property>
<property name="pixmap">
- <pixmap resource="resources/resources.qrc">:/ultracopier-128x128.png</pixmap>
+ <pixmap resource="resources/ultracopier-resources.qrc">:/ultracopier-128x128.png</pixmap>
</property>
</widget>
</item>
@@ -67,7 +64,7 @@
<item>
<widget class="QLabel" name="label_description">
<property name="text">
- <string extracomment="%1 will be replaced by a variable content (normal, debug, ...)">Based on Qt. It provide advanced copier with more advanced feature. It's under GPL3.
+ <string extracomment="%1 will be replaced by a variable content (normal, debug, ...)">Based on Qt. Advanced utility to copy files under GPL3 license.
This version is compiled as version: %1.</string>
</property>
</widget>
@@ -107,38 +104,13 @@ This version is compiled as version: %1.</string>
</widget>
</item>
<item>
- <widget class="QTreeWidget" name="debugView">
+ <widget class="QTreeView" name="debugView">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
- <column>
- <property name="text">
- <string notr="true">Time</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string notr="true">File</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string notr="true">Function</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string notr="true">Location</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string notr="true">Text</string>
- </property>
- </column>
</widget>
</item>
<item>
@@ -196,7 +168,7 @@ This version is compiled as version: %1.</string>
<tabstop>pushButtonClose</tabstop>
</tabstops>
<resources>
- <include location="resources/resources.qrc"/>
+ <include location="resources/ultracopier-resources.qrc"/>
</resources>
<connections>
<connection>
diff --git a/InternetUpdater.cpp b/InternetUpdater.cpp
new file mode 100644
index 0000000..de23424
--- /dev/null
+++ b/InternetUpdater.cpp
@@ -0,0 +1,112 @@
+#include "InternetUpdater.h"
+#include "EventDispatcher.h"
+#include "OptionEngine.h"
+
+#ifdef ULTRACOPIER_INTERNET_SUPPORT
+
+#include <QNetworkRequest>
+#include <QUrl>
+
+#include "PluginsManager.h"
+
+InternetUpdater::InternetUpdater(QObject *parent) :
+ QObject(parent)
+{
+ connect(&newUpdateTimer,&QTimer::timeout,this,&InternetUpdater::downloadFile);
+ connect(&firstUpdateTimer,&QTimer::timeout,this,&InternetUpdater::downloadFile);
+ newUpdateTimer.start(1000*3600);
+ firstUpdateTimer.setSingleShot(true);
+ firstUpdateTimer.start(1000*60);
+}
+
+void InternetUpdater::downloadFile()
+{
+ if(!OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("checkTheUpdate")).toBool())
+ return;
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ QString name=QStringLiteral("Supercopier");
+ #else
+ QString name=QStringLiteral("Ultracopier");
+ #endif
+ QString ultracopierVersion;
+ #ifdef ULTRACOPIER_VERSION_ULTIMATE
+ ultracopierVersion=QStringLiteral("%1 Ultimate/%2").arg(name).arg(ULTRACOPIER_VERSION);
+ #else
+ ultracopierVersion=QStringLiteral("%1/%2").arg(name).arg(ULTRACOPIER_VERSION);
+ #endif
+ #ifdef ULTRACOPIER_VERSION_PORTABLE
+ #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ ultracopierVersion+=QStringLiteral(" portable/all-in-one");
+ #else
+ ultracopierVersion+=QStringLiteral(" portable");
+ #endif
+ #else
+ #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ ultracopierVersion+=QStringLiteral(" all-in-one");
+ #endif
+ #endif
+ #ifdef ULTRACOPIER_CGMINER
+ ultracopierVersion+=QStringLiteral(" miner");
+ #endif
+ #if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
+ ultracopierVersion+=QStringLiteral(" (OS: %1)").arg(EventDispatcher::GetOSDisplayString());
+ #endif
+ ultracopierVersion+=QStringLiteral(" ")+ULTRACOPIER_PLATFORM_CODE;
+ QNetworkRequest networkRequest(QStringLiteral(ULTRACOPIER_UPDATER_URL));
+ networkRequest.setHeader(QNetworkRequest::UserAgentHeader,ultracopierVersion);
+ networkRequest.setRawHeader("Connection", "Close");
+ reply = qnam.get(networkRequest);
+ connect(reply, &QNetworkReply::finished, this, &InternetUpdater::httpFinished);
+}
+
+void InternetUpdater::httpFinished()
+{
+ QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
+ if (!reply->isFinished())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("get the new update failed: not finished"));
+ reply->deleteLater();
+ return;
+ }
+ else if (reply->error())
+ {
+ newUpdateTimer.stop();
+ newUpdateTimer.start(1000*3600*24);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("get the new update failed: %1").arg(reply->errorString()));
+ reply->deleteLater();
+ return;
+ } else if (!redirectionTarget.isNull()) {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("redirection denied to: %1").arg(redirectionTarget.toUrl().toString()));
+ reply->deleteLater();
+ return;
+ }
+ QString newVersion=QString::fromUtf8(reply->readAll());
+ if(newVersion.isEmpty())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("version string is empty"));
+ reply->deleteLater();
+ return;
+ }
+ newVersion.remove("\n");
+ if(!newVersion.contains(QRegularExpression(QLatin1Literal("^[0-9]+(\\.[0-9]+)+$"))))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("version string don't match: %1").arg(newVersion));
+ reply->deleteLater();
+ return;
+ }
+ if(newVersion==ULTRACOPIER_VERSION)
+ {
+ reply->deleteLater();
+ return;
+ }
+ if(PluginsManager::compareVersion(newVersion,QStringLiteral("<="),ULTRACOPIER_VERSION))
+ {
+ reply->deleteLater();
+ return;
+ }
+ newUpdateTimer.stop();
+ emit newUpdate(newVersion);
+ reply->deleteLater();
+}
+
+#endif
diff --git a/InternetUpdater.h b/InternetUpdater.h
new file mode 100644
index 0000000..e13a5a2
--- /dev/null
+++ b/InternetUpdater.h
@@ -0,0 +1,33 @@
+#ifndef INTERNETUPDATER_H
+#define INTERNETUPDATER_H
+
+#include "Environment.h"
+
+#include <QObject>
+#include <QString>
+#include <QTimer>
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
+
+#ifdef ULTRACOPIER_INTERNET_SUPPORT
+
+class InternetUpdater : public QObject
+{
+ Q_OBJECT
+public:
+ explicit InternetUpdater(QObject *parent = 0);
+signals:
+ void newUpdate(const QString &version) const;
+private:
+ QTimer newUpdateTimer;
+ QTimer firstUpdateTimer;
+ QNetworkAccessManager qnam;
+ QNetworkReply *reply;
+private slots:
+ void downloadFile();
+ void httpFinished();
+};
+
+#endif
+
+#endif // INTERNETUPDATER_H
diff --git a/LanguagesManager.cpp b/LanguagesManager.cpp
index f178c90..5393e28 100755..100644
--- a/LanguagesManager.cpp
+++ b/LanguagesManager.cpp
@@ -1,285 +1,285 @@
/** \file LanguagesManager.cpp
\brief Define the class to manage and load the languages
\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
+\licence GPL3, see the file COPYING */
#include <QDir>
#include <QLibraryInfo>
#include "LanguagesManager.h"
+#include "FacilityEngine.h"
/// \brief Create the manager and load the defaults variables
LanguagesManager::LanguagesManager()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- //load the overall instance
- resources=ResourcesManager::getInstance();
- options=OptionEngine::getInstance();
- plugins=PluginsManager::getInstance();
- //load the rest
- QStringList resourcesPaths=resources->getReadPath();
- int index=0;
- while(index<resourcesPaths.size())
- {
- QString composedTempPath=resourcesPaths.at(index)+"Languages"+QDir::separator();
- QDir LanguagesConfiguration(composedTempPath);
- if(LanguagesConfiguration.exists())
- languagePath<<composedTempPath;
- index++;
- }
- //load the plugins
- plugins->lockPluginListEdition();
- qRegisterMetaType<PluginsAvailable>("PluginsAvailable");
- connect(this,SIGNAL(previouslyPluginAdded(PluginsAvailable)), this,SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins,SIGNAL(onePluginAdded(PluginsAvailable)), this, SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins,SIGNAL(onePluginWillBeRemoved(PluginsAvailable)), this, SLOT(onePluginWillBeRemoved(PluginsAvailable)),Qt::DirectConnection);
- connect(plugins,SIGNAL(pluginListingIsfinish()), this, SLOT(allPluginIsLoaded()),Qt::QueuedConnection);
- QList<PluginsAvailable> list=plugins->getPluginsByCategory(PluginType_Languages);
- foreach(PluginsAvailable currentPlugin,list)
- emit previouslyPluginAdded(currentPlugin);
- plugins->unlockPluginListEdition();
- //load the GUI option
- QList<QPair<QString, QVariant> > KeysList;
- KeysList.append(qMakePair(QString("Language"),QVariant("en")));
- KeysList.append(qMakePair(QString("Language_autodetect"),QVariant(true)));
- options->addOptionGroup("Language",KeysList);
-// connect(this, SIGNAL(newLanguageLoaded(QString)), plugins,SLOT(refreshPluginList(QString)));
-// connect(this, SIGNAL(newLanguageLoaded(QString)), this,SLOT(retranslateTheUI()));
- connect(options,SIGNAL(newOptionValue(QString,QString,QVariant)), this, SLOT(newOptionValue(QString)),Qt::QueuedConnection);
- connect(this, SIGNAL(newLanguageLoaded(QString)), plugins,SIGNAL(newLanguageLoaded()),Qt::QueuedConnection);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ //load the rest
+ QStringList resourcesPaths=ResourcesManager::resourcesManager->getReadPath();
+ int index=0;
+ while(index<resourcesPaths.size())
+ {
+ QString composedTempPath=resourcesPaths.at(index)+QStringLiteral("Languages")+QDir::separator();
+ QDir LanguagesConfiguration(composedTempPath);
+ if(LanguagesConfiguration.exists())
+ languagePath<<composedTempPath;
+ index++;
+ }
+ //load the plugins
+ PluginsManager::pluginsManager->lockPluginListEdition();
+ connect(this,&LanguagesManager::previouslyPluginAdded, this, &LanguagesManager::onePluginAdded,Qt::QueuedConnection);
+ connect(PluginsManager::pluginsManager,&PluginsManager::onePluginAdded,this, &LanguagesManager::onePluginAdded,Qt::QueuedConnection);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved, this, &LanguagesManager::onePluginWillBeRemoved,Qt::DirectConnection);
+ #endif
+ connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish, this, &LanguagesManager::allPluginIsLoaded,Qt::QueuedConnection);
+ QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_Languages);
+ foreach(PluginsAvailable currentPlugin,list)
+ emit previouslyPluginAdded(currentPlugin);
+ PluginsManager::pluginsManager->unlockPluginListEdition();
+ //load the GUI option
+ QList<QPair<QString, QVariant> > KeysList;
+ KeysList.append(qMakePair(QStringLiteral("Language"),QVariant("en")));
+ KeysList.append(qMakePair(QStringLiteral("Language_force"),QVariant(false)));
+ OptionEngine::optionEngine->addOptionGroup("Language",KeysList);
+// connect(this, &LanguagesManager::newLanguageLoaded, plugins,&PluginsManager::refreshPluginList);
+// connect(this, &LanguagesManager::newLanguageLoaded, this,&LanguagesManager::retranslateTheUI);
+ connect(OptionEngine::optionEngine,&OptionEngine::newOptionValue, this, &LanguagesManager::newOptionValue,Qt::QueuedConnection);
+ connect(this, &LanguagesManager::newLanguageLoaded, PluginsManager::pluginsManager,&PluginsManager::newLanguageLoaded,Qt::QueuedConnection);
}
/// \brief Destroy the language manager
LanguagesManager::~LanguagesManager()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- PluginsManager::destroyInstanceAtTheLastCall();
- OptionEngine::destroyInstanceAtTheLastCall();
- ResourcesManager::destroyInstanceAtTheLastCall();
}
/// \brief load the language selected, return the main short code like en, fr, ..
-QString LanguagesManager::getTheRightLanguage()
+QString LanguagesManager::getTheRightLanguage() const
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- if(LanguagesAvailableList.size()==0)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"empty combobox list, failing back to english");
- return "en";
- }
- else
- {
- if(options->getOptionValue("Language","Language_autodetect").toBool())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"language auto-detection, QLocale::system().name(): "+QLocale::system().name()+", QLocale::languageToString(QLocale::system().language()): "+QLocale::languageToString(QLocale::system().language()));
- QString tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language()));
- if(tempLanguage!="")
- return tempLanguage;
- else
- {
- tempLanguage=getMainShortName(QLocale::system().name());
- if(tempLanguage!="")
- return tempLanguage;
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Autodetection of the language failed, QLocale::languageToString(QLocale::system().language()): "+QLocale::languageToString(QLocale::system().language())+", QLocale::system().name(): "+QLocale::system().name()+", failing back to english");
- return options->getOptionValue("Language","Language").toString();
- }
- }
- }
- else
- return options->getOptionValue("Language","Language").toString();
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ if(LanguagesAvailableList.size()==0)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"empty combobox list, failing back to english");
+ return "en";
+ }
+ else
+ {
+ if(!OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language_force")).toBool())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("language auto-detection, QLocale::system().name(): ")+QLocale::system().name()+QStringLiteral(", QLocale::languageToString(QLocale::system().language()): ")+QLocale::languageToString(QLocale::system().language()));
+ QString tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language()));
+ if(tempLanguage!=QStringLiteral(""))
+ return tempLanguage;
+ else
+ {
+ tempLanguage=getMainShortName(QLocale::system().name());
+ if(tempLanguage!=QStringLiteral(""))
+ return tempLanguage;
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Autodetection of the language failed, QLocale::languageToString(QLocale::system().language()): ")+QLocale::languageToString(QLocale::system().language())+QStringLiteral(", QLocale::system().name(): ")+QLocale::system().name()+", failing back to english");
+ return OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language")).toString();
+ }
+ }
+ }
+ else
+ return OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language")).toString();
+ }
}
/* \brief To set the current language
\param newLanguage Should be short name code found into informations.xml of language file */
void LanguagesManager::setCurrentLanguage(const QString &newLanguage)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: "+newLanguage);
- //protection for re-set the same language
- if(currentLanguage==newLanguage)
- return;
- //store the language
- plugins->setLanguage(newLanguage);
- //unload the old language
- if(currentLanguage!="en")
- {
- int indexTranslator=0;
- while(indexTranslator<installedTranslator.size())
- {
- QCoreApplication::removeTranslator(installedTranslator[indexTranslator]);
- delete installedTranslator[indexTranslator];
- indexTranslator++;
- }
- installedTranslator.clear();
- }
- if(newLanguage=="en")
- {
- currentLanguage="en";
- emit newLanguageLoaded(currentLanguage);
- }
- else
- {
- int index=0;
- while(index<LanguagesAvailableList.size())
- {
- if(LanguagesAvailableList.at(index).mainShortName==newLanguage)
- {
- //load the new language
- if(newLanguage!="en")
- {
- QTranslator *temp;
- QStringList fileToLoad;
- //load the language main
- fileToLoad<<LanguagesAvailableList.at(index).path+"translation.qm";
- //load the language plugin
- QList<PluginsAvailable> listLoadedPlugins=plugins->getPlugins();
- int indexPluginIndex=0;
- while(indexPluginIndex<listLoadedPlugins.size())
- {
- if(listLoadedPlugins.at(indexPluginIndex).category!=PluginType_Languages)
- {
- QString tempPath=listLoadedPlugins.at(indexPluginIndex).path+"Languages"+QDir::separator()+LanguagesAvailableList.at(index).mainShortName+QDir::separator()+"translation.qm";
- if(QFile::exists(tempPath))
- fileToLoad<<tempPath;
- }
- indexPluginIndex++;
- }
- int indexTranslationFile=0;
- while(indexTranslationFile<fileToLoad.size())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Translation to load: "+fileToLoad.at(indexTranslationFile));
- temp=new QTranslator();
- if(!temp->load(fileToLoad.at(indexTranslationFile)) || temp->isEmpty())
- {
- delete temp;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to load the translation file: "+fileToLoad.at(indexTranslationFile));
- }
- else
- {
- QCoreApplication::installTranslator(temp);
- installedTranslator<<temp;
- }
- indexTranslationFile++;
- }
- temp=new QTranslator();
- if(temp->load(QString("qt_")+newLanguage, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) && !temp->isEmpty())
- {
- QCoreApplication::installTranslator(temp);
- installedTranslator<<temp;
- }
- else
- {
- if(!temp->load(LanguagesAvailableList.at(index).path+"qt.qm") || temp->isEmpty())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to load the translation file: qt.qm, into: "+LanguagesAvailableList.at(index).path);
- delete temp;
- }
- else
- {
- QCoreApplication::installTranslator(temp);
- installedTranslator<<temp;
- }
- }
- }
- currentLanguage=newLanguage;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"emit newLanguageLoaded()");
- emit newLanguageLoaded(currentLanguage);
- return;
- }
- index++;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to found language: "+newLanguage+", LanguagesAvailableList.size(): "+QString::number(LanguagesAvailableList.size()));
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+newLanguage);
+ //protection for re-set the same language
+ if(currentLanguage==newLanguage)
+ return;
+ //store the language
+ PluginsManager::pluginsManager->setLanguage(newLanguage);
+ //unload the old language
+ if(currentLanguage!=QStringLiteral("en"))
+ {
+ int indexTranslator=0;
+ while(indexTranslator<installedTranslator.size())
+ {
+ QCoreApplication::removeTranslator(installedTranslator.at(indexTranslator));
+ delete installedTranslator.at(indexTranslator);
+ indexTranslator++;
+ }
+ installedTranslator.clear();
+ }
+ int index=0;
+ while(index<LanguagesAvailableList.size())
+ {
+ if(LanguagesAvailableList.at(index).mainShortName==newLanguage)
+ {
+ //load the new language
+ if(newLanguage!=QStringLiteral("en"))
+ {
+ QTranslator *temp;
+ QStringList fileToLoad;
+ //load the language main
+ if(newLanguage==QStringLiteral("en"))
+ fileToLoad<<QStringLiteral(":/Languages/en/translation.qm");
+ else
+ fileToLoad<<LanguagesAvailableList.at(index).path+QStringLiteral("translation.qm");
+ //load the language plugin
+ QList<PluginsAvailable> listLoadedPlugins=PluginsManager::pluginsManager->getPlugins();
+ int indexPluginIndex=0;
+ while(indexPluginIndex<listLoadedPlugins.size())
+ {
+ if(listLoadedPlugins.at(indexPluginIndex).category!=PluginType_Languages)
+ {
+ QString tempPath=listLoadedPlugins.at(indexPluginIndex).path+QStringLiteral("Languages")+QDir::separator()+LanguagesAvailableList.at(index).mainShortName+QDir::separator()+QStringLiteral("translation.qm");
+ if(QFile::exists(tempPath))
+ fileToLoad<<tempPath;
+ }
+ indexPluginIndex++;
+ }
+ int indexTranslationFile=0;
+ while(indexTranslationFile<fileToLoad.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Translation to load: ")+fileToLoad.at(indexTranslationFile));
+ temp=new QTranslator();
+ if(!temp->load(fileToLoad.at(indexTranslationFile)) || temp->isEmpty())
+ {
+ delete temp;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to load the translation file: ")+fileToLoad.at(indexTranslationFile));
+ }
+ else
+ {
+ QCoreApplication::installTranslator(temp);
+ installedTranslator<<temp;
+ }
+ indexTranslationFile++;
+ }
+ temp=new QTranslator();
+ if(temp->load(QString("qt_")+newLanguage, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) && !temp->isEmpty())
+ {
+ QCoreApplication::installTranslator(temp);
+ installedTranslator<<temp;
+ }
+ else
+ {
+ if(!temp->load(LanguagesAvailableList.at(index).path+QStringLiteral("qt.qm")) || temp->isEmpty())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the translation file: qt.qm, into: "+LanguagesAvailableList.at(index).path);
+ delete temp;
+ }
+ else
+ {
+ QCoreApplication::installTranslator(temp);
+ installedTranslator<<temp;
+ }
+ }
+ }
+ currentLanguage=newLanguage;
+ FacilityEngine::facilityEngine.retranslate();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("emit newLanguageLoaded()"));
+ emit newLanguageLoaded(currentLanguage);
+ return;
+ }
+ index++;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to found language: "+newLanguage+", LanguagesAvailableList.size(): "+QString::number(LanguagesAvailableList.size()));
}
/// \brief check if short name is found into language
-QString LanguagesManager::getMainShortName(const QString &shortName)
+QString LanguagesManager::getMainShortName(const QString &shortName) const
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=0;
- while(index<LanguagesAvailableList.size())
- {
- if(LanguagesAvailableList.at(index).shortName.contains(shortName) || LanguagesAvailableList.at(index).fullName.contains(shortName))
- return LanguagesAvailableList.at(index).mainShortName;
- index++;
- }
- return "";
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ while(index<LanguagesAvailableList.size())
+ {
+ if(LanguagesAvailableList.at(index).shortName.contains(shortName) || LanguagesAvailableList.at(index).fullName.contains(shortName))
+ return LanguagesAvailableList.at(index).mainShortName;
+ index++;
+ }
+ return "";
}
/// \brief load the language in languagePath
void LanguagesManager::allPluginIsLoaded()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- setCurrentLanguage(getTheRightLanguage());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ setCurrentLanguage(getTheRightLanguage());
}
-/*QString LanguagesManager::getMainShortName()
+const QString LanguagesManager::autodetectedLanguage() const
{
- return currentLanguage;
-}*/
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("language auto-detection, QLocale::system().name(): ")+QLocale::system().name()+QStringLiteral(", QLocale::languageToString(QLocale::system().language()): ")+QLocale::languageToString(QLocale::system().language()));
+ QString tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language()));
+ if(tempLanguage!=QStringLiteral(""))
+ return tempLanguage;
+ else
+ {
+ tempLanguage=getMainShortName(QLocale::system().name());
+ if(tempLanguage!=QStringLiteral(""))
+ return tempLanguage;
+ }
+ return "";
+}
void LanguagesManager::onePluginAdded(const PluginsAvailable &plugin)
{
- if(plugin.category!=PluginType_Languages)
- return;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QDomElement child = plugin.categorySpecific.firstChildElement("fullName");
- LanguagesAvailable temp;
- if(!child.isNull() && child.isElement())
- temp.fullName=child.text();
- child = plugin.categorySpecific.firstChildElement("shortName");
- while(!child.isNull())
- {
- if(child.isElement())
- {
- if(child.hasAttribute("mainCode") && child.attribute("mainCode")=="true")
- temp.mainShortName=child.text();
- temp.shortName<<child.text();
- }
- child = child.nextSiblingElement("shortName");
- }
- temp.path=plugin.path;
- if(temp.fullName.isEmpty())
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"fullName empty for: "+plugin.path);
- else if(temp.path.isEmpty())
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"path empty for: "+plugin.path);
- else if(temp.mainShortName.isEmpty())
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"mainShortName empty for: "+plugin.path);
- else if(temp.shortName.size()<=0)
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"temp.shortName.size()<=0 for: "+plugin.path);
- else if(!QFile::exists(temp.path+"flag.png"))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"flag file not found for: "+plugin.path);
- else if(!QFile::exists(temp.path+"translation.qm") && temp.mainShortName!="en")
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"translation not found for: "+plugin.path);
- else
- LanguagesAvailableList<<temp;
- if(plugins->allPluginHaveBeenLoaded())
- setCurrentLanguage(getTheRightLanguage());
+ if(plugin.category!=PluginType_Languages)
+ return;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ QDomElement child = plugin.categorySpecific.firstChildElement(QStringLiteral("fullName"));
+ LanguagesAvailable temp;
+ if(!child.isNull() && child.isElement())
+ temp.fullName=child.text();
+ child = plugin.categorySpecific.firstChildElement(QStringLiteral("shortName"));
+ while(!child.isNull())
+ {
+ if(child.isElement())
+ {
+ if(child.hasAttribute("mainCode") && child.attribute(QStringLiteral("mainCode"))==QStringLiteral("true"))
+ temp.mainShortName=child.text();
+ temp.shortName<<child.text();
+ }
+ child = child.nextSiblingElement(QStringLiteral("shortName"));
+ }
+ temp.path=plugin.path;
+ if(temp.fullName.isEmpty())
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"fullName empty for: "+plugin.path);
+ else if(temp.path.isEmpty())
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"path empty for: "+plugin.path);
+ else if(temp.mainShortName.isEmpty())
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"mainShortName empty for: "+plugin.path);
+ else if(temp.shortName.size()<=0)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"temp.shortName.size()<=0 for: "+plugin.path);
+ else if(!QFile::exists(temp.path+QStringLiteral("flag.png")))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"flag file not found for: "+plugin.path);
+ else if(!QFile::exists(temp.path+QStringLiteral("translation.qm")) && temp.mainShortName!=QStringLiteral("en"))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"translation not found for: "+plugin.path);
+ else
+ LanguagesAvailableList<<temp;
+ if(PluginsManager::pluginsManager->allPluginHaveBeenLoaded())
+ setCurrentLanguage(getTheRightLanguage());
}
+#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
void LanguagesManager::onePluginWillBeRemoved(const PluginsAvailable &plugin)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- int index=0;
- while(index<LanguagesAvailableList.size())
- {
- if(plugin.path==LanguagesAvailableList.at(index).path)
- {
- return;
- }
- index++;
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ int index=0;
+ while(index<LanguagesAvailableList.size())
+ {
+ if(plugin.path==LanguagesAvailableList.at(index).path)
+ {
+ return;
+ }
+ index++;
+ }
}
+#endif
void LanguagesManager::newOptionValue(const QString &group)
{
- if(group=="Language")
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"group: "+group);
- setCurrentLanguage(getTheRightLanguage());
- }
+ if(group==QStringLiteral("Language"))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("group: ")+group);
+ setCurrentLanguage(getTheRightLanguage());
+ }
}
diff --git a/LanguagesManager.h b/LanguagesManager.h
index a517cac..8ec893d 100644
--- a/LanguagesManager.h
+++ b/LanguagesManager.h
@@ -1,9 +1,7 @@
/** \file LanguagesManager.h
\brief Define the class to manage and load the languages
\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
+\licence GPL3, see the file COPYING */
#ifndef LANGUAGES_MANAGER_H
#define LANGUAGES_MANAGER_H
@@ -19,7 +17,6 @@
#include <QDir>
#include "Environment.h"
-#include "Singleton.h"
#include "OptionEngine.h"
#include "ResourcesManager.h"
#include "PluginsManager.h"
@@ -27,56 +24,54 @@
/** \brief Define the class to manage and load the resources linked with the themes
This class provide a core load and manage the resources */
-class LanguagesManager : public QObject, public Singleton<LanguagesManager>
+class LanguagesManager : public QObject
{
- Q_OBJECT
- friend class Singleton<LanguagesManager>;
- //public:
- // QString getMainShortName();
- private:
- /// \brief Create the manager and load the defaults variables
- LanguagesManager();
- /// \brief Destroy the language manager
- ~LanguagesManager();
- //for the options
- OptionEngine *options;
- /** \brief To set the current language
- \param newLanguage Should be short name code found into informations.xml of language file */
- void setCurrentLanguage(const QString &newLanguage);
- /// \brief Structure of language
- struct LanguagesAvailable
- {
- QString path;
- QString fullName;
- QString mainShortName;
- QStringList shortName;
- };
- /// \brief To store the language path
- QStringList languagePath;
- /// \brief To store the language detected
- QList<LanguagesAvailable> LanguagesAvailableList;
- /// \brief check if short name is found into language
- QString getMainShortName(const QString &shortName);
- /// \brief Store the object of resources manager
- ResourcesManager *resources;
- /// \brief Store the object of plugin manager
- PluginsManager *plugins;
- /// \brief list of installed translator
- QList<QTranslator *> installedTranslator;
- QString currentLanguage;
- /// \brief load the language selected
- QString getTheRightLanguage();
- private slots:
- /// \brief load the language in languagePath
- void allPluginIsLoaded();
- //plugin management
- void onePluginAdded(const PluginsAvailable &plugin);
- void onePluginWillBeRemoved(const PluginsAvailable &plugin);
- void newOptionValue(const QString &group);
- signals:
- //send the language is loaded or the new language is loaded
- void newLanguageLoaded(const QString &mainShortName);
- void previouslyPluginAdded(PluginsAvailable);
+ Q_OBJECT
+ //public:
+ // QString getMainShortName();
+ public:
+ const QString autodetectedLanguage() const;
+ static LanguagesManager *languagesManager;
+ /// \brief Create the manager and load the defaults variables
+ LanguagesManager();
+ /// \brief Destroy the language manager
+ ~LanguagesManager();
+ private:
+ /** \brief To set the current language
+ \param newLanguage Should be short name code found into informations.xml of language file */
+ void setCurrentLanguage(const QString &newLanguage);
+ /// \brief Structure of language
+ struct LanguagesAvailable
+ {
+ QString path;
+ QString fullName;
+ QString mainShortName;
+ QStringList shortName;
+ };
+ /// \brief To store the language path
+ QStringList languagePath;
+ /// \brief To store the language detected
+ QList<LanguagesAvailable> LanguagesAvailableList;
+ /// \brief check if short name is found into language
+ QString getMainShortName(const QString &shortName) const;
+ /// \brief list of installed translator
+ QList<QTranslator *> installedTranslator;
+ QString currentLanguage;
+ /// \brief load the language selected
+ QString getTheRightLanguage() const;
+ private slots:
+ /// \brief load the language in languagePath
+ void allPluginIsLoaded();
+ //plugin management
+ void onePluginAdded(const PluginsAvailable &plugin);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ void onePluginWillBeRemoved(const PluginsAvailable &plugin);
+ #endif
+ void newOptionValue(const QString &group);
+ signals:
+ //send the language is loaded or the new language is loaded
+ void newLanguageLoaded(const QString &mainShortName) const;
+ void previouslyPluginAdded(PluginsAvailable) const;
};
#endif // LANGUAGES_MANAGER_H
diff --git a/LocalListener.cpp b/LocalListener.cpp
index 3fcee9f..21dc09b 100644
--- a/LocalListener.cpp
+++ b/LocalListener.cpp
@@ -1,278 +1,301 @@
/** \file LocalListener.cpp
\brief The have local server, to have unique instance, and send arguments to the current running instance
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "LocalListener.h"
+#include "PluginsManager.h"
+
+#include <QLocalSocket>
+#include <QDir>
LocalListener::LocalListener(QObject *parent) :
QObject(parent)
{
- //for detect the timeout on QLocalSocket
- TimeOutQLocalSocket.setInterval(500);
- TimeOutQLocalSocket.setSingleShot(true);
- connect(&TimeOutQLocalSocket, SIGNAL(timeout()), this, SLOT(timeoutDectected()));
- connect(plugins,SIGNAL(pluginListingIsfinish()),this,SLOT(allPluginIsloaded()),Qt::QueuedConnection);
+ //for detect the timeout on QLocalSocket
+ TimeOutQLocalSocket.setInterval(500);
+ TimeOutQLocalSocket.setSingleShot(true);
+ connect(&TimeOutQLocalSocket, &QTimer::timeout, this, &LocalListener::timeoutDectected);
+ connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish,this, &LocalListener::allPluginIsloaded,Qt::QueuedConnection);
}
LocalListener::~LocalListener()
{
- if(localServer.isListening())
- {
- localServer.close();
- if(!QLocalServer::removeServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Unable to remove the listening server"));
- }
+ if(localServer.isListening())
+ {
+ localServer.close();
+ if(!QLocalServer::removeServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to remove the listening server"));
+ }
}
bool LocalListener::tryConnect()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QStringList ultracopierArguments=QCoreApplication::arguments();
- //remove excutable path because is useless (unsafe to use)
- ultracopierArguments.removeFirst();
- //add the current path to file full path resolution if needed
- ultracopierArguments.insert(0,QFSFileEngine::currentPath());
- QLocalSocket localSocket;
- localSocket.connectToServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME),QIODevice::WriteOnly);
- if(localSocket.waitForConnected(1000))
- {
- if(!localSocket.isValid())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"localSocket is not valid!");
- return false;
- }
- emit cli(ultracopierArguments,false,true);
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"connection succes, number arguments given: "+QString::number(ultracopierArguments.size()));
- #ifdef ULTRACOPIER_DEBUG
- for (int i = 0; i < ultracopierArguments.size(); ++i) {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"argument["+QString::number(i)+"]: "+ultracopierArguments.at(i));
- }
- #endif // ULTRACOPIER_DEBUG
- //cut string list and send it as block of 32KB
- QByteArray block;
- QDataStream out(&block, QIODevice::WriteOnly);
- //for total size
- out << int(0);
- //send the arguments
- out << ultracopierArguments;
- //write the size content
- out.device()->seek(0);
- out << block.size();
- do
- {
- QByteArray blockToSend;
- int byteWriten;
- blockToSend=block.left(32*1024);//32KB
- block.remove(0,blockToSend.size());
- byteWriten = localSocket.write(blockToSend);
- #ifdef ULTRACOPIER_DEBUG
- if(!localSocket.isValid())
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"localSocket is not valid!");
- if(localSocket.errorString()!="Unknown error" && localSocket.errorString()!="")
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"localSocket->errorString(): "+localSocket.errorString());
- if(blockToSend.size()!=byteWriten)
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"blockToSend("+QString::number(blockToSend.size())+")!=byteWriten("+QString::number(byteWriten)+")");
- #endif // ULTRACOPIER_DEBUG
- if(localSocket.waitForBytesWritten(200))
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Block send correctly");
- }
- else
- {
- QMessageBox::critical(NULL,"Alert","No arguments send because timeout detected!");
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"Block not send correctly");
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"blockToSend: "+QString(blockToSend.toHex()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"byteWriten: "+QString::number(byteWriten)+", size sending: "+QString::number(blockToSend.size()));
- }
- while(block.size());
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"disconnect the socket");
- localSocket.disconnectFromServer();
- return true;
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"connection failed, continu...");
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";"));
- return false;
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ QStringList ultracopierArguments=QCoreApplication::arguments();
+ //remove excutable path because is useless (unsafe to use)
+ ultracopierArguments.removeFirst();
+ //add the current path to file full path resolution if needed
+ ultracopierArguments.insert(0,QDir::currentPath());
+ QLocalSocket localSocket;
+ localSocket.connectToServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME),QIODevice::WriteOnly);
+ if(localSocket.waitForConnected(1000))
+ {
+ if(!localSocket.isValid())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket is not valid!");
+ return false;
+ }
+ emit cli(ultracopierArguments,false,true);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"connection succes, number arguments given: "+QString::number(ultracopierArguments.size()));
+ #ifdef ULTRACOPIER_DEBUG
+ for (int i = 0; i < ultracopierArguments.size(); ++i) {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"argument["+QString::number(i)+"]: "+ultracopierArguments.at(i));
+ }
+ #endif // ULTRACOPIER_DEBUG
+ //cut string list and send it as block of 32KB
+ QByteArray block;
+ QDataStream out(&block, QIODevice::WriteOnly);
+ //for total size
+ out << int(0);
+ //send the arguments
+ out << ultracopierArguments;
+ //write the size content
+ out.device()->seek(0);
+ out << block.size();
+ do
+ {
+ QByteArray blockToSend;
+ int byteWriten;
+ blockToSend=block.left(32*1024);//32KB
+ block.remove(0,blockToSend.size());
+ byteWriten = localSocket.write(blockToSend);
+ #ifdef ULTRACOPIER_DEBUG
+ if(!localSocket.isValid())
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket is not valid!");
+ if(localSocket.errorString()!="Unknown error" && localSocket.errorString()!="")
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket->errorString(): "+localSocket.errorString());
+ if(blockToSend.size()!=byteWriten)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"blockToSend("+QString::number(blockToSend.size())+")!=byteWriten("+QString::number(byteWriten)+")");
+ #endif // ULTRACOPIER_DEBUG
+ if(localSocket.waitForBytesWritten(200))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Block send correctly");
+ }
+ else
+ {
+ QMessageBox::critical(NULL,"Alert","No arguments send because timeout detected!");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Block not send correctly");
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"blockToSend: "+QString(blockToSend.toHex()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"byteWriten: "+QString::number(byteWriten)+", size sending: "+QString::number(blockToSend.size()));
+ }
+ while(block.size());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"disconnect the socket");
+ localSocket.disconnectFromServer();
+ return true;
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("connection failed, continu..."));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultracopierArguments: ")+ultracopierArguments.join(";"));
+ return false;
+ }
}
/// the listen server
void LocalListener::listenServer()
{
- if(!QLocalServer::removeServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Unable to remove the listening server"));
- if(!localServer.listen(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))
- {
- QMessageBox::critical(NULL,"Alert",QString("Ultracopier have not able to lock unique instance: %1").arg(localServer.errorString()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Ultracopier have not able to lock unique instance: %1").arg(localServer.errorString()));
- }
- else
- connect(&localServer, SIGNAL(newConnection()), this, SLOT(newConnexion()));
+ if(!QLocalServer::removeServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to remove the listening server"));
+ #ifndef Q_OS_MAC
+ localServer.setSocketOptions(QLocalServer::UserAccessOption);
+ #endif
+ if(!localServer.listen(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))
+ {
+ #ifndef Q_OS_MAC
+ //QMessageBox::critical(NULL,"Alert",QStringLiteral("Ultracopier have not able to lock unique instance: %1").arg(localServer.errorString()));
+ #endif
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Ultracopier have not able to lock unique instance: %1, error code: %2").arg(localServer.errorString()).arg((qint32)localServer.serverError()));
+ }
+ else
+ connect(&localServer, &QLocalServer::newConnection, this, &LocalListener::newConnexion);
}
//the time is done
void LocalListener::timeoutDectected()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"start");
- while(clientList.size()>0)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"clientList.first().size: "+QString::number(clientList.first().size));
- clientList.removeFirst();
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Timeout while recomposing data from connected clients");
- QMessageBox::warning(NULL,tr("Warning"),tr("Timeout while recomposing data from connected clients"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("start"));
+ if(clientList.size()>0)
+ {
+ int index=0;
+ bool haveData=false;
+ while(index<clientList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"clientList.first().size: "+QString::number(clientList.first().size));
+ if(!clientList.at(index).data.isEmpty() || clientList.at(index).haveData)
+ {
+ haveData=true;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Timeout while recomposing data from connected clients: %1").arg(QString(clientList.at(index).data.toHex())));
+ clientList.removeFirst();
+ }
+ else
+ index++;
+ }
+ if(haveData)
+ QMessageBox::warning(NULL,tr("Warning"),tr("Timeout while recomposing data from connected clients"));
+ }
}
/// \brief Data is incomming
void LocalListener::dataIncomming()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"start");
- // 1 : we get packets from client
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start"));
+ // 1 : we get packets from client
- //Which client send the message (Search of the QLocalSocket of client)
- QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender());
- if (socket == 0) // If not found
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"bad socket");
- return;
- }
+ //Which client send the message (Search of the QLocalSocket of client)
+ QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender());
+ if (socket == 0) // If not found
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("bad socket"));
+ return;
+ }
- int index=-1;
- for (int i=0;i<clientList.size(); ++i) {
- if(clientList.at(i).socket==socket)
- index=i;
- }
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"socket->bytesAvailable() "+QString::number(socket->bytesAvailable()));
- if(index!=-1)
- {
- if(!clientList.at(index).haveData)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"tempComposed index found, but no have data, create new entry");
- // If all is ok we get the message
- QDataStream in(socket);
- in.setVersion(QDataStream::Qt_4_4);
+ int index=-1;
+ for (int i=0;i<clientList.size(); ++i) {
+ if(clientList.at(i).socket==socket)
+ index=i;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("socket->bytesAvailable() ")+QString::number(socket->bytesAvailable()));
+ if(index!=-1)
+ {
+ if(!clientList.at(index).haveData)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"tempComposed index found, but no have data, create new entry");
+ // If all is ok we get the message
+ QDataStream in(socket);
+ in.setVersion(QDataStream::Qt_4_4);
- if (socket->bytesAvailable() < (int)sizeof(quint32)*2) // We have not receveive all the message, ignore because first int is cuted!
- {
- /*socket->readAll();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"wrong size for set the message size");*/
- return;
- }
- in >> clientList[index].size; // Store the size of the message
- clientList[index].size-=sizeof(int);
+ if (socket->bytesAvailable() < (int)sizeof(quint32)*2) // We have not receveive all the message, ignore because first int is cuted!
+ {
+ /*socket->readAll();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"wrong size for set the message size");*/
+ return;
+ }
+ in >> clientList[index].size; // Store the size of the message
+ clientList[index].size-=sizeof(int);
- // Check if all the message size is the same as the size given
- if(socket->bytesAvailable() < clientList.at(index).size) // If not all get then stop it
- {
- clientList[index].haveData=true;
- clientList[index].data.append(socket->readAll());
- TimeOutQLocalSocket.start();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Need wait to recomposite: "+QString::number(clientList.at(index).data.size())+", targeted: "+QString::number(clientList.at(index).size));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"tempComposed.data: "+QString(clientList.at(index).data.toHex()));
- }
- else if(socket->bytesAvailable() == clientList.at(index).size) //if the size match
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"socket->bytesAvailable(): "+QString::number(socket->bytesAvailable())+", for total of: "+QString::number(socket->bytesAvailable()+sizeof(quint32)));
- QStringList ultracopierArguments;
- in >> ultracopierArguments;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";"));
- emit cli(ultracopierArguments,true,false);
- clientList[index].data.clear();
- clientList[index].haveData=false;
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"socket->bytesAvailable(): "+QString::number(socket->bytesAvailable())+" > clientList.at(index).size!: "+QString::number(clientList.at(index).size));
- }
- else
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Query recomposed with this size: "+QString::number(clientList.at(index).data.size()));
- clientList[index].data.append(socket->readAll());
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Query recomposed with this size: "+QString::number(clientList.at(index).data.size()));
- if(clientList.at(index).data.size()==clientList.at(index).size)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"QByteArray reconstruction finished");
- QDataStream in(clientList.at(index).data);
- QStringList ultracopierArguments;
- in >> ultracopierArguments;
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";"));
- emit cli(ultracopierArguments,true,false);
- clientList[index].data.clear();
- clientList[index].haveData=false;
- }
- else
- {
- TimeOutQLocalSocket.start();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Need wait to recomposite: "+QString::number(clientList.at(index).data.size())+", targeted: "+QString::number(clientList.at(index).size));
- return;
- }
- }
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Socket not found???");
+ // Check if all the message size is the same as the size given
+ if(socket->bytesAvailable() < clientList.at(index).size) // If not all get then stop it
+ {
+ clientList[index].haveData=true;
+ clientList[index].data.append(socket->readAll());
+ TimeOutQLocalSocket.start();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Need wait to recomposite: "+QString::number(clientList.at(index).data.size())+", targeted: "+QString::number(clientList.at(index).size));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"tempComposed.data: "+QString(clientList.at(index).data.toHex()));
+ }
+ else if(socket->bytesAvailable() == clientList.at(index).size) //if the size match
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"socket->bytesAvailable(): "+QString::number(socket->bytesAvailable())+", for total of: "+QString::number(socket->bytesAvailable()+sizeof(quint32)));
+ QStringList ultracopierArguments;
+ in >> ultracopierArguments;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";"));
+ emit cli(ultracopierArguments,true,false);
+ clientList[index].data.clear();
+ clientList[index].haveData=false;
+ TimeOutQLocalSocket.stop();
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("socket->bytesAvailable(): ")+QString::number(socket->bytesAvailable())+QStringLiteral(" > clientList.at(index).size!: ")+QString::number(clientList.at(index).size));
+ }
+ else
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Query recomposed with this size: ")+QString::number(clientList.at(index).data.size()));
+ clientList[index].data.append(socket->readAll());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Query recomposed with this size: ")+QString::number(clientList.at(index).data.size()));
+ if(clientList.at(index).data.size()==clientList.at(index).size)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("QByteArray reconstruction finished"));
+ QDataStream in(clientList.at(index).data);
+ QStringList ultracopierArguments;
+ in >> ultracopierArguments;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultracopierArguments: ")+ultracopierArguments.join(";"));
+ emit cli(ultracopierArguments,true,false);
+ clientList[index].data.clear();
+ clientList[index].haveData=false;
+ TimeOutQLocalSocket.stop();
+ }
+ else
+ {
+ TimeOutQLocalSocket.start();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Need wait to recomposite: ")+QString::number(clientList.at(index).data.size())+QStringLiteral(", targeted: ")+QString::number(clientList.at(index).size));
+ return;
+ }
+ }
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Socket not found???"));
}
/// \brief Deconnexion client
/// \todo Remove the data in wait linker with this socket
void LocalListener::deconnectClient()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
- // Wich client leave
- QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender());
- if (socket == 0) // If not found
- return;
- for (int i = 0; i < clientList.size(); ++i) {
- if(clientList.at(i).socket==socket)
- clientList.removeAt(i);
- }
- socket->deleteLater();
+ // Wich client leave
+ QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender());
+ if (socket == 0) // If not found
+ return;
+ for (int i = 0; i < clientList.size(); ++i) {
+ if(clientList.at(i).socket==socket)
+ clientList.removeAt(i);
+ }
+ socket->deleteLater();
}
/// LocalListener New connexion
void LocalListener::newConnexion()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"start");
- composedData newClient;
- newClient.socket = localServer.nextPendingConnection();
- #ifdef ULTRACOPIER_DEBUG
- connect(newClient.socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(error(QLocalSocket::LocalSocketError)));
- #endif
- connect(newClient.socket, SIGNAL(readyRead()), this, SLOT(dataIncomming()));
- connect(newClient.socket, SIGNAL(disconnected()), this, SLOT(deconnectClient()));
- newClient.size=-1;
- newClient.haveData=false;
- clientList << newClient;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start"));
+ ComposedData newClient;
+ newClient.socket = localServer.nextPendingConnection();
+ #ifdef ULTRACOPIER_DEBUG
+ connect(newClient.socket, static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(&QLocalSocket::error), this, &LocalListener::error);
+ //connect(newClient.socket, &QLocalSocket::error, this, &LocalListener::error);
+ //connect(newClient.socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(error(QLocalSocket::LocalSocketError)));
+ #endif
+ connect(newClient.socket, &QLocalSocket::readyRead, this, &LocalListener::dataIncomming);
+ connect(newClient.socket, &QLocalSocket::disconnected, this, &LocalListener::deconnectClient);
+ newClient.size=-1;
+ newClient.haveData=false;
+ clientList << newClient;
}
#ifdef ULTRACOPIER_DEBUG
/** \brief If error occured at socket
\param theErrorDefine The error define */
-void LocalListener::error(QLocalSocket::LocalSocketError theErrorDefine)
+void LocalListener::error(const QLocalSocket::LocalSocketError &theErrorDefine)
{
- if(theErrorDefine!=QLocalSocket::PeerClosedError)
- {
- QLocalSocket *client=qobject_cast<QLocalSocket *>(QObject::sender());
- if(client!=NULL)
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Value:"+QString::number(theErrorDefine)+", Error message: "+client->errorString());
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Value:"+QString::number(theErrorDefine));
- }
+ if(theErrorDefine!=QLocalSocket::PeerClosedError)
+ {
+ QLocalSocket *client=qobject_cast<QLocalSocket *>(QObject::sender());
+ if(client!=NULL)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Value:"+QString::number(theErrorDefine)+", Error message: "+client->errorString());
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Value:"+QString::number(theErrorDefine));
+ }
}
#endif
/// \can now parse the cli
void LocalListener::allPluginIsloaded()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QStringList ultracopierArguments=QCoreApplication::arguments();
- //remove excutable path because is useless (unsafe to use)
- ultracopierArguments.removeFirst();
- //add the current path to file full path resolution if needed
- ultracopierArguments.insert(0,QFSFileEngine::currentPath());
- emit cli(ultracopierArguments,false,false);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ QStringList ultracopierArguments=QCoreApplication::arguments();
+ //remove excutable path because is useless (unsafe to use)
+ ultracopierArguments.removeFirst();
+ //add the current path to file full path resolution if needed
+ ultracopierArguments.insert(0,QDir::currentPath());
+ emit cli(ultracopierArguments,false,false);
}
diff --git a/LocalListener.h b/LocalListener.h
index a0fbee1..cc23dde 100644
--- a/LocalListener.h
+++ b/LocalListener.h
@@ -1,8 +1,6 @@
/** \file LocalListener.h
\brief The have local server, to have unique instance, and send arguments to the current running instance
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef LOCALLISTENER_H
@@ -14,55 +12,54 @@
#include <QStringList>
#include <QString>
#include <QCoreApplication>
-#include <QFSFileEngine>
#include <QMessageBox>
#include <QTimer>
#include <QList>
+#include <QByteArray>
#include "Environment.h"
#include "ExtraSocket.h"
-#include "GlobalClass.h"
/** \brief To have unique instance, and pass arguments to the existing instance if needed */
-class LocalListener : public QObject, public GlobalClass
+class LocalListener : public QObject
{
Q_OBJECT
public:
- explicit LocalListener(QObject *parent = 0);
- ~LocalListener();
+ explicit LocalListener(QObject *parent = 0);
+ ~LocalListener();
public slots:
- /// try connect to existing server
- bool tryConnect();
- /// the listen server
- void listenServer();
+ /// try connect to existing server
+ bool tryConnect();
+ /// the listen server
+ void listenServer();
private:
- QLocalServer localServer;
- QTimer TimeOutQLocalSocket;
- typedef struct {
- QLocalSocket * socket;
- QByteArray data;
- int size;
- bool haveData;
- } composedData;
- QList<composedData> clientList;
+ QLocalServer localServer;
+ QTimer TimeOutQLocalSocket;/// \todo by client
+ typedef struct {
+ QLocalSocket * socket;
+ QByteArray data;
+ int size;
+ bool haveData;
+ } ComposedData;
+ QList<ComposedData> clientList;
private slots:
- //the time is done
- void timeoutDectected();
- /// \brief Data is incomming
- void dataIncomming();
- /// \brief Deconnexion client
- void deconnectClient();
- /// LocalListener New connexion
- void newConnexion();
- #ifdef ULTRACOPIER_DEBUG
- /** \brief If error occured at socket
- \param theErrorDefine The error define */
- void error(QLocalSocket::LocalSocketError theErrorDefine);
- #endif
- /// \can now parse the cli
- void allPluginIsloaded();
+ //the time is done
+ void timeoutDectected();
+ /// \brief Data is incomming
+ void dataIncomming();
+ /// \brief Deconnexion client
+ void deconnectClient();
+ /// LocalListener New connexion
+ void newConnexion();
+ #ifdef ULTRACOPIER_DEBUG
+ /** \brief If error occured at socket
+ \param theErrorDefine The error define */
+ void error(const QLocalSocket::LocalSocketError &theErrorDefine);
+ #endif
+ /// \can now parse the cli
+ void allPluginIsloaded();
signals:
- void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck);
+ void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck) const;
};
#endif // LOCALLISTENER_H
diff --git a/LocalPluginOptions.cpp b/LocalPluginOptions.cpp
index b81e880..5e25bf0 100644
--- a/LocalPluginOptions.cpp
+++ b/LocalPluginOptions.cpp
@@ -1,63 +1,59 @@
/** \file LocalPluginOptions.cpp
\brief To bind the options of the plugin, into unique group options
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "LocalPluginOptions.h"
LocalPluginOptions::LocalPluginOptions(const QString &group)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start(\""+group+"\",[...])");
- groupOptionAdded=false;
- this->group=group;
- options=OptionEngine::getInstance();
- connect(options,SIGNAL(resetOptions()),this,SIGNAL(resetOptions()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start(\"")+group+QStringLiteral("\",[...])"));
+ groupOptionAdded=false;
+ this->group=group;
+ connect(OptionEngine::optionEngine,&OptionEngine::resetOptions,this,&OptionInterface::resetOptions);
}
LocalPluginOptions::~LocalPluginOptions()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start(\""+group+"\",[...])");
- if(groupOptionAdded)
- options->removeOptionGroup(group);
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"option not used");
- OptionEngine::destroyInstanceAtTheLastCall();
+ if(groupOptionAdded)
+ {
+ if(OptionEngine::optionEngine!=NULL)
+ OptionEngine::optionEngine->removeOptionGroup(group);
+ }
}
/// \brief To add option group to options
bool LocalPluginOptions::addOptionGroup(const QList<QPair<QString, QVariant> > &KeysList)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start(\""+group+"\",[...])");
- if(groupOptionAdded)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"Group already added!");
- return false;
- }
- else
- {
- groupOptionAdded=true;
- return options->addOptionGroup(group,KeysList);
- }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start(\"")+group+QStringLiteral("\",[...])"));
+ if(groupOptionAdded)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("Group already added!"));
+ return false;
+ }
+ else
+ {
+ groupOptionAdded=true;
+ return OptionEngine::optionEngine->addOptionGroup(group,KeysList);
+ }
}
/// \brief To get option value
-QVariant LocalPluginOptions::getOptionValue(const QString &variableName)
+QVariant LocalPluginOptions::getOptionValue(const QString &variableName) const
{
- return options->getOptionValue(group,variableName);
+ return OptionEngine::optionEngine->getOptionValue(group,variableName);
}
/// \brief To set option value
void LocalPluginOptions::setOptionValue(const QString &variableName,const QVariant &value)
{
- options->setOptionValue(group,variableName,value);
+ OptionEngine::optionEngine->setOptionValue(group,variableName,value);
}
/*-> disabled because the value will not externaly changed, then useless notification
void LocalPluginOptions::newOptionValue(QString group,QString variable,QVariant value)
{
- if(group==this->group)
- emit newOptionValue(variable,value);
+ if(group==this->group)
+ emit newOptionValue(variable,value);
}*/
diff --git a/LocalPluginOptions.h b/LocalPluginOptions.h
index f5ee463..623f418 100644
--- a/LocalPluginOptions.h
+++ b/LocalPluginOptions.h
@@ -1,8 +1,6 @@
/** \file LocalPluginOptions.h
\brief To bind the options of the plugin, into unique group options
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef LOCALPLUGINOPTIONS_H
@@ -21,25 +19,24 @@
*/
class LocalPluginOptions : public OptionInterface
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit LocalPluginOptions(const QString &group);
- ~LocalPluginOptions();
- /// \brief To add option group to options
- bool addOptionGroup(const QList<QPair<QString, QVariant> > &KeysList);
- /*/// \brief To remove option group to options, removed to the load plugin
- bool removeOptionGroup();*/
- /// \brief To get option value
- QVariant getOptionValue(const QString &variableName);
- /// \brief To set option value
- void setOptionValue(const QString &variableName,const QVariant &value);
+ explicit LocalPluginOptions(const QString &group);
+ ~LocalPluginOptions();
+ /// \brief To add option group to options
+ bool addOptionGroup(const QList<QPair<QString, QVariant> > &KeysList);
+ /*/// \brief To remove option group to options, removed to the load plugin
+ bool removeOptionGroup();*/
+ /// \brief To get option value
+ QVariant getOptionValue(const QString &variableName) const;
+ /// \brief To set option value
+ void setOptionValue(const QString &variableName,const QVariant &value);
protected:
- //for the options
- OptionEngine *options;
- QString group;
- bool groupOptionAdded;
+ //for the options
+ QString group;
+ bool groupOptionAdded;
/*public slots:-> disabled because the value will not externaly changed, then useless notification
- void newOptionValue(QString group,QString variable,QVariant value);*/
+ void newOptionValue(QString group,QString variable,QVariant value);*/
};
#endif // LOCALPLUGINOPTIONS_H
diff --git a/LogThread.cpp b/LogThread.cpp
index 9064b07..4af7550 100644
--- a/LogThread.cpp
+++ b/LogThread.cpp
@@ -1,222 +1,291 @@
/** \file LogThread.cpp
\brief The thread to do the log but not block the main thread
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "LogThread.h"
+#include "ResourcesManager.h"
+#include "OptionEngine.h"
+#ifdef Q_OS_WIN32
+ #ifndef NOMINMAX
+ #define NOMINMAX
+ #endif
+ #include <windows.h>
+#endif
#include <QMessageBox>
+QString LogThread::text_header_copy=QStringLiteral("[Copy] ");
+QString LogThread::text_header_move=QStringLiteral("[Move] ");
+QString LogThread::text_header_skip=QStringLiteral("[Skip] ");
+QString LogThread::text_header_stop=QStringLiteral("[Stop] ");
+QString LogThread::text_header_error=QStringLiteral("[Error] ");
+QString LogThread::text_header_MkPath=QStringLiteral("[MkPath] ");
+QString LogThread::text_header_RmPath=QStringLiteral("[RmPath] ");
+
+QString LogThread::text_var_source=QStringLiteral("%source%");
+QString LogThread::text_var_size=QStringLiteral("%size%");
+QString LogThread::text_var_destination=QStringLiteral("%destination%");
+QString LogThread::text_var_path=QStringLiteral("%path%");
+QString LogThread::text_var_error=QStringLiteral("%error%");
+QString LogThread::text_var_mtime=QStringLiteral("%mtime%");
+QString LogThread::text_var_time=QStringLiteral("%time%");
+QString LogThread::text_var_timestring=QStringLiteral("%dd.MM.yyyy h:m:s%");
+#ifdef Q_OS_WIN32
+QString LogThread::text_var_computer=QStringLiteral("%computer%");
+QString LogThread::text_var_user=QStringLiteral("%user%");
+#endif
+QString LogThread::text_var_operation=QStringLiteral("%operation%");
+QString LogThread::text_var_rmPath=QStringLiteral("%rmPath%");
+QString LogThread::text_var_mkPath=QStringLiteral("%mkPath%");
+
LogThread::LogThread()
{
- sync=false;
-
- //load the GUI option
- QString defaultLogFile="";
- if(resources->getWritablePath()!="")
- defaultLogFile=resources->getWritablePath()+"ultracopier-files.log";
- QList<QPair<QString, QVariant> > KeysList;
- KeysList.append(qMakePair(QString("enabled"),QVariant(false)));
- KeysList.append(qMakePair(QString("file"),QVariant(defaultLogFile)));
- KeysList.append(qMakePair(QString("transfer"),QVariant(true)));
- KeysList.append(qMakePair(QString("error"),QVariant(true)));
- KeysList.append(qMakePair(QString("folder"),QVariant(true)));
- KeysList.append(qMakePair(QString("sync"),QVariant(true)));
- KeysList.append(qMakePair(QString("transfer_format"),QVariant("[%time%] %source% (%size%) %destination%")));
- KeysList.append(qMakePair(QString("error_format"),QVariant("[%time%] %path%, %error%")));
- KeysList.append(qMakePair(QString("folder_format"),QVariant("[%time%] %operation% %path%")));
- options->addOptionGroup("Write_log",KeysList);
-
- connect(options,SIGNAL(newOptionValue(QString,QString,QVariant)), this, SLOT(newOptionValue(QString,QString,QVariant)));
-
- enabled=false;
-
- moveToThread(this);
- start(QThread::IdlePriority);
-
- connect(this, SIGNAL(newData(QString)), this,SLOT(realDataWrite(QString)),Qt::QueuedConnection);
-
- newOptionValue("Write_log", "transfer", options->getOptionValue("Write_log","transfer"));
- newOptionValue("Write_log", "error", options->getOptionValue("Write_log","error"));
- newOptionValue("Write_log", "folder", options->getOptionValue("Write_log","folder"));
- newOptionValue("Write_log", "sync", options->getOptionValue("Write_log","sync"));
- newOptionValue("Write_log", "transfer_format", options->getOptionValue("Write_log","transfer_format"));
- newOptionValue("Write_log", "error_format", options->getOptionValue("Write_log","error_format"));
- newOptionValue("Write_log", "folder_format", options->getOptionValue("Write_log","folder_format"));
- newOptionValue("Write_log", "sync", options->getOptionValue("Write_log","sync"));
- newOptionValue("Write_log", "enabled", options->getOptionValue("Write_log","enabled"));
+ sync=false;
+
+ connect(OptionEngine::optionEngine,&OptionEngine::newOptionValue, this, &LogThread::newOptionValue);
+
+ enabled=false;
+
+ moveToThread(this);
+ start(QThread::IdlePriority);
+
+ connect(this, &LogThread::newData, this,&LogThread::realDataWrite,Qt::QueuedConnection);
+
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("transfer"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("error"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("error")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("folder"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("sync"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("sync")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("transfer_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer_format")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("error_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("error_format")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("folder_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder_format")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("sync"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("sync")));
+ newOptionValue(QStringLiteral("Write_log"), QStringLiteral("enabled"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("enabled")));
+ #ifdef Q_OS_WIN32
+ DWORD size=0;
+ WCHAR * computerNameW=new WCHAR[size];
+ if(GetComputerNameW(computerNameW,&size))
+ computer=QString::fromWCharArray(computerNameW,size-1);
+ else
+ computer=QStringLiteral("Unknown computer");
+ delete computerNameW;
+
+ WCHAR * userNameW=new WCHAR[size];
+ if(GetUserNameW(userNameW,&size))
+ user=QString::fromWCharArray(userNameW,size-1);
+ else
+ user=QStringLiteral("Unknown user");
+ delete userNameW;
+ #endif
+
+ #ifdef Q_OS_WIN32
+ lineReturn=QStringLiteral("\r\n");
+ #else
+ lineReturn=QStringLiteral("\n");
+ #endif
}
LogThread::~LogThread()
{
- closeLogs();
- quit();
- wait();
+ closeLogs();
+ quit();
+ wait();
+}
+
+bool LogThread::logTransfer() const
+{
+ return enabled && log_enable_transfer;
}
void LogThread::openLogs()
{
- if(options->getOptionValue("Write_log","enabled").toBool()==false)
- return;
- if(log.isOpen())
- {
- QMessageBox::critical(NULL,tr("Error"),tr("Log file already open, error: %1").arg(log.errorString()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("log file already open, error: %1").arg(log.errorString()));
- return;
- }
- log.setFileName(options->getOptionValue("Write_log","file").toString());
- if(sync)
- {
- if(!log.open(QIODevice::WriteOnly|QIODevice::Unbuffered))
- {
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to open file to keep the log file, error: %1").arg(log.errorString()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Unable to open file to keep the log file, error: %1").arg(log.errorString()));
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"opened log: "+options->getOptionValue("Write_log","file").toString());
- }
- else
- {
- if(!log.open(QIODevice::WriteOnly))
- {
- QMessageBox::critical(NULL,tr("Error"),tr("Unable to open file to keep the log file, error: %1").arg(log.errorString()));
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Unable to open file to keep the log file, error: %1").arg(log.errorString()));
- }
- else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"opened log: "+options->getOptionValue("Write_log","file").toString());
- }
+ if(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("enabled")).toBool()==false)
+ return;
+ if(log.isOpen())
+ {
+ QMessageBox::critical(NULL,tr("Error"),tr("Log file already open, error: %1").arg(log.errorString()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("log file already open, error: %1").arg(log.errorString()));
+ return;
+ }
+ log.setFileName(OptionEngine::optionEngine->getOptionValue("Write_log","file").toString());
+ if(sync)
+ {
+ if(!log.open(QIODevice::WriteOnly|QIODevice::Unbuffered))
+ {
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to open the log file, error: %1").arg(log.errorString()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to open the log file, error: %1").arg(log.errorString()));
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"opened log: "+OptionEngine::optionEngine->getOptionValue("Write_log","file").toString());
+ }
+ else
+ {
+ if(!log.open(QIODevice::WriteOnly))
+ {
+ QMessageBox::critical(NULL,tr("Error"),tr("Unable to open the log file, error: %1").arg(log.errorString()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to open the log file, error: %1").arg(log.errorString()));
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("opened log: ")+OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("file")).toString());
+ }
}
void LogThread::closeLogs()
{
- if(log.isOpen() && data.size()>0)
- log.write(data.toUtf8());
- log.close();
+ if(log.isOpen() && data.size()>0)
+ log.write(data.toUtf8());
+ log.close();
}
-void LogThread::newTransferStart(const ItemOfCopyList &item)
+void LogThread::newTransferStart(const Ultracopier::ItemOfCopyList &item)
{
- if(!log_enable_transfer)
- return;
- QString text=transfer_format+"\n";
- text=replaceBaseVar(text);
- //Variable is %source%, %size%, %destination%
- text=text.replace("%source%",item.sourceFullPath);
- text=text.replace("%size%",QString::number(item.size));
- text=text.replace("%destination%",item.destinationFullPath);
- emit newData(text);
+ if(!logTransfer())
+ return;
+ QString text;
+ if(item.mode==Ultracopier::Copy)
+ text=LogThread::text_header_copy+transfer_format+lineReturn;
+ else
+ text=LogThread::text_header_move+transfer_format+lineReturn;
+ text=replaceBaseVar(text);
+ //Variable is %source%, %size%, %destination%
+ text=text.replace(LogThread::text_var_source,item.sourceFullPath);
+ text=text.replace(LogThread::text_var_size,QString::number(item.size));
+ text=text.replace(LogThread::text_var_destination,item.destinationFullPath);
+ emit newData(text);
}
-void LogThread::newTransferStop(const quint64 &id)
+/** method called when new transfer is started */
+void LogThread::transferSkip(const Ultracopier::ItemOfCopyList &item)
{
- if(!log_enable_transfer)
- return;
- Q_UNUSED(id)
+ if(!logTransfer())
+ return;
+ QString text=LogThread::text_header_skip+transfer_format+lineReturn;
+ text=replaceBaseVar(text);
+ //Variable is %source%, %size%, %destination%
+ text=text.replace(LogThread::text_var_source,item.sourceFullPath);
+ text=text.replace(LogThread::text_var_size,QString::number(item.size));
+ text=text.replace(LogThread::text_var_destination,item.destinationFullPath);
+ emit newData(text);
+}
+
+void LogThread::newTransferStop(const Ultracopier::ItemOfCopyList &item)
+{
+ if(!logTransfer())
+ return;
+ QString text=LogThread::text_header_stop+transfer_format+lineReturn;
+ text=replaceBaseVar(text);
+ //Variable is %source%, %size%, %destination%
+ text=text.replace(LogThread::text_var_source,item.sourceFullPath);
+ text=text.replace(LogThread::text_var_size,QString::number(item.size));
+ text=text.replace(LogThread::text_var_destination,item.destinationFullPath);
+ emit newData(text);
}
void LogThread::error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error)
{
- if(!log_enable_error)
- return;
- QString text=error_format+"\n";
- text=replaceBaseVar(text);
- //Variable is %path%, %size%, %mtime%, %error%
- text=text.replace("%path%",path);
- text=text.replace("%size%",QString::number(size));
- text=text.replace("%mtime%",mtime.toString(Qt::ISODate));
- text=text.replace("%error%",error);
- emit newData(text);
+ if(!log_enable_error)
+ return;
+ QString text=LogThread::text_header_error+error_format+lineReturn;
+ text=replaceBaseVar(text);
+ //Variable is %path%, %size%, %mtime%, %error%
+ text=text.replace(LogThread::text_var_path,path);
+ text=text.replace(LogThread::text_var_size,QString::number(size));
+ text=text.replace(LogThread::text_var_mtime,mtime.toString(Qt::ISODate));
+ text=text.replace(LogThread::text_var_error,error);
+ emit newData(text);
}
void LogThread::run()
{
- exec();
+ exec();
}
void LogThread::realDataWrite(const QString &text)
{
- #ifdef ULTRACOPIER_DEBUG
- if(!log.isOpen())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"transfer log not open");
- return;
- }
- #endif // ULTRACOPIER_DEBUG
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- if(log.write(text.toUtf8())==-1)
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("unable to write into transfer log: %1").arg(log.errorString()));
- return;
- }
- if(sync)
- log.flush();
+ #ifdef ULTRACOPIER_DEBUG
+ if(!log.isOpen())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"transfer log not open");
+ return;
+ }
+ #endif // ULTRACOPIER_DEBUG
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ if(log.write(text.toUtf8())==-1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("unable to write into transfer log: %1").arg(log.errorString()));
+ return;
+ }
+ if(sync)
+ log.flush();
}
void LogThread::newOptionValue(const QString &group,const QString &name,const QVariant &value)
{
- if(group!="Write_log")
- return;
-
- if(name=="transfer_format")
- transfer_format=value.toString();
- else if(name=="error_format")
- error_format=value.toString();
- else if(name=="folder_format")
- folder_format=value.toString();
- else if(name=="sync")
- {
- sync=value.toBool();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("sync flag is set on: %1").arg(sync));
- if(sync)
- {
- if(log.isOpen())
- log.flush();
- }
- }
- else if(name=="transfer")
- log_enable_transfer=options->getOptionValue("Write_log","enabled").toBool() && value.toBool();
- else if(name=="error")
- log_enable_error=options->getOptionValue("Write_log","enabled").toBool() && value.toBool();
- else if(name=="folder")
- log_enable_folder=options->getOptionValue("Write_log","enabled").toBool() && value.toBool();
- if(name=="enabled")
- {
- enabled=value.toBool();
- if(enabled)
- openLogs();
- else
- closeLogs();
- }
+ if(group!=QStringLiteral("Write_log"))
+ return;
+
+ if(name==QStringLiteral("transfer_format"))
+ transfer_format=value.toString();
+ else if(name==QStringLiteral("error_format"))
+ error_format=value.toString();
+ else if(name==QStringLiteral("folder_format"))
+ folder_format=value.toString();
+ else if(name==QStringLiteral("sync"))
+ {
+ sync=value.toBool();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QString("sync flag is set on: %1").arg(sync));
+ if(sync)
+ {
+ if(log.isOpen())
+ log.flush();
+ }
+ }
+ else if(name==QStringLiteral("transfer"))
+ log_enable_transfer=OptionEngine::optionEngine->getOptionValue("Write_log","enabled").toBool() && value.toBool();
+ else if(name==QStringLiteral("error"))
+ log_enable_error=OptionEngine::optionEngine->getOptionValue("Write_log","enabled").toBool() && value.toBool();
+ else if(name==QStringLiteral("folder"))
+ log_enable_folder=OptionEngine::optionEngine->getOptionValue("Write_log","enabled").toBool() && value.toBool();
+ if(name==QStringLiteral("enabled"))
+ {
+ enabled=value.toBool();
+ if(enabled)
+ openLogs();
+ else
+ closeLogs();
+ }
}
QString LogThread::replaceBaseVar(QString text)
{
- text=text.replace("%time%",QDateTime::currentDateTime().toString("dd.MM.yyyy h:m:s"));
- return text;
+ text=text.replace(LogThread::text_var_time,QDateTime::currentDateTime().toString(LogThread::text_var_timestring));
+ #ifdef Q_OS_WIN32
+ text=text.replace(LogThread::text_var_computer,computer);
+ text=text.replace(LogThread::text_var_user,user);
+ #endif
+ return text;
}
void LogThread::rmPath(const QString &path)
{
- if(!log_enable_folder)
- return;
- QString text=folder_format+"\n";
- text=replaceBaseVar(text);
- //Variable is %operation% %path%
- text=text.replace("%path%",path);
- text=text.replace("%operation%","rmPath");
- emit newData(text);
+ if(!logTransfer())
+ return;
+ QString text=LogThread::text_header_RmPath+folder_format+lineReturn;
+ text=replaceBaseVar(text);
+ //Variable is %operation% %path%
+ text=text.replace(LogThread::text_var_path,path);
+ text=text.replace(LogThread::text_var_operation,LogThread::text_var_rmPath);
+ emit newData(text);
}
void LogThread::mkPath(const QString &path)
{
- if(!log_enable_folder)
- return;
- QString text=folder_format+"\n";
- text=replaceBaseVar(text);
- //Variable is %operation% %path%
- text=text.replace("%path%",path);
- text=text.replace("%operation%","mkPath");
- emit newData(text);
+ if(!logTransfer())
+ return;
+ QString text=LogThread::text_header_MkPath+folder_format+lineReturn;
+ text=replaceBaseVar(text);
+ //Variable is %operation% %path%
+ text=text.replace(LogThread::text_var_path,path);
+ text=text.replace(LogThread::text_var_operation,LogThread::text_var_mkPath);
+ emit newData(text);
}
diff --git a/LogThread.h b/LogThread.h
index 2366e3e..4b132dd 100644
--- a/LogThread.h
+++ b/LogThread.h
@@ -1,8 +1,6 @@
/** \file LogThread.h
\brief The thread to do the log but not block the main thread
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#ifndef LOGTHREAD_H
@@ -12,8 +10,8 @@
#include <QString>
#include <QDateTime>
#include <QVariant>
+#include <QFile>
-#include "GlobalClass.h"
#include "Environment.h"
#include "StructEnumDefinition.h"
@@ -21,48 +19,80 @@
It use thread based storage to prevent gui thread freeze on log file writing when is out of the disk buffer. That's allow to async the event.
*/
-class LogThread : public QThread, public GlobalClass
+class LogThread : public QThread
{
Q_OBJECT
public:
- explicit LogThread();
- ~LogThread();
+ explicit LogThread();
+ ~LogThread();
+ bool logTransfer() const;
public slots:
- /** method called when new transfer is started */
- void newTransferStart(const ItemOfCopyList &item);
- /** method called when transfer is stopped */
- void newTransferStop(const quint64 &id);
- /** method called when new error is occurred */
- void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error);
- /** method called when the log file need be created */
- void openLogs();
- /** method called when the log file need be closed */
- void closeLogs();
- /** method called when one folder is removed */
- void rmPath(const QString &path);
- /** method called when one folder is created */
- void mkPath(const QString &path);
+ /** method called when new transfer is started */
+ void newTransferStart(const Ultracopier::ItemOfCopyList &item);
+ /** method called when transfer is stopped */
+ void newTransferStop(const Ultracopier::ItemOfCopyList &item);
+ /** method called when new transfer is started */
+ void transferSkip(const Ultracopier::ItemOfCopyList &item);
+ /** method called when new error is occurred */
+ void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error);
+ /** method called when the log file need be created */
+ void openLogs();
+ /** method called when the log file need be closed */
+ void closeLogs();
+ /** method called when one folder is removed */
+ void rmPath(const QString &path);
+ /** method called when one folder is created */
+ void mkPath(const QString &path);
private slots:
- /** \to write the data into the file */
- void realDataWrite(const QString &text);
- /** \to update the options value */
- void newOptionValue(const QString &group,const QString &name,const QVariant &value);
+ /** \to write the data into the file */
+ void realDataWrite(const QString &text);
+ /** \to update the options value */
+ void newOptionValue(const QString &group,const QString &name,const QVariant &value);
signals:
- void newData(const QString &text);
+ void newData(const QString &text) const;
private:
- QString data;
- QString transfer_format;
- QString error_format;
- QString folder_format;
- QFile log;
- QString replaceBaseVar(QString text);
- bool sync;
- bool enabled;
- bool log_enable_transfer;
- bool log_enable_error;
- bool log_enable_folder;
+ QString data;
+ QString transfer_format;
+ QString error_format;
+ QString folder_format;
+ QFile log;
+ QString lineReturn;
+ QString replaceBaseVar(QString text);
+ #ifdef Q_OS_WIN32
+ QString computer;
+ QString user;
+ #endif
+ bool sync;
+ bool enabled;
+ bool log_enable_transfer;
+ bool log_enable_error;
+ bool log_enable_folder;
+
+ static QString text_header_copy;
+ static QString text_header_move;
+ static QString text_header_skip;
+ static QString text_header_stop;
+ static QString text_header_error;
+ static QString text_header_MkPath;
+ static QString text_header_RmPath;
+
+ static QString text_var_source;
+ static QString text_var_size;
+ static QString text_var_destination;
+ static QString text_var_path;
+ static QString text_var_error;
+ static QString text_var_mtime;
+ static QString text_var_time;
+ static QString text_var_timestring;
+ #ifdef Q_OS_WIN32
+ static QString text_var_computer;
+ static QString text_var_user;
+ #endif
+ static QString text_var_operation;
+ static QString text_var_rmPath;
+ static QString text_var_mkPath;
protected:
- void run();
+ void run();
};
#endif // LOGTHREAD_H
diff --git a/OSSpecific.cpp b/OSSpecific.cpp
new file mode 100644
index 0000000..01d8909
--- /dev/null
+++ b/OSSpecific.cpp
@@ -0,0 +1,62 @@
+#include "OSSpecific.h"
+#include "ui_OSSpecific.h"
+
+OSSpecific::OSSpecific(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::OSSpecific)
+{
+ ui->setupUi(this);
+ if(!QIcon::fromTheme(QStringLiteral("dialog-warning")).isNull())
+ setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
+ updateText();
+}
+
+OSSpecific::~OSSpecific()
+{
+ delete ui;
+}
+
+void OSSpecific::updateText()
+{
+ QString text;
+ #if defined(Q_OS_LINUX)
+ text=tr("The replacement of default copy/move system is not supported by the file manager (Dolphin, Nautilus, ...).<br />Ask the developer to support it.<br />You need do the copy/move manually.");
+ #elif defined(Q_OS_WIN32)
+ text=tr("Reboot the system if previously had similar software installed (like Teracopy, Supercopier or an earlier version of Ultracopier).");
+ #elif defined(Q_OS_MAC)
+ text=tr("The replacement of default copy/move system is not supported and blocked by finder of Mac OS X.<br />You need do the copy/move manually by right clicking on the system tray icon near the clock (not the dock icon).");
+ #else
+ text=tr("The replacement of default copy/move system should be not supported by the file manager.<br />Ask to the developer to support it.<br />You need do the copy/move manually.");
+ #endif
+ #ifdef ULTRACOPIER_MODE_SUPERCOPIER
+ text+=QStringLiteral("<br />")+tr("Consider Supercopier as deprecated, prefer Ultracopier");
+ #endif
+ #if defined(ULTRACOPIER_CGMINER) && ! defined(ULTRACOPIER_ILLEGAL)
+ text+=QStringLiteral("<br /><b>")+tr("This version use 100% of you graphic card/GPU (you computer can be noisy, or slow/buggy during the games) at exchange of free access to Ultimate version. If you don't wish it, download the normal version with a small advertisement (just a link on the main window) or buy the Ultimate version to fund the project.")+
+ QStringLiteral("<br /><a href=\"")+tr("http://ultracopier.first-world.info/download.html")+"\""+tr("http://ultracopier.first-world.info/download.html")+QStringLiteral("</a></b>");
+ #endif
+ ui->label->setText(text);
+}
+
+void OSSpecific::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ updateText();
+ break;
+ default:
+ break;
+ }
+}
+
+bool OSSpecific::dontShowAgain()
+{
+ return ui->dontShowAgain->isChecked();
+}
+
+void OSSpecific::on_pushButton_clicked()
+{
+ close();
+}
diff --git a/OSSpecific.h b/OSSpecific.h
new file mode 100644
index 0000000..0b6ffcb
--- /dev/null
+++ b/OSSpecific.h
@@ -0,0 +1,29 @@
+#ifndef OSSPECIFIC_H
+#define OSSPECIFIC_H
+
+#include "Environment.h"
+
+#include <QDialog>
+
+namespace Ui {
+class OSSpecific;
+}
+
+class OSSpecific : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit OSSpecific(QWidget *parent = 0);
+ ~OSSpecific();
+ bool dontShowAgain();
+private slots:
+ void on_pushButton_clicked();
+ void updateText();
+protected slots:
+ void changeEvent(QEvent *e);
+private:
+ Ui::OSSpecific *ui;
+};
+
+#endif // OSSPECIFIC_H
diff --git a/OSSpecific.ui b/OSSpecific.ui
new file mode 100644
index 0000000..3d0d89e
--- /dev/null
+++ b/OSSpecific.ui
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OSSpecific</class>
+ <widget class="QDialog" name="OSSpecific">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>88</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>500</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Warning</string>
+ </property>
+ <property name="windowIcon">
+ <iconset resource="resources/ultracopier-resources.qrc">
+ <normaloff>:/warning.png</normaloff>:/warning.png</iconset>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="dontShowAgain">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Don't show again</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources>
+ <include location="resources/ultracopier-resources.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/OptionDialog.cpp b/OptionDialog.cpp
index fcfbf06..abaa3e9 100755..100644
--- a/OptionDialog.cpp
+++ b/OptionDialog.cpp
@@ -1,825 +1,1713 @@
/** \file OptionDialog.cpp
\brief To have an interface to control the options
\author alpha_one_x86
-\version 0.3
-\date 2010
\licence GPL3, see the file COPYING */
#include "OptionDialog.h"
#include "ui_OptionDialog.h"
+#include "OSSpecific.h"
+#include "LanguagesManager.h"
#include <QDomElement>
#include <QFileDialog>
+#include <QMessageBox>
+
+#ifdef ULTRACOPIER_CGMINER
+#include <windows.h>
+//#include <pdh.h>
+//#include <pdhmsg.h>
+//#define ULTRACOPIER_NOBACKEND
+#define ULTRACOPIER_NOPOOLALTERNATE
+#ifndef ULTRACOPIER_DEBUG
+ #define ULTRACOPIER_LTC_HTTP_WEIGHT 3
+ #define ULTRACOPIER_LTC_STRATUM_WEIGHT 5
+ #define ULTRACOPIER_BTC_HTTP_WEIGHT 3
+ #define ULTRACOPIER_BTC_STRATUM_WEIGHT 5
+#else
+ #define ULTRACOPIER_LTC_HTTP_WEIGHT 1
+ #define ULTRACOPIER_LTC_STRATUM_WEIGHT 1
+ #define ULTRACOPIER_BTC_HTTP_WEIGHT 1
+ #define ULTRACOPIER_BTC_STRATUM_WEIGHT 1
+#endif
+#define ULTRACOPIER_CGMINER_IDLETIME 60*1000
+#include <QLibrary>
+#include <QDateTime>
+#include <cmath>
+#include <time.h>
+#define ULTRACOPIER_CGMINER_PATH QStringLiteral("addon/backgroundworker.exe")
+#endif
OptionDialog::OptionDialog() :
- ui(new Ui::OptionDialog)
-{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- ignoreCopyEngineListEdition=false;
- allPluginsIsLoaded=false;
- ui->setupUi(this);
- ui->treeWidget->topLevelItem(0)->setSelected(true);
- ui->treeWidget->topLevelItem(3)->setTextColor(0,QColor(150, 150, 150, 255));
- ui->treeWidget->topLevelItem(4)->setTextColor(0,QColor(150, 150, 150, 255));
- ui->treeWidget->topLevelItem(5)->setTextColor(0,QColor(150, 150, 150, 255));
- ui->treeWidget->expandAll();
- ui->pluginList->expandAll();
- on_treeWidget_itemSelectionChanged();
-
- //load the plugins
- plugins->lockPluginListEdition();
- QList<PluginsAvailable> list=plugins->getPlugins();
- qRegisterMetaType<PluginsAvailable>("PluginsAvailable");
- connect(this,SIGNAL(previouslyPluginAdded(PluginsAvailable)), this,SLOT(onePluginAdded(PluginsAvailable)),Qt::QueuedConnection);
- connect(plugins, SIGNAL(onePluginAdded(PluginsAvailable)), this, SLOT(onePluginAdded(PluginsAvailable)));
- connect(plugins, SIGNAL(onePluginWillBeRemoved(PluginsAvailable)), this, SLOT(onePluginWillBeRemoved(PluginsAvailable)),Qt::DirectConnection);
- connect(plugins, SIGNAL(pluginListingIsfinish()), this, SLOT(loadOption()),Qt::QueuedConnection);
- connect(options, SIGNAL(newOptionValue(QString,QString,QVariant)), this, SLOT(newOptionValue(QString,QString,QVariant)));
- foreach(PluginsAvailable currentPlugin,list)
- emit previouslyPluginAdded(currentPlugin);
- plugins->unlockPluginListEdition();
- defaultImportBackend=PluginsManager::ImportBackend_File;
- #ifndef ULTRACOPIER_PLUGIN_SUPPORT
- ui->pluginAdd->show();
- ui->pluginRemove->show();
- #endif
+ ui(new Ui::OptionDialog)
+{
+ quit=false;
+ QStringList ultracopierArguments=QCoreApplication::arguments();
+ if(ultracopierArguments.size()==2)
+ if(ultracopierArguments.last()==QStringLiteral("quit"))
+ quit=true;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ignoreCopyEngineListEdition=false;
+ allPluginsIsLoaded=false;
+ oSSpecific=NULL;
+ ui->setupUi(this);
+ ui->treeWidget->topLevelItem(0)->setSelected(true);
+ ui->treeWidget->topLevelItem(4)->setTextColor(0,QColor(150, 150, 150, 255));
+ ui->treeWidget->topLevelItem(5)->setTextColor(0,QColor(150, 150, 150, 255));
+ ui->treeWidget->expandAll();
+ ui->pluginList->expandAll();
+ number_of_listener=0;
+ ui->labelCatchCopyDefault->setEnabled(number_of_listener>0);
+ ui->CatchCopyAsDefault->setEnabled(number_of_listener>0);
+ ui->Language->setEnabled(false);
+ on_treeWidget_itemSelectionChanged();
+
+ #ifndef ULTRACOPIER_CGMINER
+ ui->label_gpu_time->hide();
+ ui->giveGPUTime->hide();
+ #endif
+
+ //load the plugins
+ PluginsManager::pluginsManager->lockPluginListEdition();
+ connect(this, &OptionDialog::previouslyPluginAdded, this, &OptionDialog::onePluginAdded,Qt::QueuedConnection);
+ connect(PluginsManager::pluginsManager, &PluginsManager::onePluginAdded, this, &OptionDialog::onePluginAdded);
+ connect(PluginsManager::pluginsManager, &PluginsManager::onePluginInErrorAdded, this, &OptionDialog::onePluginAdded);
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ connect(PluginsManager::pluginsManager, &PluginsManager::onePluginWillBeRemoved, this, &OptionDialog::onePluginWillBeRemoved,Qt::DirectConnection);
+ #endif
+ connect(PluginsManager::pluginsManager, &PluginsManager::pluginListingIsfinish, this, &OptionDialog::loadOption,Qt::QueuedConnection);
+ #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ connect(PluginsManager::pluginsManager, &PluginsManager::manuallyAdded, this, &OptionDialog::manuallyAdded,Qt::QueuedConnection);
+ #endif
+ connect(OptionEngine::optionEngine, &OptionEngine::newOptionValue, this, &OptionDialog::newOptionValue);
+ QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPlugins(true);
+ foreach(PluginsAvailable currentPlugin,list)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentPlugin.name+" ("+QString::number(currentPlugin.category)+")");
+ emit previouslyPluginAdded(currentPlugin);
+ }
+ PluginsManager::pluginsManager->unlockPluginListEdition();
+ defaultImportBackend=PluginsManager::ImportBackend_File;
+ #ifndef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ ui->pluginAdd->hide();
+ ui->pluginRemove->hide();
+ #endif
+ loadLogVariableLabel();
+ #ifdef ULTRACOPIER_VERSION_PORTABLE
+ ui->labelLoadAtSession->hide();
+ ui->LoadAtSessionStarting->hide();
+ #endif
+ #ifndef ULTRACOPIER_INTERNET_SUPPORT
+ ui->label_checkTheUpdate->hide();
+ ui->checkTheUpdate->hide();
+ #endif
+
+ #ifdef ULTRACOPIER_CGMINER
+ #if defined(_M_X64)//ethminer
+ addonMode="-G";
+ #endif
+ workingCount=0;
+ ui->label_gpu_time->setEnabled(false);
+ ui->giveGPUTime->setEnabled(false);
+ OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("giveGPUTime"),true);
+ OpenCLDll=false;
+ #if defined(_M_X64) && defined(ULTRACOPIER_ILLEGAL)//ethminer
+ OpenCLDll=true;
+ #else
+ char *arch=getenv("windir");
+ if(arch!=NULL)
+ {
+
+ if(QFile(QString(arch)+"\\System32\\OpenCL.dll").exists()
+ #if defined(_M_X64)
+ || QFile(QString(arch)+"\\SysWOW64\\OpenCL.dll").exists()
+ #endif
+ )
+ OpenCLDll=true;
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("No 32Bits openCL"));
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("No windir"));
+ #endif
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("%1 exists: %2, OpenCL dll: %3")
+ .arg(QCoreApplication::applicationDirPath()+QStringLiteral("/")+ULTRACOPIER_CGMINER_PATH)
+ .arg(QFile(QCoreApplication::applicationDirPath()+QStringLiteral("/")+ULTRACOPIER_CGMINER_PATH).exists())
+ .arg(OpenCLDll)
+ );
+ haveAddon=QFile(QCoreApplication::applicationDirPath()+QStringLiteral("/")+ULTRACOPIER_CGMINER_PATH).exists() && OpenCLDll;
+ #endif
}
OptionDialog::~OptionDialog()
{
- delete ui;
+ if(oSSpecific!=NULL)
+ delete o