Merge branch 'master' into qmlapp_pex_alpha

This commit is contained in:
Gioacchino Mazzurco 2017-04-28 13:26:31 +02:00
commit 3fddbaf070
46 changed files with 3114 additions and 1622 deletions

View File

@ -1,5 +1,199 @@
retroshare06 (0.6.2-1.XXXXXX~YYYYYY) YYYYYY; urgency=low retroshare06 (0.6.2-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
5b3b903 csoler Sun, 23 Apr 2017 17:33:21 +0200 added missing line for ubuntu zesty
73bfc27 csoler Sun, 23 Apr 2017 17:33:50 +0200 Merge pull request #784 from PhenomRetroShare/Fix_RelaySettingsPage
4c326f5 Phenom Sun, 23 Apr 2017 10:27:18 +0200 Fix Relay setting page.
0e087db defnax Sat, 22 Apr 2017 17:32:59 +0200 Fixed to use right icons for context menu actions
8b9c447 electr Sat, 22 Apr 2017 10:13:23 +0200 fixed possible crash and return value in rsGetHostByName(), thanks to Kotyara for reporting this
4ab6021 csoler Fri, 21 Apr 2017 19:45:30 +0200 Merge pull request #782 from PhenomRetroShare/Fix_MacOSX_Compilation
936dcba Phenom Fri, 21 Apr 2017 18:50:36 +0200 Fix UnitTest compilation.
969b5ce Phenom Fri, 21 Apr 2017 15:57:57 +0200 Fix MacOSX compilation.
7400a8d csoler Thu, 20 Apr 2017 20:59:12 +0200 Merge pull request #780 from csoler/v0.6-ImprovedGUI
5f8bf03 csoler Thu, 20 Apr 2017 20:54:51 +0200 added mechanism to allow services to document the names of their items, and improved bandwidth graph to show names for GXS services. Other services still need to supply their own names
ccfd12b csoler Wed, 19 Apr 2017 18:53:49 +0200 Merge pull request #778 from csoler/v0.6-ImprovedGUI
f406b81 csoler Wed, 19 Apr 2017 18:46:58 +0200 removed all FFT code and cleaned up deleted code in graphwidget.cpp
1da89dd csoler Wed, 19 Apr 2017 17:16:30 +0200 changed FFT code in graph widget into a more efficient one, with free licence
e95ddb9 csoler Tue, 18 Apr 2017 20:28:36 +0200 Merge pull request #767 from PhenomRetroShare/Fix_CommentWithLineReturn
5f969e7 csoler Tue, 18 Apr 2017 20:27:20 +0200 Merge pull request #776 from PhenomRetroShare/Fix_ClangWarnings
3ab39c6 csoler Tue, 18 Apr 2017 20:26:14 +0200 Merge pull request #777 from PhenomRetroShare/Fix_EncodeRadixInRSLinks
3c5e61a Phenom Tue, 18 Apr 2017 17:36:43 +0200 Encode Radix in RSLinks.
3733137 Phenom Tue, 18 Apr 2017 11:25:41 +0200 Fix Clang warnings: implicit conversion
7d9a803 Phenom Tue, 18 Apr 2017 11:18:10 +0200 Fix Clang warnings: bdnet_inet_ntoa C-linkage
4faaaf7 csoler Mon, 17 Apr 2017 22:03:48 +0200 Merge pull request #775 from csoler/v0.6-PRTest
87dd614 Phenom Fri, 7 Apr 2017 19:32:19 +0200 Fix Clang Warnings: private field 'encoding_debug_file' is not used
4f939b2 Phenom Fri, 7 Apr 2017 19:29:27 +0200 Fix Clang warnings: unused function 'set_item_background'
76f7573 Phenom Fri, 7 Apr 2017 18:48:40 +0200 Fix Clang warnings: comparison of array != a null pointer is always true
0bbd149 Phenom Fri, 7 Apr 2017 18:42:22 +0200 Fix Clang warnings: comparison of integers of different signs
a476a81 Phenom Fri, 7 Apr 2017 18:40:02 +0200 Fix Clang warnings: function 'update_children_background' is not needed
d8a7313 Phenom Fri, 7 Apr 2017 18:32:55 +0200 Fix Clang warnings: implicit conversion from 'double' to 'int'
19196e2 Phenom Fri, 7 Apr 2017 18:21:49 +0200 Fix Clang warnings: ariable 'status' is used uninitialized
a3a53b9 Phenom Fri, 7 Apr 2017 18:19:42 +0200 Fix Clang warnings: unused parameter 'req'
94ac821 Phenom Wed, 29 Mar 2017 18:13:17 +0200 Fix Clang warnings: Unused variable Pi
fd92bca Phenom Tue, 28 Mar 2017 21:18:25 +0200 Fix Clang warnings: variable 'layout' is used uninitialized
8d85cf5 Phenom Tue, 28 Mar 2017 21:16:05 +0200 Fix Clang warnings: 'xxxWidget::sizeHint' hides overloaded vf
6f2d7bb Phenom Sun, 19 Mar 2017 10:51:48 +0100 Fix Clang warnings: implicit conversion from 'double' to 'int'
07b67e9 Phenom Sun, 19 Mar 2017 10:40:34 +0100 Fix Clang warnings: 'PopupDistantChatDialog::init' hides overloaded virtual function
eea49d9 Phenom Sat, 18 Mar 2017 11:56:11 +0100 Fix Clang warnings: change ChatDialog::init definition
9319caf Phenom Sat, 18 Mar 2017 11:32:56 +0100 Fix Clang warnings: 'Node::advance' hides overloaded virtual function
13c8f7d Phenom Sat, 18 Mar 2017 11:28:29 +0100 Fix Clang warnings: Infinite recursion
e0225ef Phenom Sat, 18 Mar 2017 11:19:42 +0100 Fix Clang warnings: 'ChatLobbyDialog::init' hides overloaded virtual function
de4f6c0 Phenom Sat, 18 Mar 2017 10:42:38 +0100 Fix Clang warnings: Z-order assignment to spacer
32eeb95 Phenom Sat, 18 Mar 2017 10:25:23 +0100 Fix Clang warnings: unused private field
4ac3b3f Phenom Sat, 18 Mar 2017 10:20:57 +0100 Fix Clang warnings: implicit conversion of NULL to bool
e83104e Phenom Sat, 18 Mar 2017 10:19:31 +0100 Fix Clang warnings: Add author and date to #warning
039908b Phenom Thu, 16 Mar 2017 22:58:06 +0100 Fix Clang warnings: private field not used
872f42b Phenom Thu, 16 Mar 2017 22:55:18 +0100 Fix Clang warnings: Overloaded vf hide in pluginmanager
2204309 Phenom Thu, 16 Mar 2017 22:11:33 +0100 Fix Clang warnings: extraneous parentheses
dc533b1 Phenom Thu, 16 Mar 2017 22:01:22 +0100 Fix Clang warnings: private field not used
6532150 Phenom Thu, 16 Mar 2017 21:04:38 +0100 Fix Clang warnings: Overloaded vf hide in p3dhtmgr
5bc6558 Phenom Thu, 16 Mar 2017 18:28:48 +0100 Fix Clang warnings: explicitly assigning value to itself
6fecac5 Phenom Thu, 16 Mar 2017 17:50:25 +0100 Fix Clang warnings: Overloaded vf hide
cf963c0 Phenom Wed, 15 Mar 2017 20:41:39 +0100 Fix Clang warnings: struct declared as class
105840a Phenom Wed, 15 Mar 2017 19:03:39 +0100 Fix Clang Warning: Overloaded vf hide
da4b168 Phenom Wed, 15 Mar 2017 18:55:24 +0100 Fix Clang warnings: mFns is not used
cbc264f Phenom Wed, 15 Mar 2017 18:53:30 +0100 Fix clang warning:Implicit conversion from enumeration
b2e37fe csoler Sat, 15 Apr 2017 20:24:06 +0200 Merge pull request #773 from csoler/v0.6-Identity
273aae7 csoler Sat, 15 Apr 2017 19:01:13 +0200 fixed sharing of own identity
98e1a6d electr Thu, 13 Apr 2017 14:12:46 +0200 Merge pull request #770 from Sonetio/fix_reselecting_accounts
144d570 Konrad Thu, 13 Apr 2017 13:40:30 +0200 Fixed: Thread safe access to RsControlModule member variables
dcc8c6e Konrad Thu, 13 Apr 2017 13:31:32 +0200 Changed: Using PeersHandler::mRsPeers instead of rsPeers
a382d68 electr Thu, 13 Apr 2017 09:22:19 +0200 Merge pull request #769 from electron128/fix-gui-multiinstance
aa81cc1 Konrad Wed, 12 Apr 2017 20:24:18 +0200 Added: Functions for handling PGP account details requests
9402b8e Konrad Mon, 10 Apr 2017 23:42:22 +0200 Fixed: mFixedPassword remained empty after logging
e1350a0 Konrad Mon, 10 Apr 2017 22:58:23 +0200 Fixed: Re-selecting accounts via RsControlModule; Added: Sending feedback about incorrect password
3130ec9 csoler Mon, 10 Apr 2017 20:02:14 +0200 added GUI async call to ID serialised data. Allows to copy+paste identities.
4c9b620 electr Sun, 9 Apr 2017 10:26:18 +0200 fixed --base-dir command line argument in rs-gui when running multiple instances. Only forward "link" and "rsfile" arguments to a running instance. Start a new instance if other arguments are present.
7f12ca2 electr Sun, 9 Apr 2017 09:57:48 +0200 fixed name of local socket where RS waits for rslinks etc.
d66e653 csoler Sat, 8 Apr 2017 23:39:05 +0200 fixed bug in deserialisation of group informaiton
54cd402 csoler Sat, 8 Apr 2017 21:43:07 +0200 fixed a few bugs in latest identity link code
6d29038 csoler Sat, 8 Apr 2017 21:12:48 +0200 added RSLink for GXS identities
4f5da86 csoler Sat, 8 Apr 2017 19:07:33 +0200 added method to serialise/deserialise groups to/from memory and export of GxsIdentities to memory chunk in radix format
f175533 Phenom Sat, 8 Apr 2017 14:06:47 +0200 Fix comment view when they have line return.
4067c95 electr Wed, 5 Apr 2017 18:49:32 +0200 Merge pull request #760 from Sonetio/windows_service
6e65fcd Konrad Sat, 1 Apr 2017 14:32:49 +0200 Removed: Unused #include statement
8543525 Konrad Sat, 1 Apr 2017 14:28:55 +0200 Fixed: Linker problem
fbc1bb4 Konrad Wed, 29 Mar 2017 16:06:39 +0200 Added: function for handling autosubscribing lobbies
22956be Konrad Tue, 28 Mar 2017 11:24:16 +0200 Deleted: functions for hadling particular lobbies types in ChatHandler
6e53002 Konrad Tue, 28 Mar 2017 11:20:51 +0200 Added: tokens in PeersHandler
efd6ce3 Konrad Tue, 28 Mar 2017 11:19:50 +0200 Changed: Simplified asking for deferred self signature
5694581 Konrad Tue, 28 Mar 2017 11:18:27 +0200 Changed: Qt dependecies are optional
4031e49 Konrad Mon, 27 Mar 2017 16:11:04 +0200 Deleted: unused stateTokens
c33107c Konrad Sun, 26 Mar 2017 19:12:04 +0200 Fixed: backward comptiblity
bef7540 Konrad Sun, 26 Mar 2017 15:11:07 +0200 Fixed building on Travis CI
dbcf2d2 csoler Sat, 25 Mar 2017 20:27:18 +0100 Merge pull request #756 from RetroPooh/guistuff
04af39f csoler Sat, 25 Mar 2017 20:24:40 +0100 Merge pull request #754 from PhenomRetroShare/Fix_WinNoSQLCipherCompil
ccb632a csoler Sat, 25 Mar 2017 19:26:12 +0100 Merge pull request #749 from PhenomRetroShare/Fix_WindowsHeightAtFirstStart
8624c93 Konrad Sat, 25 Mar 2017 18:33:35 +0100 Added functions for hadling particular lobbies types to ChatHandler
194878a Konrad Sat, 25 Mar 2017 18:31:13 +0100 Added functions for handling own and not own identities to IdentityHandler
cb32f30 Konrad Sat, 25 Mar 2017 18:28:31 +0100 Added states handling to PeersHandler
28d37c2 Konrad Sat, 25 Mar 2017 18:25:26 +0100 Added password storing to RsControlModule for GUI benefits
39967b7 Konrad Sat, 25 Mar 2017 18:23:28 +0100 Added name of requests to be used by GUI
ae95b49 Konrad Sat, 25 Mar 2017 18:20:53 +0100 Added SettingsHandler to handle response to settings requests
cb04134 Konrad Sat, 25 Mar 2017 18:15:47 +0100 Added Windows support to libresapi when working with retroshare_android_service
b0d2249 Konrad Sat, 25 Mar 2017 18:12:39 +0100 Added Windows support to retroshare-android-service
f5e7217 RetroP Tue, 21 Mar 2017 17:24:59 +0300 statistics - router - fix bold marking for tunnel speeds over 1mbs
85cfda1 RetroP Tue, 21 Mar 2017 16:52:40 +0300 add tree item counters for channels,forums,posted
50c81d7 RetroP Tue, 21 Mar 2017 16:41:39 +0300 chat lobby list - mark signed lobbies with color
000dabf RetroP Tue, 21 Mar 2017 15:02:46 +0300 chat lobby list - add tree item counters
19bd51d RetroP Tue, 21 Mar 2017 14:57:06 +0300 searchdialog - mark current downloads green
5efa8e3 Phenom Fri, 17 Mar 2017 22:14:14 +0100 Fix Windows Compilation with CONFIG+=no_sqlcipher
ca0521c csoler Thu, 16 Mar 2017 21:01:27 +0100 allowed to edit subject hen editing forum posts. Only the latest subject is visible
107d48f Phenom Wed, 15 Mar 2017 22:50:51 +0100 Fix windows height at first start.
2046dbe csoler Wed, 15 Mar 2017 20:53:01 +0100 merged latest fixes from official 0.6.2 release branch
e4fad45 csoler Wed, 15 Mar 2017 20:51:40 +0100 fixed layout in ConfCertDialog, removed overnumerous tabs
2114374 csoler Wed, 15 Mar 2017 19:26:07 +0100 fixed update of Tor proxy address in hidden nodes server page
44f2971 csoler Tue, 14 Mar 2017 20:04:22 +0100 Merge pull request #682 from csoler/v0.6-EditPosts
a0d1089 csoler Sat, 11 Mar 2017 18:15:35 +0100 added branch parameter to makeSourcePackage script
fdab480 csoler Sat, 11 Mar 2017 18:10:14 +0100 added minimum version number for debian stretch
733b114 thunde Fri, 10 Mar 2017 15:57:40 +0100 Updated languages from Transifex
ed5779f csoler Fri, 10 Mar 2017 15:39:22 +0100 Merge pull request #743 from mestaritonttu/patch-22
69c3df6 csoler Fri, 10 Mar 2017 15:36:50 +0100 fixed bug in total item size estimation in pqiqosstreamer due to item slicing
c377bf3 csoler Fri, 10 Mar 2017 15:12:10 +0100 fixed debug output for groups with no data
fd84639 csoler Fri, 10 Mar 2017 15:05:41 +0100 removed some debug info
c87de3e csoler Fri, 10 Mar 2017 10:48:40 +0100 fixed mistake in pointer handling
cf2edb5 csoler Thu, 9 Mar 2017 22:47:06 +0100 fixed memory leak in deleteGroup and removed unnecessary pointer in the functions called below
a545481 csoler Thu, 9 Mar 2017 22:05:06 +0100 fixed memory leak when receving multi-chunk file lists
5b819eb csoler Thu, 9 Mar 2017 20:59:01 +0100 added missing virtual destructor causing a memory leak
1f8fd95 csoler Thu, 9 Mar 2017 20:48:26 +0100 fixed uninitialised memory read in chacha20 test code
d5f2ae8 csoler Thu, 9 Mar 2017 20:39:12 +0100 fixed memory leak recently introduced with openssl-1.1.0 changes
f76454d csoler Thu, 9 Mar 2017 13:05:03 +0100 updated full pipeline packaging script for debian
999e845 mestar Wed, 8 Mar 2017 13:17:34 +0200 Fix grammar
e6cf628 csoler Tue, 7 Mar 2017 21:58:59 +0100 Merge pull request #740 from RetroPooh/trstats
283a2ee csoler Tue, 7 Mar 2017 21:54:56 +0100 Merge pull request #717 from PhenomRetroShare/Fix_SettingListWidth
b3b2a4b csoler Tue, 7 Mar 2017 21:54:10 +0100 Merge pull request #726 from mestaritonttu/patch-8
bbc27b2 csoler Tue, 7 Mar 2017 21:53:21 +0100 Merge pull request #736 from mestaritonttu/patch-18
3d0c28d csoler Tue, 7 Mar 2017 21:52:19 +0100 Merge pull request #724 from mestaritonttu/patch-6
ed22b48 csoler Tue, 7 Mar 2017 21:51:51 +0100 Merge pull request #738 from mestaritonttu/patch-20
376be42 csoler Tue, 7 Mar 2017 21:51:13 +0100 Merge pull request #739 from mestaritonttu/patch-21
b3578f6 csoler Tue, 7 Mar 2017 21:50:20 +0100 Merge pull request #734 from mestaritonttu/patch-16
d9c084b csoler Tue, 7 Mar 2017 21:49:52 +0100 Merge pull request #730 from mestaritonttu/patch-12
5bad326 csoler Tue, 7 Mar 2017 21:49:14 +0100 Merge pull request #725 from mestaritonttu/patch-7
ec21698 csoler Tue, 7 Mar 2017 21:48:30 +0100 Merge pull request #727 from mestaritonttu/patch-9
7d8e06b csoler Tue, 7 Mar 2017 21:47:43 +0100 Merge pull request #732 from mestaritonttu/patch-14
f3e29bd csoler Tue, 7 Mar 2017 21:47:00 +0100 Merge pull request #731 from mestaritonttu/patch-13
17c44db csoler Tue, 7 Mar 2017 21:46:21 +0100 Merge pull request #733 from mestaritonttu/patch-15
5f9f061 csoler Tue, 7 Mar 2017 21:45:50 +0100 Merge pull request #735 from mestaritonttu/patch-17
8881a44 csoler Tue, 7 Mar 2017 21:45:11 +0100 Merge pull request #737 from mestaritonttu/patch-19
160c289 csoler Tue, 7 Mar 2017 21:44:42 +0100 Merge pull request #728 from mestaritonttu/patch-10
22308bc csoler Tue, 7 Mar 2017 21:44:14 +0100 Merge pull request #729 from mestaritonttu/patch-11
fedffd7 csoler Tue, 7 Mar 2017 21:43:36 +0100 Merge pull request #723 from mestaritonttu/patch-5
d3f0f9d RetroP Tue, 7 Mar 2017 17:50:13 +0300 router stats - mark active tunnels bold
87f9dba mestar Tue, 7 Mar 2017 14:05:21 +0200 Improvements and typo fixes in strings
222cf48 mestar Tue, 7 Mar 2017 14:03:05 +0200 Various improvements and fixes to strings
83283d9 mestar Tue, 7 Mar 2017 13:58:43 +0200 Remove extra your
7005126 mestar Tue, 7 Mar 2017 13:57:10 +0200 Added whitespace to strings
6ec5415 mestar Tue, 7 Mar 2017 13:55:02 +0200 ASCII uppercase
28d2e27 mestar Tue, 7 Mar 2017 13:53:08 +0200 Remove whitespace from string
931531b mestar Tue, 7 Mar 2017 13:51:28 +0200 Fix typo
65c7ca7 mestar Tue, 7 Mar 2017 13:49:57 +0200 Clarify sorting by posts
21b7861 mestar Tue, 7 Mar 2017 13:48:14 +0200 Fix grammar
ba18fcd mestar Tue, 7 Mar 2017 13:45:31 +0200 Fix grammar
a4c2015 mestar Tue, 7 Mar 2017 13:41:45 +0200 Fix typos
6b4f7e3 mestar Tue, 7 Mar 2017 13:39:39 +0200 Removed extra "to"
b444567 mestar Tue, 7 Mar 2017 13:34:53 +0200 Added period
400dde9 mestar Tue, 7 Mar 2017 13:09:04 +0200 Added whitespace
c9a4a55 mestar Tue, 7 Mar 2017 13:06:22 +0200 Fix grammar
86e7243 mestar Tue, 7 Mar 2017 12:56:25 +0200 Fix typos
d7dc9cc mestar Tue, 7 Mar 2017 12:53:18 +0200 Whitespace inside <p>
a518225 csoler Tue, 7 Mar 2017 11:27:17 +0100 Merge pull request #716 from felisucoibi/master
6a6bcf7 thunde Mon, 6 Mar 2017 21:46:42 +0100 Fixed Windows compile of VOIP
dc65d3f Phenom Sun, 5 Mar 2017 13:22:30 +0100 Fix Setting list width.
0316c8c thunde Mon, 6 Mar 2017 06:34:06 +0100 Added workaround for crash on Windows 7 for Qt versions with gcc 5.3.0. The call to GetProcAddress in openssl (cryptlib.c) finds an function pointer to the not existing function _OPENSSL_isservice in the executable running on Windows 7.
313e1b3 csoler Sun, 5 Mar 2017 20:08:53 +0100 updated translation files
88a5c03 csoler Sun, 5 Mar 2017 20:08:36 +0100 removed some debug info
94c9c94 thunde Sun, 5 Mar 2017 14:30:45 +0100 updated version number to 0.6.2 in rsversion.in
b71f475 csoler Sun, 5 Mar 2017 14:14:46 +0100 qick fix to allow re-advertising for known forums/channels during the same session. Will be reset at restart (probably best)
fbd72dd csoler Sun, 5 Mar 2017 13:57:49 +0100 fixed settings SoundPage
15bb0ff felisu Sun, 5 Mar 2017 02:45:37 +0100 Update ChatPage.h
951820f felisu Sun, 5 Mar 2017 02:45:07 +0100 Update ForumPage.h
63174aa felisu Sun, 5 Mar 2017 02:44:18 +0100 Update PostedPage.h
ca75515 felisu Sun, 5 Mar 2017 02:43:40 +0100 Update MessagePage.h
d3cdd15 csoler Sat, 4 Mar 2017 21:20:34 +0100 fixed uninitialised memory read in GxsReputation
dec5c5c csoler Sat, 4 Mar 2017 21:13:34 +0100 suppressed uninitialised memory leak in LocalDirectoryStorage
b14e4d5 csoler Sat, 4 Mar 2017 21:08:10 +0100 removed memory leak due to missing delete for BWGraph
0bd0056 csoler Sat, 4 Mar 2017 20:52:41 +0100 fixed memory leak in RsGxsNetService
7111579 csoler Sat, 4 Mar 2017 20:52:06 +0100 fixed memory leak in config of msgService
2302c46 csoler Sat, 4 Mar 2017 16:41:10 +0100 updated version number in changelog
0024ddf csoler Sat, 4 Mar 2017 16:39:39 +0100 fixed utf8 bug in ShareManager
3600905 csoler Sat, 4 Mar 2017 12:04:41 +0100 updated packaging files
c715b03 csoler Sat, 4 Mar 2017 11:56:51 +0100 updated version number to 0.6.2
5e2a253 csoler Sat, 4 Mar 2017 11:44:31 +0100 updated ubuntu changelog
bd8189c csoler Tue, 28 Feb 2017 18:05:44 +0100 added test to prevent msgs with a different name to be used as different version
763f227 csoler Sun, 26 Feb 2017 20:39:40 +0100 merged upstream/master into v0.6-EditPosts branch
22f2edb csoler Sat, 11 Feb 2017 10:45:30 +0100 removed debug info and added comment
ea82d26 csoler Thu, 9 Feb 2017 23:35:59 +0100 fixed signature verification bug for versionned messages
5bf8376 csoler Thu, 9 Feb 2017 21:49:24 +0100 fixed a few more bugs in post version UI
8deeec6 csoler Thu, 9 Feb 2017 18:45:55 +0100 fixed UI for post versions
b93130a csoler Thu, 9 Feb 2017 16:15:35 +0100 fixed a few bugs in post version collecting
f8056e5 csoler Thu, 9 Feb 2017 14:49:43 +0100 added collection of older posts versions.
6681985 csoler Wed, 8 Feb 2017 20:40:47 +0100 merged upstream/master
dfcb66d csoler Fri, 3 Feb 2017 13:02:53 +0100 added spinbox to show older versions
777a73e csoler Fri, 3 Feb 2017 12:48:51 +0100 added GUI for editing forum messages
-- Retroshare Dev Team <contact@retroshare.net> Dim, 23 Apr 2017 16:00:00 +0100
retroshare06 (0.6.2-1.931442~trusty) trusty; urgency=low
931442a csoler Sat, 4 Mar 2017 00:07:51 +0100 fixed compilation 931442a csoler Sat, 4 Mar 2017 00:07:51 +0100 fixed compilation
b4e0a8f csoler Sat, 4 Mar 2017 00:04:52 +0100 removed unused file DirectoriesPage.{cpp,ui,h} b4e0a8f csoler Sat, 4 Mar 2017 00:04:52 +0100 removed unused file DirectoriesPage.{cpp,ui,h}
e257563 csoler Sat, 4 Mar 2017 00:01:21 +0100 merged Directories settings page into Transfers and renamed it Files e257563 csoler Sat, 4 Mar 2017 00:01:21 +0100 merged Directories settings page into Transfers and renamed it Files

View File

@ -0,0 +1,44 @@
Source: retroshare06
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qt5-default
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqt5multimedia5
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
encrypt all communication. RetroShare provides filesharing, chat, messages,
forums and channels.

View File

@ -54,7 +54,7 @@ while [ ${#} -gt 0 ]; do
done done
if test "${dist}" = "" ; then if test "${dist}" = "" ; then
dist="precise trusty vivid xenial yakkety" dist="precise trusty vivid xenial yakkety zesty"
fi fi
echo Attempting to get revision number... echo Attempting to get revision number...
@ -116,6 +116,8 @@ for i in ${dist}; do
if test "${i}" = "lucid" ; then if test "${i}" = "lucid" ; then
cp ../control.ubuntu_lucid debian/control cp ../control.ubuntu_lucid debian/control
elif test "${i}" = "zesty" ; then
cp ../control.zesty debian/control
elif test "${i}" = "squeeze" ; then elif test "${i}" = "squeeze" ; then
cp ../control.squeeze_bubba3 debian/control cp ../control.squeeze_bubba3 debian/control
elif test "${i}" = "precise" ; then elif test "${i}" = "precise" ; then

View File

@ -144,6 +144,11 @@ std::string bloomFilter::getFilter()
bytes++; bytes++;
} }
if (bytes==0)
{
std::cerr << "(EE) Error. Cannot allocate memory for 0 byte in " << __PRETTY_FUNCTION__ << std::endl;
return std::string();
}
// convert to binary array. // convert to binary array.
uint8_t *tmparray = (uint8_t *) malloc(bytes); uint8_t *tmparray = (uint8_t *) malloc(bytes);

View File

@ -164,6 +164,7 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
addResourceHandler("*", this, &ChatHandler::handleWildcard); addResourceHandler("*", this, &ChatHandler::handleWildcard);
addResourceHandler("lobbies", this, &ChatHandler::handleLobbies); addResourceHandler("lobbies", this, &ChatHandler::handleLobbies);
addResourceHandler("create_lobby", this, &ChatHandler::handleCreateLobby);
addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby); addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby);
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby); addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby); addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby);
@ -1234,4 +1235,37 @@ void ChatHandler::handleCloseDistantChatConnexion(Request& req, Response& resp)
else resp.setFail("Failed to close distant chat"); else resp.setFail("Failed to close distant chat");
} }
void ChatHandler::handleCreateLobby(Request& req, Response& resp)
{
std::set<RsPeerId> invited_identites;
std::string lobby_name;
std::string lobby_topic;
std::string gxs_id;
req.mStream << makeKeyValueReference("lobby_name", lobby_name);
req.mStream << makeKeyValueReference("lobby_topic", lobby_topic);
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsGxsId gxsId(gxs_id);
bool lobby_public;
bool pgp_signed;
req.mStream << makeKeyValueReference("lobby_public", lobby_public);
req.mStream << makeKeyValueReference("pgp_signed", pgp_signed);
ChatLobbyFlags lobby_flags;
if(lobby_public)
lobby_flags |= RS_CHAT_LOBBY_FLAGS_PUBLIC;
if(pgp_signed)
lobby_flags |= RS_CHAT_LOBBY_FLAGS_PGP_SIGNED;
mRsMsgs->createChatLobby(lobby_name, gxsId, lobby_topic, invited_identites, lobby_flags);
tick();
resp.setOk();
}
} // namespace resource_api } // namespace resource_api

View File

@ -118,6 +118,7 @@ public:
private: private:
void handleWildcard(Request& req, Response& resp); void handleWildcard(Request& req, Response& resp);
void handleLobbies(Request& req, Response& resp); void handleLobbies(Request& req, Response& resp);
void handleCreateLobby(Request& req, Response& resp);
void handleSubscribeLobby(Request& req, Response& resp); void handleSubscribeLobby(Request& req, Response& resp);
void handleUnsubscribeLobby(Request& req, Response& resp); void handleUnsubscribeLobby(Request& req, Response& resp);
void handleAutoSubsribeLobby(Request& req, Response& resp); void handleAutoSubsribeLobby(Request& req, Response& resp);

View File

@ -21,6 +21,7 @@
#include "IdentityHandler.h" #include "IdentityHandler.h"
#include <retroshare/rsidentity.h> #include <retroshare/rsidentity.h>
#include <retroshare/rspeers.h>
#include <time.h> #include <time.h>
#include "Operators.h" #include "Operators.h"
@ -117,6 +118,37 @@ protected:
} }
}; };
class DeleteIdentityTask : public GxsResponseTask
{
public:
DeleteIdentityTask(RsIdentity* idservice) :
GxsResponseTask(idservice, idservice->getTokenService()),
mToken(0),
mRsIdentity(idservice)
{}
protected:
virtual void gxsDoWork(Request &req, Response &resp)
{
RsGxsIdGroup group;
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
group.mMeta.mGroupId = RsGxsGroupId(gxs_id);
mRsIdentity->deleteIdentity(mToken, group);
addWaitingToken(mToken);
done();
return;
}
private:
uint32_t mToken;
RsIdentity* mRsIdentity;
RsGxsId mId;
};
IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify,
RsIdentity *identity) : RsIdentity *identity) :
mStateTokenServer(sts), mNotify(notify), mRsIdentity(identity), mStateTokenServer(sts), mNotify(notify), mRsIdentity(identity),
@ -136,6 +168,17 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify,
addResourceHandler("export_key", this, &IdentityHandler::handleExportKey); addResourceHandler("export_key", this, &IdentityHandler::handleExportKey);
addResourceHandler("import_key", this, &IdentityHandler::handleImportKey); addResourceHandler("import_key", this, &IdentityHandler::handleImportKey);
addResourceHandler("add_contact", this, &IdentityHandler::handleAddContact);
addResourceHandler("remove_contact", this, &IdentityHandler::handleRemoveContact);
addResourceHandler("create_identity", this, &IdentityHandler::handleCreateIdentity);
addResourceHandler("delete_identity", this, &IdentityHandler::handleDeleteIdentity);
addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails);
addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode);
addResourceHandler("set_opinion", this, &IdentityHandler::handleSetOpinion);
} }
IdentityHandler::~IdentityHandler() IdentityHandler::~IdentityHandler()
@ -196,6 +239,7 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
<< makeKeyValueReference("gxs_id", grp.mMeta.mGroupId) << makeKeyValueReference("gxs_id", grp.mMeta.mGroupId)
<< makeKeyValueReference("pgp_id",grp.mPgpId ) << makeKeyValueReference("pgp_id",grp.mPgpId )
<< makeKeyValueReference("name", grp.mMeta.mGroupName) << makeKeyValueReference("name", grp.mMeta.mGroupName)
<< makeKeyValueReference("contact", grp.mIsAContact)
<< makeKeyValueReference("own", own) << makeKeyValueReference("own", own)
<< makeKeyValueReference("pgp_linked", pgp_linked) << makeKeyValueReference("pgp_linked", pgp_linked)
<< makeKeyValueReference("is_contact", grp.mIsAContact); << makeKeyValueReference("is_contact", grp.mIsAContact);
@ -312,6 +356,207 @@ void IdentityHandler::handleOwnIdsRequest(Request & /*req*/, Response &resp)
else resp.setFail(); else resp.setFail();
} }
void IdentityHandler::handleAddContact(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), true);
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
mStateTokenServer->replaceToken(mStateToken);
}
resp.setOk();
}
void IdentityHandler::handleRemoveContact(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), false);
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
mStateTokenServer->replaceToken(mStateToken);
}
resp.setOk();
}
void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t token;
std::list<RsGxsGroupId> groupIds;
groupIds.push_back(RsGxsGroupId(gxs_id));
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
time_t start = time(NULL);
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
&&((time(NULL) < (start+10)))
)
{
#ifdef WINDOWS_SYS
Sleep(500);
#else
usleep(500*1000);
#endif
}
RsGxsIdGroup data;
std::vector<RsGxsIdGroup> datavector;
if (!mRsIdentity->getGroupData(token, datavector))
{
resp.setFail();
return;
}
if(datavector.empty())
{
resp.setFail();
return;
}
data = datavector[0];
resp.mDataStream << makeKeyValue("gxs_name", data.mMeta.mGroupName);
resp.mDataStream << makeKeyValue("gxs_id", data.mMeta.mGroupId.toStdString());
resp.mDataStream << makeKeyValue("pgp_id_known", data.mPgpKnown);
resp.mDataStream << makeKeyValue("pgp_id", data.mPgpId.toStdString());
std::string pgp_name;
if (data.mPgpKnown)
{
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
pgp_name = details.name;
}
else
{
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)
pgp_name = "[Unknown node]";
else
pgp_name = "Anonymous Id";
}
resp.mDataStream << makeKeyValue("pgp_name", pgp_name);
resp.mDataStream << makeKeyValue("last_usage", (uint32_t)data.mLastUsageTS);
bool isAnonymous = false;
if(!data.mPgpKnown)
{
if (!(data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility))
isAnonymous = true;
}
resp.mDataStream << makeKeyValue("anonymous", isAnonymous);
bool isOwnId = (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
resp.mDataStream << makeKeyValue("own", isOwnId);
std::string type;
if(isOwnId)
{
if (data.mPgpKnown && !data.mPgpId.isNull())
type = "Identity owned by you, linked to your Retroshare node";
else
type = "Anonymous identity, owned by you";
}
else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)
{
if (data.mPgpKnown)
{
if (rsPeers->isGPGAccepted(data.mPgpId))
type = "Linked to a friend Retroshare node";
else
type = "Linked to a known Retroshare node";
}
else
type = "Linked to unknown Retroshare node";
}
else
type = "Anonymous identity";
resp.mDataStream << makeKeyValue("type", type);
resp.mDataStream << makeKeyValue("bannned_node", rsReputations->isNodeBanned(data.mPgpId));
RsReputations::ReputationInfo info;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId), data.mPgpId, info);
resp.mDataStream << makeKeyValue("friends_positive_votes", info.mFriendsPositiveVotes);
resp.mDataStream << makeKeyValue("friends_negative_votes", info.mFriendsNegativeVotes);
resp.mDataStream << makeKeyValue("overall_reputation_level", (int)info.mOverallReputationLevel);
resp.mDataStream << makeKeyValue("own_opinion", (int)info.mOwnOpinion);
RsIdentityDetails details;
mRsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId), details);
StreamBase& usagesStream = resp.mDataStream.getStreamToMember("usages");
usagesStream.getStreamToMember();
for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
{
usagesStream.getStreamToMember()
<< makeKeyValue("usage_time", (uint32_t)data.mLastUsageTS)
<< makeKeyValue("usage_service", (int)(it->first.mServiceId))
<< makeKeyValue("usage_case", (int)(it->first.mUsageCode));
}
resp.setOk();
}
void IdentityHandler::handleSetBanNode(Request& req, Response& resp)
{
std::string pgp_id;
req.mStream << makeKeyValueReference("pgp_id", pgp_id);
RsPgpId pgpId(pgp_id);
bool banned_node;
req.mStream << makeKeyValueReference("banned_node", banned_node);
rsReputations->banNode(pgpId, banned_node);
resp.setOk();
}
void IdentityHandler::handleSetOpinion(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsGxsId gxsId(gxs_id);
int own_opinion;
req.mStream << makeKeyValueReference("own_opinion", own_opinion);
RsReputations::Opinion opinion;
switch(own_opinion)
{
case 0:
opinion = RsReputations::OPINION_NEGATIVE;
break;
case 1: opinion =
RsReputations::OPINION_NEUTRAL;
break;
case 2:
opinion = RsReputations::OPINION_POSITIVE;
break;
default:
resp.setFail();
return;
}
rsReputations->setOwnOpinion(gxsId, opinion);
resp.setOk();
}
ResponseTask* IdentityHandler::handleOwn(Request & /* req */, Response &resp) ResponseTask* IdentityHandler::handleOwn(Request & /* req */, Response &resp)
{ {
StateToken state; StateToken state;
@ -375,4 +620,8 @@ void IdentityHandler::handleImportKey(Request& req, Response& resp)
resp.setFail(); resp.setFail();
} }
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& req,
Response& resp)
{ return new DeleteIdentityTask(mRsIdentity); }
} // namespace resource_api } // namespace resource_api

View File

@ -45,13 +45,20 @@ private:
void handleNotOwnIdsRequest(Request& req, Response& resp); void handleNotOwnIdsRequest(Request& req, Response& resp);
void handleOwnIdsRequest(Request& req, Response& resp); void handleOwnIdsRequest(Request& req, Response& resp);
void handlePubKey(Request& req, Response& resp);
void handleExportKey(Request& req, Response& resp); void handleExportKey(Request& req, Response& resp);
void handleImportKey(Request& req, Response& resp); void handleImportKey(Request& req, Response& resp);
void handleAddContact(Request& req, Response& resp);
void handleRemoveContact(Request& req, Response& resp);
void handleGetIdentityDetails(Request& req, Response& resp);
void handleSetBanNode(Request& req, Response& resp);
void handleSetOpinion(Request& req, Response& resp);
ResponseTask *handleOwn(Request& req, Response& resp); ResponseTask *handleOwn(Request& req, Response& resp);
ResponseTask *handleCreateIdentity(Request& req, Response& resp); ResponseTask *handleCreateIdentity(Request& req, Response& resp);
ResponseTask *handleDeleteIdentity(Request& req, Response& resp);
StateTokenServer* mStateTokenServer; StateTokenServer* mStateTokenServer;
RsNotify* mNotify; RsNotify* mNotify;

View File

@ -4,6 +4,7 @@
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <util/radix64.h> #include <util/radix64.h>
#include <retroshare/rsstatus.h> #include <retroshare/rsstatus.h>
#include <retroshare/rsiface.h>
#include <algorithm> #include <algorithm>
@ -106,6 +107,84 @@ bool peerInfoToStream(StreamBase& stream, RsPeerDetails& details, RsPeers* peers
return ok; return ok;
} }
std::string peerStateString(int peerState)
{
if (peerState & RS_PEER_STATE_CONNECTED) {
return "Connected";
} else if (peerState & RS_PEER_STATE_UNREACHABLE) {
return "Unreachable";
} else if (peerState & RS_PEER_STATE_ONLINE) {
return "Available";
} else if (peerState & RS_PEER_STATE_FRIEND) {
return "Offline";
}
return "Neighbor";
}
std::string connectStateString(RsPeerDetails &details)
{
std::string stateString;
bool isConnected = false;
switch (details.connectState) {
case 0:
stateString = peerStateString(details.state);
break;
case RS_PEER_CONNECTSTATE_TRYING_TCP:
stateString = "Trying TCP";
break;
case RS_PEER_CONNECTSTATE_TRYING_UDP:
stateString = "Trying UDP";
break;
case RS_PEER_CONNECTSTATE_CONNECTED_TCP:
stateString = "Connected: TCP";
isConnected = true;
break;
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
stateString = "Connected: UDP";
isConnected = true;
break;
case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
stateString = "Connected: Tor";
isConnected = true;
break;
case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
stateString = "Connected: I2P";
isConnected = true;
break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = "Connected: Unknown";
isConnected = true;
break;
}
if(isConnected) {
stateString += " ";
if(details.actAsServer)
stateString += "inbound connection";
else
stateString += "outbound connection";
}
if (details.connectStateString.empty() == false) {
if (stateString.empty() == false) {
stateString += ": ";
}
stateString += details.connectStateString;
}
/* HACK to display DHT Status info too */
if (details.foundDHT) {
if (stateString.empty() == false) {
stateString += ", ";
}
stateString += "DHT: Contact";
}
return stateString;
}
PeersHandler::PeersHandler(StateTokenServer* sts, RsNotify* notify, RsPeers *peers, RsMsgs* msgs): PeersHandler::PeersHandler(StateTokenServer* sts, RsNotify* notify, RsPeers *peers, RsMsgs* msgs):
mStateTokenServer(sts), mStateTokenServer(sts),
mNotify(notify), mNotify(notify),
@ -121,6 +200,8 @@ PeersHandler::PeersHandler(StateTokenServer* sts, RsNotify* notify, RsPeers *pee
addResourceHandler("set_custom_state_string", this, &PeersHandler::handleSetCustomStateString); addResourceHandler("set_custom_state_string", this, &PeersHandler::handleSetCustomStateString);
addResourceHandler("get_pgp_options", this, &PeersHandler::handleGetPGPOptions); addResourceHandler("get_pgp_options", this, &PeersHandler::handleGetPGPOptions);
addResourceHandler("set_pgp_options", this, &PeersHandler::handleSetPGPOptions); addResourceHandler("set_pgp_options", this, &PeersHandler::handleSetPGPOptions);
addResourceHandler("get_node_options", this, &PeersHandler::handleGetNodeOptions);
addResourceHandler("set_node_options", this, &PeersHandler::handleSetNodeOptions);
addResourceHandler("examine_cert", this, &PeersHandler::handleExamineCert); addResourceHandler("examine_cert", this, &PeersHandler::handleExamineCert);
} }
@ -140,6 +221,12 @@ void PeersHandler::notifyListChange(int list, int /* type */)
} }
} }
void PeersHandler::notifyPeerStatusChanged(const std::string& /*peer_id*/, uint32_t /*state*/)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
mStateTokenServer->replaceToken(mStateToken);
}
void PeersHandler::notifyPeerHasNewAvatar(std::string /*peer_id*/) void PeersHandler::notifyPeerHasNewAvatar(std::string /*peer_id*/)
{ {
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
@ -645,6 +732,123 @@ void PeersHandler::handleSetPGPOptions(Request& req, Response& resp)
resp.setOk(); resp.setOk();
} }
void PeersHandler::handleGetNodeOptions(Request& req, Response& resp)
{
std::string peer_id;
req.mStream << makeKeyValueReference("peer_id", peer_id);
RsPeerId peerId(peer_id);
RsPeerDetails detail;
if(!mRsPeers->getPeerDetails(peerId, detail))
{
resp.setFail();
return;
}
resp.mDataStream << makeKeyValue("peer_id", detail.id.toStdString());
resp.mDataStream << makeKeyValue("name", detail.name);
resp.mDataStream << makeKeyValue("location", detail.location);
resp.mDataStream << makeKeyValue("pgp_id", detail.gpg_id.toStdString());
resp.mDataStream << makeKeyValue("last_contact", detail.lastConnect);
std::string status_message = mRsMsgs->getCustomStateString(detail.id);
resp.mDataStream << makeKeyValueReference("status_message", status_message);
std::string encryption;
RsPeerCryptoParams cdet;
if(RsControl::instance()->getPeerCryptoDetails(detail.id, cdet) && cdet.connexion_state != 0)
{
encryption = cdet.cipher_version;
encryption += ": ";
encryption += cdet.cipher_name;
if(cdet.cipher_version != "TLSv1.2")
encryption += cdet.cipher_bits_1;
}
else
encryption = "Not connected";
resp.mDataStream << makeKeyValueReference("encryption", encryption);
resp.mDataStream << makeKeyValue("is_hidden_node", detail.isHiddenNode);
if (detail.isHiddenNode)
{
resp.mDataStream << makeKeyValue("local_address", detail.hiddenNodeAddress);
resp.mDataStream << makeKeyValue("local_port", (int)detail.hiddenNodePort);
resp.mDataStream << makeKeyValue("ext_address", std::string("none"));
resp.mDataStream << makeKeyValue("ext_port", 0);
resp.mDataStream << makeKeyValue("dyn_dns", std::string("none"));
}
else
{
resp.mDataStream << makeKeyValue("local_address", detail.localAddr);
resp.mDataStream << makeKeyValue("local_port", (int)detail.localPort);
resp.mDataStream << makeKeyValue("ext_address", detail.extAddr);
resp.mDataStream << makeKeyValue("ext_port", (int)detail.extPort);
resp.mDataStream << makeKeyValue("dyn_dns", detail.dyndns);
}
resp.mDataStream << makeKeyValue("connection_status", connectStateString(detail));
StreamBase& addressesStream = resp.mDataStream.getStreamToMember("ip_addresses");
// mark as list (in case list is empty)
addressesStream.getStreamToMember();
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin()); it != detail.ipAddressList.end(); ++it)
{
addressesStream.getStreamToMember() << makeKeyValue("ip_address", (*it));
}
std::string certificate = mRsPeers->GetRetroshareInvite(detail.id, false);
resp.mDataStream << makeKeyValueReference("certificate", certificate);
resp.setOk();
}
void PeersHandler::handleSetNodeOptions(Request& req, Response& resp)
{
std::string peer_id;
req.mStream << makeKeyValueReference("peer_id", peer_id);
RsPeerId peerId(peer_id);
RsPeerDetails detail;
if(!mRsPeers->getPeerDetails(peerId, detail))
{
resp.setFail();
return;
}
std::string local_address;
std::string ext_address;
std::string dyn_dns;
int local_port;
int ext_port;
req.mStream << makeKeyValueReference("local_address", local_address);
req.mStream << makeKeyValueReference("local_port", local_port);
req.mStream << makeKeyValueReference("ext_address", ext_address);
req.mStream << makeKeyValueReference("ext_port", ext_port);
req.mStream << makeKeyValueReference("dyn_dns", dyn_dns);
if(!detail.isHiddenNode)
{
if(detail.localAddr != local_address || (int)detail.localPort != local_port)
mRsPeers->setLocalAddress(peerId, local_address, local_port);
if(detail.extAddr != ext_address || (int)detail.extPort != ext_port)
mRsPeers->setExtAddress(peerId, ext_address, ext_port);
if(detail.dyndns != dyn_dns)
mRsPeers->setDynDNS(peerId, dyn_dns);
}
else
{
if(detail.hiddenNodeAddress != local_address || detail.hiddenNodePort != local_port)
rsPeers->setHiddenNode(peerId, local_address, local_port);
}
resp.setOk();
}
StateToken PeersHandler::getCurrentStateToken() StateToken PeersHandler::getCurrentStateToken()
{ {
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/

View File

@ -21,6 +21,7 @@ public:
// from NotifyClient // from NotifyClient
// note: this may get called from foreign threads // note: this may get called from foreign threads
virtual void notifyListChange(int list, int type); // friends list change virtual void notifyListChange(int list, int type); // friends list change
virtual void notifyPeerStatusChanged(const std::string& /*peer_id*/, uint32_t /*state*/);
virtual void notifyPeerHasNewAvatar(std::string /*peer_id*/); virtual void notifyPeerHasNewAvatar(std::string /*peer_id*/);
// from Tickable // from Tickable
@ -44,6 +45,9 @@ private:
void handleGetPGPOptions(Request& req, Response& resp); void handleGetPGPOptions(Request& req, Response& resp);
void handleSetPGPOptions(Request& req, Response& resp); void handleSetPGPOptions(Request& req, Response& resp);
void handleGetNodeOptions(Request& req, Response& resp);
void handleSetNodeOptions(Request& req, Response& resp);
// a helper which ensures proper mutex locking // a helper which ensures proper mutex locking
StateToken getCurrentStateToken(); StateToken getCurrentStateToken();

View File

@ -25,8 +25,8 @@ RsControlModule::RsControlModule(int argc, char **argv, StateTokenServer* sts, A
mRunState(WAITING_INIT), mRunState(WAITING_INIT),
mAutoLoginNextTime(false), mAutoLoginNextTime(false),
mWantPassword(false), mWantPassword(false),
mPassword(""), mPrevIsBad(false),
mPrevIsBad(false) mPassword("")
{ {
mStateToken = sts->getNewToken(); mStateToken = sts->getNewToken();
this->argc = argc; this->argc = argc;
@ -456,6 +456,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
// give the password to the password callback // give the password to the password callback
{ {
RsStackMutex stack(mDataMtx); // ********** LOCKED ********** RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mPassword = pgp_password;
mFixedPassword = pgp_password; mFixedPassword = pgp_password;
} }
bool ssl_ok = RsAccounts::GenerateSSLCertificate(pgp_id, "", ssl_name, "", hidden_port!=0, ssl_password, ssl_id, err_string); bool ssl_ok = RsAccounts::GenerateSSLCertificate(pgp_id, "", ssl_name, "", hidden_port!=0, ssl_password, ssl_id, err_string);

View File

@ -328,6 +328,23 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
mUpdateCounter = 0; mUpdateCounter = 0;
} }
void RsGxsNetService::getItemNames(std::map<uint8_t,std::string>& names) const
{
names.clear();
names[RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM ] = "Group Sync Request" ;
names[RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM ] = "Group Sync" ;
names[RS_PKT_SUBTYPE_NXS_SYNC_GRP_STATS_ITEM ] = "Group Stats" ;
names[RS_PKT_SUBTYPE_NXS_GRP_ITEM ] = "Group Data" ;
names[RS_PKT_SUBTYPE_NXS_ENCRYPTED_DATA_ITEM ] = "Encrypted data" ;
names[RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM ] = "Session Key" ;
names[RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM ] = "Message Sync" ;
names[RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM ] = "Message Sync Request" ;
names[RS_PKT_SUBTYPE_NXS_MSG_ITEM ] = "Message Data" ;
names[RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM ] = "Transaction" ;
names[RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM ] = "Publish key" ;
}
RsGxsNetService::~RsGxsNetService() RsGxsNetService::~RsGxsNetService()
{ {
RS_STACK_MUTEX(mNxsMutex) ; RS_STACK_MUTEX(mNxsMutex) ;

View File

@ -99,6 +99,7 @@ public:
virtual RsServiceInfo getServiceInfo() { return mServiceInfo; } virtual RsServiceInfo getServiceInfo() { return mServiceInfo; }
virtual void getItemNames(std::map<uint8_t,std::string>& names) const ;
public: public:

View File

@ -29,7 +29,9 @@
#include "serialiser/rsserviceids.h" #include "serialiser/rsserviceids.h"
#include "serialiser/rsserial.h" #include "serialiser/rsserial.h"
#include "serialiser/rsbaseserial.h" #include "serialiser/rsbaseserial.h"
#include "serialiser/rsnxsitems.h"
#include "pqi/p3cfgmgr.h" #include "pqi/p3cfgmgr.h"
#include "pqi/pqiservice.h"
/*******************************/ /*******************************/
// #define SERVICECONTROL_DEBUG 1 // #define SERVICECONTROL_DEBUG 1
@ -248,6 +250,13 @@ const RsPeerId& p3ServiceControl::getOwnId()
return mOwnPeerId; return mOwnPeerId;
} }
bool p3ServiceControl::getServiceItemNames(uint32_t serviceId,std::map<uint8_t,std::string>& names)
{
if(mServiceServer != NULL)
return mServiceServer->getServiceItemNames(serviceId,names) ;
return false ;
}
/* Interface for Services */ /* Interface for Services */
bool p3ServiceControl::registerService(const RsServiceInfo &info, bool defaultOn) bool p3ServiceControl::registerService(const RsServiceInfo &info, bool defaultOn)

View File

@ -36,6 +36,8 @@
#include "pqi/pqiservicemonitor.h" #include "pqi/pqiservicemonitor.h"
#include "pqi/p3linkmgr.h" #include "pqi/p3linkmgr.h"
class p3ServiceServer ;
class ServiceNotifications class ServiceNotifications
{ {
public: public:
@ -101,6 +103,9 @@ virtual bool updateServicePermissions(uint32_t serviceId, const RsServicePermiss
virtual void getPeersConnected(const uint32_t serviceId, std::set<RsPeerId> &peerSet); virtual void getPeersConnected(const uint32_t serviceId, std::set<RsPeerId> &peerSet);
virtual bool isPeerConnected(const uint32_t serviceId, const RsPeerId &peerId); virtual bool isPeerConnected(const uint32_t serviceId, const RsPeerId &peerId);
// Gets the list of items used by that service
virtual bool getServiceItemNames(uint32_t serviceId,std::map<uint8_t,std::string>& names) ;
/** /**
* Registration for all Services. * Registration for all Services.
*/ */
@ -132,6 +137,8 @@ virtual bool updateServicesProvided(const RsPeerId &peerId, const RsPeerServiceI
// pqiMonitor. // pqiMonitor.
virtual void statusChange(const std::list<pqipeer> &plist); virtual void statusChange(const std::list<pqipeer> &plist);
virtual void setServiceServer(p3ServiceServer *p) { mServiceServer = p ; }
protected: protected:
// configuration. // configuration.
virtual bool saveList(bool &cleanup, std::list<RsItem *>&); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
@ -196,6 +203,7 @@ bool peerHasPermissionForService_locked(const RsPeerId &peerId, uint32_t service
// Below here is saved in Configuration. // Below here is saved in Configuration.
std::map<uint32_t, RsServicePermissions> mServicePermissionMap; std::map<uint32_t, RsServicePermissions> mServicePermissionMap;
p3ServiceServer *mServiceServer ;
}; };

View File

@ -84,6 +84,21 @@ int p3ServiceServer::addService(pqiService *ts, bool defaultOn)
return 1; return 1;
} }
bool p3ServiceServer::getServiceItemNames(uint32_t service_type,std::map<uint8_t,std::string>& names)
{
RsStackMutex stack(srvMtx); /********* LOCKED *********/
std::map<uint32_t, pqiService *>::iterator it=services.find(service_type) ;
if(it != services.end())
{
it->second->getItemNames(names) ;
return true ;
}
else
return false ;
}
int p3ServiceServer::removeService(pqiService *ts) int p3ServiceServer::removeService(pqiService *ts)
{ {
RsStackMutex stack(srvMtx); /********* LOCKED *********/ RsStackMutex stack(srvMtx); /********* LOCKED *********/

View File

@ -77,6 +77,8 @@ virtual RsServiceInfo getServiceInfo() = 0;
virtual int tick() { return 0; } virtual int tick() { return 0; }
virtual void getItemNames(std::map<uint8_t,std::string>& /*names*/) const {} // This does nothing by default. Service should derive it in order to give info for the UI
private: private:
p3ServiceServerIface *mServiceServer; // const, no need for mutex. p3ServiceServerIface *mServiceServer; // const, no need for mutex.
}; };
@ -100,7 +102,7 @@ public:
virtual bool recvItem(RsRawItem *) = 0; virtual bool recvItem(RsRawItem *) = 0;
virtual bool sendItem(RsRawItem *) = 0; virtual bool sendItem(RsRawItem *) = 0;
virtual bool getServiceItemNames(uint32_t service_type,std::map<uint8_t,std::string>& names) =0;
}; };
class p3ServiceServer : public p3ServiceServerIface class p3ServiceServer : public p3ServiceServerIface
@ -114,6 +116,8 @@ int removeService(pqiService *);
bool recvItem(RsRawItem *); bool recvItem(RsRawItem *);
bool sendItem(RsRawItem *); bool sendItem(RsRawItem *);
bool getServiceItemNames(uint32_t service_type, std::map<uint8_t,std::string>& names) ;
int tick(); int tick();
public: public:

View File

@ -109,6 +109,7 @@ virtual ~RsServiceControl() { return; }
virtual bool getOwnServices(RsPeerServiceInfo &info) = 0; virtual bool getOwnServices(RsPeerServiceInfo &info) = 0;
virtual std::string getServiceName(uint32_t service_id) = 0; virtual std::string getServiceName(uint32_t service_id) = 0;
virtual bool getServiceItemNames(uint32_t service_id,std::map<uint8_t,std::string>& names) = 0;
virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0; virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0;
virtual bool getServicesProvided(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0; virtual bool getServicesProvided(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0;

View File

@ -1244,6 +1244,8 @@ int RsServer::StartupRetroShare()
pqih = new pqisslpersongrp(serviceCtrl, flags, mPeerMgr); pqih = new pqisslpersongrp(serviceCtrl, flags, mPeerMgr);
//pqih = new pqipersongrpDummy(none, flags); //pqih = new pqipersongrpDummy(none, flags);
serviceCtrl->setServiceServer(pqih) ;
/****** New Ft Server **** !!! */ /****** New Ft Server **** !!! */
ftServer *ftserver = new ftServer(mPeerMgr, serviceCtrl); ftServer *ftserver = new ftServer(mPeerMgr, serviceCtrl);
ftserver->setConfigDirectory(rsAccounts->PathAccountDirectory()); ftserver->setConfigDirectory(rsAccounts->PathAccountDirectory());

View File

@ -81,14 +81,17 @@ bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
addrinfo *info = NULL; addrinfo *info = NULL;
int res = getaddrinfo(hostname.c_str(),NULL,NULL,&info) ; int res = getaddrinfo(hostname.c_str(),NULL,NULL,&info) ;
bool ok = true;
if(res > 0 || info == NULL || info->ai_addr == NULL) if(res > 0 || info == NULL || info->ai_addr == NULL)
{ {
std::cerr << "(EE) getaddrinfo returned error " << res << " on string \"" << hostname << "\"" << std::endl; std::cerr << "(EE) getaddrinfo returned error " << res << " on string \"" << hostname << "\"" << std::endl;
returned_addr.s_addr = 0 ; returned_addr.s_addr = 0 ;
ok = false;
} }
else else
returned_addr.s_addr = ((sockaddr_in*)info->ai_addr)->sin_addr.s_addr ; returned_addr.s_addr = ((sockaddr_in*)info->ai_addr)->sin_addr.s_addr ;
if(info)
freeaddrinfo(info) ; freeaddrinfo(info) ;
#ifdef DEPRECATED_TO_REMOVE #ifdef DEPRECATED_TO_REMOVE
@ -123,7 +126,7 @@ bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
returned_addr.s_addr = *(unsigned long*) (result->h_addr); returned_addr.s_addr = *(unsigned long*) (result->h_addr);
#endif #endif
return true ; return ok;
} }
bool isValidNet(const struct in_addr *addr) bool isValidNet(const struct in_addr *addr)

View File

@ -155,7 +155,7 @@ void VOIPGUIHandler::ReceivedVoipBandwidthInfo(const RsPeerId &peer_id, int byte
#endif #endif
ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ; ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ;
if(!di) if(di)
{ {
ChatWidget *cw = di->getChatWidget(); ChatWidget *cw = di->getChatWidget();

View File

@ -180,7 +180,7 @@ ToasterItem* VOIPToasterNotify::testToasterItem(QString tag)
if (tag == "Invitation") toaster = new ToasterItem(new VOIPToasterItem(ownId, tr("Test VOIP Invitation"), VOIPToasterItem::Invitation)); if (tag == "Invitation") toaster = new ToasterItem(new VOIPToasterItem(ownId, tr("Test VOIP Invitation"), VOIPToasterItem::Invitation));
#endif #endif
if (tag == "AudioCall") toaster = new ToasterItem(new VOIPToasterItem(ownId, tr("Test VOIP Audio Call"), VOIPToasterItem::AudioCall)); if (tag == "AudioCall") toaster = new ToasterItem(new VOIPToasterItem(ownId, tr("Test VOIP Audio Call"), VOIPToasterItem::AudioCall));
if (tag == "VideoCall") toaster = new ToasterItem(new VOIPToasterItem(ownId, tr("Test VOIP Video Call"), VOIPToasterItem::VideoCall)); if (tag == "VideoCall" || toaster == NULL) toaster = new ToasterItem(new VOIPToasterItem(ownId, tr("Test VOIP Video Call"), VOIPToasterItem::VideoCall));
return toaster; return toaster;
} }

View File

@ -25,6 +25,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QGraphicsOpacityEffect> #include <QGraphicsOpacityEffect>
#include <QMessageBox> #include <QMessageBox>
#include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QTextBrowser> #include <QTextBrowser>
#include <QTimer> #include <QTimer>
@ -45,7 +46,7 @@
#include <iostream> #include <iostream>
#define IMAGE_GOOD ":/images/accepted16.png" #define IMAGE_GOOD ":/images/accepted16.png"
#define IMAGE_BAD ":/images/deletemail24.png" #define IMAGE_BAD ":/images/cancel.png"
class EntropyCollectorWidget: public QTextBrowser class EntropyCollectorWidget: public QTextBrowser
{ {
@ -133,8 +134,8 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
//ui.headerFrame->setHeaderImage(QPixmap(":/icons/svg/profile.svg")); //ui.headerFrame->setHeaderImage(QPixmap(":/icons/svg/profile.svg"));
//ui.headerFrame->setHeaderText(tr("Create a new profile")); //ui.headerFrame->setHeaderText(tr("Create a new profile"));
connect(ui.reuse_existing_node_CB, SIGNAL(clicked()), this, SLOT(switchReuseExistingNode())); connect(ui.reuse_existing_node_CB, SIGNAL(triggered()), this, SLOT(switchReuseExistingNode()));
connect(ui.adv_checkbox, SIGNAL(clicked()), this, SLOT(setupState())); connect(ui.adv_checkbox, SIGNAL(triggered()), this, SLOT(setupState()));
connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState())); connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState()));
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson())); connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
@ -173,6 +174,11 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
* mark last one as default. * mark last one as default.
*/ */
QMenu *menu = new QMenu(tr("Advanced options"));
menu->addAction(ui.adv_checkbox);
menu->addAction(ui.reuse_existing_node_CB);
ui.optionsButton->setMenu(menu);
mAllFieldsOk = false ; mAllFieldsOk = false ;
mEntropyOk = false ; mEntropyOk = false ;
@ -246,22 +252,22 @@ void GenCertDialog::setupState()
genNewGPGKey = generate_new; genNewGPGKey = generate_new;
ui.no_node_label->setVisible(false); //ui.no_node_label->setVisible(false);
setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node")); setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node"));
//ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node")); //ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node"));
ui.label_nodeType->setVisible(adv_state) ; ui.label_nodeType->setVisible(adv_state) ;
ui.nodeType_CB->setVisible(adv_state) ; ui.nodeType_CB->setVisible(adv_state) ;
ui.reuse_existing_node_CB->setVisible(adv_state) ; ui.reuse_existing_node_CB->setEnabled(adv_state) ;
ui.importIdentity_PB->setVisible(adv_state && !generate_new) ; ui.importIdentity_PB->setVisible(adv_state && !generate_new) ;
ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ; ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ;
ui.genPGPuser->setVisible(adv_state && haveGPGKeys && !generate_new) ; ui.genPGPuser->setVisible(adv_state && haveGPGKeys && !generate_new) ;
ui.genprofileinfo_label->setVisible(false); //ui.genprofileinfo_label->setVisible(false);
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\"")); //ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
ui.no_gpg_key_label->setVisible(false); //no_gpg_key_label->setVisible(false);
ui.nickname_label->setVisible(adv_state) ; ui.nickname_label->setVisible(adv_state) ;
ui.nickname_input->setVisible(adv_state) ; ui.nickname_input->setVisible(adv_state) ;
@ -269,7 +275,7 @@ void GenCertDialog::setupState()
ui.name_label->setVisible(true); ui.name_label->setVisible(true);
ui.name_input->setVisible(generate_new); ui.name_input->setVisible(generate_new);
ui.header_label->setVisible(false) ; //ui.header_label->setVisible(false) ;
ui.nickname_label->setVisible(adv_state && !mOnlyGenerateIdentity); ui.nickname_label->setVisible(adv_state && !mOnlyGenerateIdentity);
ui.nickname_input->setVisible(adv_state && !mOnlyGenerateIdentity); ui.nickname_input->setVisible(adv_state && !mOnlyGenerateIdentity);
@ -300,14 +306,16 @@ void GenCertDialog::setupState()
if(mEntropyOk && mAllFieldsOk) if(mEntropyOk && mAllFieldsOk)
{ {
ui.genButton->setEnabled(true) ; ui.genButton->setEnabled(true) ;
ui.genButton->setIcon(QIcon(IMAGE_GOOD)) ; //ui.genButton->setIcon(QIcon(IMAGE_GOOD)) ;
ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ; ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ;
ui.generate_label->setPixmap(QPixmap(IMAGE_GOOD)) ;
} }
else else
{ {
ui.genButton->setEnabled(false) ; ui.genButton->setEnabled(false) ;
ui.genButton->setIcon(QIcon(IMAGE_BAD)) ; //ui.genButton->setIcon(QIcon(IMAGE_BAD)) ;
ui.genButton->setToolTip(tr("Disabled until all fields correctly set and enough randomness collected.")) ; ui.genButton->setToolTip(tr("Disabled until all fields correctly set and enough randomness collected.")) ;
ui.generate_label->setPixmap(QPixmap(IMAGE_BAD)) ;
} }
} }
@ -495,9 +503,9 @@ void GenCertDialog::genPerson()
} }
//generate a new gpg key //generate a new gpg key
std::string err_string; std::string err_string;
ui.no_gpg_key_label->setText(tr("Generating new node key, please be patient: this process needs generating large prime numbers, and can take some minutes on slow computers. \n\nFill in your password when asked, to sign your new key.")); //_key_label->setText(tr("Generating new node key, please be patient: this process needs generating large prime numbers, and can take some minutes on slow computers. \n\nFill in your password when asked, to sign your new key."));
ui.no_gpg_key_label->show(); //ui.no_gpg_key_label->show();
ui.reuse_existing_node_CB->hide(); //ui.reuse_existing_node_CB->hide();
ui.name_label->hide(); ui.name_label->hide();
ui.name_input->hide(); ui.name_input->hide();
ui.nickname_label->hide(); ui.nickname_label->hide();
@ -514,9 +522,9 @@ void GenCertDialog::genPerson()
ui.node_input->hide(); ui.node_input->hide();
ui.genButton->hide(); ui.genButton->hide();
ui.importIdentity_PB->hide(); ui.importIdentity_PB->hide();
ui.genprofileinfo_label->hide(); //ui.genprofileinfo_label->hide();
ui.nodeType_CB->hide(); ui.nodeType_CB->hide();
ui.adv_checkbox->hide(); //ui.adv_checkbox->hide();
ui.keylength_label->hide(); ui.keylength_label->hide();
ui.keylength_comboBox->hide(); ui.keylength_comboBox->hide();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>724</width> <width>533</width>
<height>667</height> <height>544</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -54,7 +54,10 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="images.qrc">:/images/logo/logo_splash.png</pixmap> <pixmap resource="images.qrc">:/images/logo/logo_spash2.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@ -77,22 +80,13 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="adv_checkbox"> <widget class="QPushButton" name="optionsButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use this if you need to import an existing profile, if you want to generate a new node with an already existing key, or if you want to create a TOR/I2P hidden node.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>Advanced options</string> <string>Options</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="icons.qrc"> <iconset resource="icons.qrc">
<normaloff>:/icons/settings/general.svg</normaloff>:/icons/settings/general.svg</iconset> <normaloff>:/icons/svg/options.svg</normaloff>:/icons/svg/options.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -100,196 +94,47 @@
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="tristate"> <property name="default">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="StyledLabel" name="header_label"> <widget class="QFrame" name="profile_frame">
<property name="palette"> <property name="styleSheet">
<palette> <string notr="true"/>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Box</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="text"> <property name="frameShadow">
<string>You can create a new profile with this form. <enum>QFrame::Raised</enum>
Alternatively you can use an existing profile. Just uncheck &quot;Create a new profile&quot;</string>
</property> </property>
<property name="wordWrap"> <layout class="QGridLayout" name="gridLayout">
<bool>true</bool> <item row="0" column="0">
</property>
</widget>
</item>
<item>
<widget class="StyledLabel" name="genprofileinfo_label">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>You can create and run Retroshare nodes on different computers using the same profile. To do so just export the selected profile, import it on the other computer and create a new node with it.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="no_gpg_key_label">
<property name="text">
<string>It looks like no profile (PGP keys) exists. Please fill in the form below to create one, or import an existing profile.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="no_node_label">
<property name="text">
<string>No node exists for this profile.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="profilGLayout"> <layout class="QGridLayout" name="profilGLayout">
<item row="7" column="3">
<widget class="QLabel" name="password_check_LB">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="keylength_label">
<property name="text">
<string>PGP key length</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="2"> <item row="9" column="2">
<widget class="QLineEdit" name="password_input_2"> <widget class="QLineEdit" name="password_input_2">
<property name="sizePolicy"> <property name="sizePolicy">
@ -354,13 +199,6 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="3">
<widget class="QLabel" name="password_check_LB">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="18" column="2"> <item row="18" column="2">
<widget class="QProgressBar" name="entropy_bar"> <widget class="QProgressBar" name="entropy_bar">
<property name="sizePolicy"> <property name="sizePolicy">
@ -411,16 +249,6 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</item> </item>
</widget> </widget>
</item> </item>
<item row="15" column="0">
<widget class="QLabel" name="keylength_label">
<property name="text">
<string>PGP key length</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="2"> <item row="5" column="2">
<widget class="QLineEdit" name="node_input"> <widget class="QLineEdit" name="node_input">
<property name="sizePolicy"> <property name="sizePolicy">
@ -504,6 +332,9 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
<property name="toolTip"> <property name="toolTip">
<string>Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys.</string> <string>Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys.</string>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -532,19 +363,6 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="reuse_existing_node_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Re-use an existing profile</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="9" column="3"> <item row="9" column="3">
@ -706,24 +524,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="19" column="2">
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<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>
<item>
<widget class="QPushButton" name="genButton"> <widget class="QPushButton" name="genButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -731,35 +532,42 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="text"> <property name="text">
<string>Go!</string> <string>Go!</string>
</property> </property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item row="19" column="3">
<widget class="QLabel" name="go_check_LB"> <widget class="QLabel" name="generate_label">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item> </layout>
<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>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
@ -778,27 +586,33 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget> </widget>
</item> </item>
</layout> </layout>
<action name="adv_checkbox">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Advanced options</string>
</property>
</action>
<action name="reuse_existing_node_CB">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use existing node</string>
</property>
</action>
</widget> </widget>
<customwidgets>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>name_input</tabstop> <tabstop>name_input</tabstop>
<tabstop>node_input</tabstop> <tabstop>node_input</tabstop>
<tabstop>password_input</tabstop> <tabstop>password_input</tabstop>
<tabstop>password_input_2</tabstop> <tabstop>password_input_2</tabstop>
<tabstop>adv_checkbox</tabstop>
<tabstop>keylength_comboBox</tabstop> <tabstop>keylength_comboBox</tabstop>
<tabstop>exportIdentity_PB</tabstop> <tabstop>exportIdentity_PB</tabstop>
<tabstop>reuse_existing_node_CB</tabstop>
<tabstop>genPGPuser</tabstop> <tabstop>genPGPuser</tabstop>
<tabstop>hiddenaddr_input</tabstop> <tabstop>hiddenaddr_input</tabstop>
<tabstop>hiddenport_spinBox</tabstop> <tabstop>hiddenport_spinBox</tabstop>
<tabstop>genButton</tabstop>
<tabstop>importIdentity_PB</tabstop> <tabstop>importIdentity_PB</tabstop>
</tabstops> </tabstops>
<resources> <resources>

View File

@ -2409,7 +2409,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
} }
if (n_selected_items==1) if (n_selected_items==1)
QAction *action = contextMenu->addAction(QIcon(":/images/chat_24.png"),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ; contextMenu->addAction(QIcon(":/images/chat_24.png"),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
// always allow to send messages // always allow to send messages
contextMenu->addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg())); contextMenu->addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg()));

View File

@ -676,6 +676,7 @@ void MainWindow::updateTrayCombine()
} }
} }
if (notifyMenu)
notifyMenu->menuAction()->setVisible(visible); notifyMenu->menuAction()->setVisible(visible);
// update tray icon // update tray icon

View File

@ -77,6 +77,7 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
} }
} }
#endif #endif
if (source == NULL) return;
//insert retroshare links //insert retroshare links
QList<RetroShareLink> links; QList<RetroShareLink> links;

View File

@ -99,6 +99,11 @@ QString RSGraphSource::displayValue(float v) const
return QString::number(v,'f',_digits) + " " + unitName() ; return QString::number(v,'f',_digits) + " " + unitName() ;
} }
void RSGraphSource::getCumulatedValues(std::vector<float>& vals) const
{
for(std::map<std::string,float>::const_iterator it = _totals.begin();it!=_totals.end();++it)
vals.push_back(it->second) ;
}
void RSGraphSource::getCurrentValues(std::vector<QPointF>& vals) const void RSGraphSource::getCurrentValues(std::vector<QPointF>& vals) const
{ {
std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it = _points.begin(); std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it = _points.begin();
@ -108,9 +113,9 @@ void RSGraphSource::getCurrentValues(std::vector<QPointF>& vals) const
vals.push_back(QPointF( (now - it->second.back().first)/1000.0f,it->second.back().second)) ; vals.push_back(QPointF( (now - it->second.back().first)/1000.0f,it->second.back().second)) ;
} }
QString RSGraphSource::legend(int i,float v) const QString RSGraphSource::legend(int i,float v,bool show_value) const
{ {
return displayName(i) + " (" + displayValue(v) + " )"; return displayName(i) + (show_value?(" (" + displayValue(v) + ")"):"");
} }
void RSGraphSource::getDataPoints(int index,std::vector<QPointF>& pts,float filter_factor) const void RSGraphSource::getDataPoints(int index,std::vector<QPointF>& pts,float filter_factor) const
@ -209,11 +214,30 @@ void RSGraphSource::update()
} }
else else
++it ; ++it ;
updateTotals();
}
void RSGraphSource::updateTotals()
{
// now compute totals
_totals.clear();
for(std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it(_points.begin());it!=_points.end();++it)
{
float& f = _totals[it->first] ;
f = 0.0f ;
for(std::list<std::pair<qint64,float> >::const_iterator it2=it->second.begin();it2!=it->second.end();++it2)
f += (*it2).second ;
}
} }
void RSGraphSource::reset() void RSGraphSource::reset()
{ {
_points.clear(); _points.clear();
_totals.clear();
} }
void RSGraphSource::setCollectionTimeLimit(qint64 s) { _time_limit_msecs = s ; } void RSGraphSource::setCollectionTimeLimit(qint64 s) { _time_limit_msecs = s ; }
@ -630,8 +654,19 @@ void RSGraphWidget::paintLegend()
{ {
//int bottom = _rec.height(); //int bottom = _rec.height();
std::vector<QPointF> vals ; std::vector<float> vals ;
_source->getCurrentValues(vals) ;
if(_flags & RSGRAPH_FLAGS_LEGEND_CUMULATED)
_source->getCumulatedValues(vals) ;
else
{
std::vector<QPointF> cvals ;
_source->getCurrentValues(cvals) ;
for(uint32_t i=0;i<cvals.size();++i)
vals.push_back(cvals[i].y()) ;
}
int j=0; int j=0;
float FS = QFontMetricsF(font()).height(); float FS = QFontMetricsF(font()).height();
@ -640,12 +675,13 @@ void RSGraphWidget::paintLegend()
for(uint i=0;i<vals.size();++i) for(uint i=0;i<vals.size();++i)
if( _masked_entries.find(_source->displayName(i).toStdString()) == _masked_entries.end() ) if( _masked_entries.find(_source->displayName(i).toStdString()) == _masked_entries.end() )
{ {
if( _rec.width() - (vals[i].x()-0)*_time_scale < SCALE_WIDTH*fact ) // if( _rec.width() - (vals[i].x()-0)*_time_scale < SCALE_WIDTH*fact )
continue ; // continue ;
qreal paintStep = 4*fact+FS; qreal paintStep = 4*fact+FS;
qreal pos = 15*fact+j*paintStep; qreal pos = 15*fact+j*paintStep;
QString text = _source->legend(i,vals[i].y()) ;
QString text = _source->legend(i,vals[i]) ;
QPen oldPen = _painter->pen(); QPen oldPen = _painter->pen();
_painter->setPen(QPen(getColor(i), Qt::SolidLine)); _painter->setPen(QPen(getColor(i), Qt::SolidLine));

View File

@ -69,8 +69,11 @@ public:
// return the vector of last values up to date // return the vector of last values up to date
virtual void getCurrentValues(std::vector<QPointF>& vals) const ; virtual void getCurrentValues(std::vector<QPointF>& vals) const ;
// return the vector of cumulated values up to date
virtual void getCumulatedValues(std::vector<float>& vals) const;
// returns what to display in the legend. Derive this to show additional info. // returns what to display in the legend. Derive this to show additional info.
virtual QString legend(int i,float v) const ; virtual QString legend(int i, float v, bool show_value=true) const ;
// Returns the n^th interpolated value at the given time in floating point seconds backward. // Returns the n^th interpolated value at the given time in floating point seconds backward.
virtual void getDataPoints(int index, std::vector<QPointF>& pts, float filter_factor=0.0f) const ; virtual void getDataPoints(int index, std::vector<QPointF>& pts, float filter_factor=0.0f) const ;
@ -95,11 +98,13 @@ protected slots:
protected: protected:
virtual void getValues(std::map<std::string,float>& values) const = 0 ;// overload this in your own class to fill in the values you want to display. virtual void getValues(std::map<std::string,float>& values) const = 0 ;// overload this in your own class to fill in the values you want to display.
void updateTotals();
qint64 getTime() const ; // returns time in ms since RS has started qint64 getTime() const ; // returns time in ms since RS has started
// Storage of collected events. The string is any string used to represent the collected data. // Storage of collected events. The string is any string used to represent the collected data.
std::map<std::string, std::list<std::pair<qint64,float> > > _points ; std::map<std::string, std::list<std::pair<qint64,float> > > _points ;
std::map<std::string, float> _totals ;
QTimer *_timer ; QTimer *_timer ;
@ -120,6 +125,7 @@ public:
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_PLAIN = 0x0008 ;// use plain / line drawing style static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_PLAIN = 0x0008 ;// use plain / line drawing style
static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes
static const uint32_t RSGRAPH_FLAGS_LEGEND_CUMULATED = 0x0040 ;// show the total in the legend rather than current values
/** Bandwidth graph style. */ /** Bandwidth graph style. */
enum GraphStyle enum GraphStyle

View File

@ -99,7 +99,7 @@ void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWid
} }
} }
mListItem = listItem; mListItem = listItem;
if (mListItem && !mMainAction) { if (mListItem && mMainAction) {
mButtonText = mMainAction->text(); mButtonText = mMainAction->text();
} }
} }

View File

@ -0,0 +1,831 @@
/******************************************************************
Original FFT code Credits:
Copyright Takuya OOURA, 1996-2001
http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
******************************************************************/
/*
Fast Fourier/Cosine/Sine Transform
dimension :two
data length :power of 2
decimation :frequency
radix :4, 2, row-column
data :inplace
table :use
functions
cdft2d: Complex Discrete Fourier Transform
rdft2d: Real Discrete Fourier Transform
ddct2d: Discrete Cosine Transform
ddst2d: Discrete Sine Transform
function prototypes
void cdft2d(int, int, int, double **, int *, double *);
void rdft2d(int, int, int, double **, int *, double *);
void ddct2d(int, int, int, double **, double **, int *, double *);
void ddst2d(int, int, int, double **, double **, int *, double *);
-------- Complex DFT (Discrete Fourier Transform) --------
[definition]
<case1>
X[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 x[j1][j2] *
exp(2*pi*i*j1*k1/n1) *
exp(2*pi*i*j2*k2/n2), 0<=k1<n1, 0<=k2<n2
<case2>
X[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 x[j1][j2] *
exp(-2*pi*i*j1*k1/n1) *
exp(-2*pi*i*j2*k2/n2), 0<=k1<n1, 0<=k2<n2
(notes: sum_j=0^n-1 is a summation from j=0 to n-1)
[usage]
<case1>
ip[0] = 0; // first time only
cdft2d(n1, 2*n2, 1, a, ip, w);
<case2>
ip[0] = 0; // first time only
cdft2d(n1, 2*n2, -1, a, ip, w);
[parameters]
n1 :data length (int)
n1 >= 1, n1 = power of 2
2*n2 :data length (int)
n2 >= 1, n2 = power of 2
a[0...n1-1][0...2*n2-1]
:input/output data (double **)
input data
a[j1][2*j2] = Re(x[j1][j2]),
a[j1][2*j2+1] = Im(x[j1][j2]),
0<=j1<n1, 0<=j2<n2
output data
a[k1][2*k2] = Re(X[k1][k2]),
a[k1][2*k2+1] = Im(X[k1][k2]),
0<=k1<n1, 0<=k2<n2
ip[0...*]
:work area for bit reversal (int *)
length of ip >= 2+sqrt(n)
(n = max(n1, n2))
ip[0],ip[1] are pointers of the cos/sin table.
w[0...*]
:cos/sin table (double *)
length of w >= max(n1/2, n2/2)
w[],ip[] are initialized if ip[0] == 0.
[remark]
Inverse of
cdft2d(n1, 2*n2, -1, a, ip, w);
is
cdft2d(n1, 2*n2, 1, a, ip, w);
for (j1 = 0; j1 <= n1 - 1; j1++) {
for (j2 = 0; j2 <= 2 * n2 - 1; j2++) {
a[j1][j2] *= 1.0 / (n1 * n2);
}
}
*/
/* -------- initializing routines -------- */
#pragma once
#include <math.h>
class fft
{
public:
static void makewt(int nw, int *ip, double *w)
{
int nwh, j;
double delta, x, y;
ip[0] = nw;
ip[1] = 1;
if (nw > 2) {
nwh = nw >> 1;
delta = atan(1.0) / nwh;
w[0] = 1;
w[1] = 0;
w[nwh] = cos(delta * nwh);
w[nwh + 1] = w[nwh];
for (j = 2; j <= nwh - 2; j += 2) {
#ifdef __APPLE__
__sincos(delta*j,&y,&x);
#else
sincos(delta*j,&y,&x) ;
#endif
//x = cos(delta * j);
//y = sin(delta * j);
w[j] = x;
w[j + 1] = y;
w[nw - j] = y;
w[nw - j + 1] = x;
}
bitrv2(nw, ip + 2, w);
}
}
/* -------- child routines -------- */
static void bitrv2(int n, int *ip, double *a)
{
int j, j1, k, k1, l, m, m2;
double xr, xi;
ip[0] = 0;
l = n;
m = 1;
while ((m << 2) < l) {
l >>= 1;
for (j = 0; j <= m - 1; j++) {
ip[m + j] = ip[j] + l;
}
m <<= 1;
}
if ((m << 2) > l) {
for (k = 1; k <= m - 1; k++) {
for (j = 0; j <= k - 1; j++) {
j1 = (j << 1) + ip[k];
k1 = (k << 1) + ip[j];
xr = a[j1];
xi = a[j1 + 1];
a[j1] = a[k1];
a[j1 + 1] = a[k1 + 1];
a[k1] = xr;
a[k1 + 1] = xi;
}
}
} else {
m2 = m << 1;
for (k = 1; k <= m - 1; k++) {
for (j = 0; j <= k - 1; j++) {
j1 = (j << 1) + ip[k];
k1 = (k << 1) + ip[j];
xr = a[j1];
xi = a[j1 + 1];
a[j1] = a[k1];
a[j1 + 1] = a[k1 + 1];
a[k1] = xr;
a[k1 + 1] = xi;
j1 += m2;
k1 += m2;
xr = a[j1];
xi = a[j1 + 1];
a[j1] = a[k1];
a[j1 + 1] = a[k1 + 1];
a[k1] = xr;
a[k1 + 1] = xi;
}
}
}
}
static void bitrv2col(int n1, int n, int *ip, double **a)
{
int i, j, j1, k, k1, l, m, m2;
double xr, xi;
ip[0] = 0;
l = n;
m = 1;
while ((m << 2) < l) {
l >>= 1;
for (j = 0; j <= m - 1; j++) {
ip[m + j] = ip[j] + l;
}
m <<= 1;
}
if ((m << 2) > l) {
for (i = 0; i <= n1 - 1; i++) {
for (k = 1; k <= m - 1; k++) {
for (j = 0; j <= k - 1; j++) {
j1 = (j << 1) + ip[k];
k1 = (k << 1) + ip[j];
xr = a[i][j1];
xi = a[i][j1 + 1];
a[i][j1] = a[i][k1];
a[i][j1 + 1] = a[i][k1 + 1];
a[i][k1] = xr;
a[i][k1 + 1] = xi;
}
}
}
} else {
m2 = m << 1;
for (i = 0; i <= n1 - 1; i++) {
for (k = 1; k <= m - 1; k++) {
for (j = 0; j <= k - 1; j++) {
j1 = (j << 1) + ip[k];
k1 = (k << 1) + ip[j];
xr = a[i][j1];
xi = a[i][j1 + 1];
a[i][j1] = a[i][k1];
a[i][j1 + 1] = a[i][k1 + 1];
a[i][k1] = xr;
a[i][k1 + 1] = xi;
j1 += m2;
k1 += m2;
xr = a[i][j1];
xi = a[i][j1 + 1];
a[i][j1] = a[i][k1];
a[i][j1 + 1] = a[i][k1 + 1];
a[i][k1] = xr;
a[i][k1 + 1] = xi;
}
}
}
}
}
static void bitrv2row(int n, int n2, int *ip, double **a)
{
int i, j, j1, k, k1, l, m;
double xr, xi;
ip[0] = 0;
l = n;
m = 1;
while ((m << 1) < l) {
l >>= 1;
for (j = 0; j <= m - 1; j++) {
ip[m + j] = ip[j] + l;
}
m <<= 1;
}
if ((m << 1) > l) {
for (k = 1; k <= m - 1; k++) {
for (j = 0; j <= k - 1; j++) {
j1 = j + ip[k];
k1 = k + ip[j];
for (i = 0; i <= n2 - 2; i += 2) {
xr = a[j1][i];
xi = a[j1][i + 1];
a[j1][i] = a[k1][i];
a[j1][i + 1] = a[k1][i + 1];
a[k1][i] = xr;
a[k1][i + 1] = xi;
}
}
}
} else {
for (k = 1; k <= m - 1; k++) {
for (j = 0; j <= k - 1; j++) {
j1 = j + ip[k];
k1 = k + ip[j];
for (i = 0; i <= n2 - 2; i += 2) {
xr = a[j1][i];
xi = a[j1][i + 1];
a[j1][i] = a[k1][i];
a[j1][i + 1] = a[k1][i + 1];
a[k1][i] = xr;
a[k1][i + 1] = xi;
}
j1 += m;
k1 += m;
for (i = 0; i <= n2 - 2; i += 2) {
xr = a[j1][i];
xi = a[j1][i + 1];
a[j1][i] = a[k1][i];
a[j1][i + 1] = a[k1][i + 1];
a[k1][i] = xr;
a[k1][i + 1] = xi;
}
}
}
}
}
static void cftbcol(int n1, int n, double **a, double *w)
{
int i, j, j1, j2, j3, k, k1, ks, l, m;
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
for (i = 0; i <= n1 - 1; i++) {
l = 2;
while ((l << 1) < n) {
m = l << 2;
for (j = 0; j <= l - 2; j += 2) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
x0r = a[i][j] + a[i][j1];
x0i = a[i][j + 1] + a[i][j1 + 1];
x1r = a[i][j] - a[i][j1];
x1i = a[i][j + 1] - a[i][j1 + 1];
x2r = a[i][j2] + a[i][j3];
x2i = a[i][j2 + 1] + a[i][j3 + 1];
x3r = a[i][j2] - a[i][j3];
x3i = a[i][j2 + 1] - a[i][j3 + 1];
a[i][j] = x0r + x2r;
a[i][j + 1] = x0i + x2i;
a[i][j2] = x0r - x2r;
a[i][j2 + 1] = x0i - x2i;
a[i][j1] = x1r - x3i;
a[i][j1 + 1] = x1i + x3r;
a[i][j3] = x1r + x3i;
a[i][j3 + 1] = x1i - x3r;
}
if (m < n) {
wk1r = w[2];
for (j = m; j <= l + m - 2; j += 2) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
x0r = a[i][j] + a[i][j1];
x0i = a[i][j + 1] + a[i][j1 + 1];
x1r = a[i][j] - a[i][j1];
x1i = a[i][j + 1] - a[i][j1 + 1];
x2r = a[i][j2] + a[i][j3];
x2i = a[i][j2 + 1] + a[i][j3 + 1];
x3r = a[i][j2] - a[i][j3];
x3i = a[i][j2 + 1] - a[i][j3 + 1];
a[i][j] = x0r + x2r;
a[i][j + 1] = x0i + x2i;
a[i][j2] = x2i - x0i;
a[i][j2 + 1] = x0r - x2r;
x0r = x1r - x3i;
x0i = x1i + x3r;
a[i][j1] = wk1r * (x0r - x0i);
a[i][j1 + 1] = wk1r * (x0r + x0i);
x0r = x3i + x1r;
x0i = x3r - x1i;
a[i][j3] = wk1r * (x0i - x0r);
a[i][j3 + 1] = wk1r * (x0i + x0r);
}
k1 = 1;
ks = -1;
for (k = (m << 1); k <= n - m; k += m) {
k1++;
ks = -ks;
wk1r = w[k1 << 1];
wk1i = w[(k1 << 1) + 1];
wk2r = ks * w[k1];
wk2i = w[k1 + ks];
wk3r = wk1r - 2 * wk2i * wk1i;
wk3i = 2 * wk2i * wk1r - wk1i;
for (j = k; j <= l + k - 2; j += 2) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
x0r = a[i][j] + a[i][j1];
x0i = a[i][j + 1] + a[i][j1 + 1];
x1r = a[i][j] - a[i][j1];
x1i = a[i][j + 1] - a[i][j1 + 1];
x2r = a[i][j2] + a[i][j3];
x2i = a[i][j2 + 1] + a[i][j3 + 1];
x3r = a[i][j2] - a[i][j3];
x3i = a[i][j2 + 1] - a[i][j3 + 1];
a[i][j] = x0r + x2r;
a[i][j + 1] = x0i + x2i;
x0r -= x2r;
x0i -= x2i;
a[i][j2] = wk2r * x0r - wk2i * x0i;
a[i][j2 + 1] = wk2r * x0i + wk2i * x0r;
x0r = x1r - x3i;
x0i = x1i + x3r;
a[i][j1] = wk1r * x0r - wk1i * x0i;
a[i][j1 + 1] = wk1r * x0i + wk1i * x0r;
x0r = x1r + x3i;
x0i = x1i - x3r;
a[i][j3] = wk3r * x0r - wk3i * x0i;
a[i][j3 + 1] = wk3r * x0i + wk3i * x0r;
}
}
}
l = m;
}
if (l < n) {
for (j = 0; j <= l - 2; j += 2) {
j1 = j + l;
x0r = a[i][j] - a[i][j1];
x0i = a[i][j + 1] - a[i][j1 + 1];
a[i][j] += a[i][j1];
a[i][j + 1] += a[i][j1 + 1];
a[i][j1] = x0r;
a[i][j1 + 1] = x0i;
}
}
}
}
static void cftbrow(int n, int n2, double **a, double *w)
{
int i, j, j1, j2, j3, k, k1, ks, l, m;
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
l = 1;
while ((l << 1) < n) {
m = l << 2;
for (j = 0; j <= l - 1; j++) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] + a[j1][i];
x0i = a[j][i + 1] + a[j1][i + 1];
x1r = a[j][i] - a[j1][i];
x1i = a[j][i + 1] - a[j1][i + 1];
x2r = a[j2][i] + a[j3][i];
x2i = a[j2][i + 1] + a[j3][i + 1];
x3r = a[j2][i] - a[j3][i];
x3i = a[j2][i + 1] - a[j3][i + 1];
a[j][i] = x0r + x2r;
a[j][i + 1] = x0i + x2i;
a[j2][i] = x0r - x2r;
a[j2][i + 1] = x0i - x2i;
a[j1][i] = x1r - x3i;
a[j1][i + 1] = x1i + x3r;
a[j3][i] = x1r + x3i;
a[j3][i + 1] = x1i - x3r;
}
}
if (m < n) {
wk1r = w[2];
for (j = m; j <= l + m - 1; j++) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] + a[j1][i];
x0i = a[j][i + 1] + a[j1][i + 1];
x1r = a[j][i] - a[j1][i];
x1i = a[j][i + 1] - a[j1][i + 1];
x2r = a[j2][i] + a[j3][i];
x2i = a[j2][i + 1] + a[j3][i + 1];
x3r = a[j2][i] - a[j3][i];
x3i = a[j2][i + 1] - a[j3][i + 1];
a[j][i] = x0r + x2r;
a[j][i + 1] = x0i + x2i;
a[j2][i] = x2i - x0i;
a[j2][i + 1] = x0r - x2r;
x0r = x1r - x3i;
x0i = x1i + x3r;
a[j1][i] = wk1r * (x0r - x0i);
a[j1][i + 1] = wk1r * (x0r + x0i);
x0r = x3i + x1r;
x0i = x3r - x1i;
a[j3][i] = wk1r * (x0i - x0r);
a[j3][i + 1] = wk1r * (x0i + x0r);
}
}
k1 = 1;
ks = -1;
for (k = (m << 1); k <= n - m; k += m) {
k1++;
ks = -ks;
wk1r = w[k1 << 1];
wk1i = w[(k1 << 1) + 1];
wk2r = ks * w[k1];
wk2i = w[k1 + ks];
wk3r = wk1r - 2 * wk2i * wk1i;
wk3i = 2 * wk2i * wk1r - wk1i;
for (j = k; j <= l + k - 1; j++) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] + a[j1][i];
x0i = a[j][i + 1] + a[j1][i + 1];
x1r = a[j][i] - a[j1][i];
x1i = a[j][i + 1] - a[j1][i + 1];
x2r = a[j2][i] + a[j3][i];
x2i = a[j2][i + 1] + a[j3][i + 1];
x3r = a[j2][i] - a[j3][i];
x3i = a[j2][i + 1] - a[j3][i + 1];
a[j][i] = x0r + x2r;
a[j][i + 1] = x0i + x2i;
x0r -= x2r;
x0i -= x2i;
a[j2][i] = wk2r * x0r - wk2i * x0i;
a[j2][i + 1] = wk2r * x0i + wk2i * x0r;
x0r = x1r - x3i;
x0i = x1i + x3r;
a[j1][i] = wk1r * x0r - wk1i * x0i;
a[j1][i + 1] = wk1r * x0i + wk1i * x0r;
x0r = x1r + x3i;
x0i = x1i - x3r;
a[j3][i] = wk3r * x0r - wk3i * x0i;
a[j3][i + 1] = wk3r * x0i + wk3i * x0r;
}
}
}
}
l = m;
}
if (l < n) {
for (j = 0; j <= l - 1; j++) {
j1 = j + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] - a[j1][i];
x0i = a[j][i + 1] - a[j1][i + 1];
a[j][i] += a[j1][i];
a[j][i + 1] += a[j1][i + 1];
a[j1][i] = x0r;
a[j1][i + 1] = x0i;
}
}
}
}
static void cftfcol(int n1, int n, double **a, double *w)
{
int i, j, j1, j2, j3, k, k1, ks, l, m;
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
for (i = 0; i <= n1 - 1; i++) {
l = 2;
while ((l << 1) < n) {
m = l << 2;
for (j = 0; j <= l - 2; j += 2) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
x0r = a[i][j] + a[i][j1];
x0i = a[i][j + 1] + a[i][j1 + 1];
x1r = a[i][j] - a[i][j1];
x1i = a[i][j + 1] - a[i][j1 + 1];
x2r = a[i][j2] + a[i][j3];
x2i = a[i][j2 + 1] + a[i][j3 + 1];
x3r = a[i][j2] - a[i][j3];
x3i = a[i][j2 + 1] - a[i][j3 + 1];
a[i][j] = x0r + x2r;
a[i][j + 1] = x0i + x2i;
a[i][j2] = x0r - x2r;
a[i][j2 + 1] = x0i - x2i;
a[i][j1] = x1r + x3i;
a[i][j1 + 1] = x1i - x3r;
a[i][j3] = x1r - x3i;
a[i][j3 + 1] = x1i + x3r;
}
if (m < n) {
wk1r = w[2];
for (j = m; j <= l + m - 2; j += 2) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
x0r = a[i][j] + a[i][j1];
x0i = a[i][j + 1] + a[i][j1 + 1];
x1r = a[i][j] - a[i][j1];
x1i = a[i][j + 1] - a[i][j1 + 1];
x2r = a[i][j2] + a[i][j3];
x2i = a[i][j2 + 1] + a[i][j3 + 1];
x3r = a[i][j2] - a[i][j3];
x3i = a[i][j2 + 1] - a[i][j3 + 1];
a[i][j] = x0r + x2r;
a[i][j + 1] = x0i + x2i;
a[i][j2] = x0i - x2i;
a[i][j2 + 1] = x2r - x0r;
x0r = x1r + x3i;
x0i = x1i - x3r;
a[i][j1] = wk1r * (x0i + x0r);
a[i][j1 + 1] = wk1r * (x0i - x0r);
x0r = x3i - x1r;
x0i = x3r + x1i;
a[i][j3] = wk1r * (x0r + x0i);
a[i][j3 + 1] = wk1r * (x0r - x0i);
}
k1 = 1;
ks = -1;
for (k = (m << 1); k <= n - m; k += m) {
k1++;
ks = -ks;
wk1r = w[k1 << 1];
wk1i = w[(k1 << 1) + 1];
wk2r = ks * w[k1];
wk2i = w[k1 + ks];
wk3r = wk1r - 2 * wk2i * wk1i;
wk3i = 2 * wk2i * wk1r - wk1i;
for (j = k; j <= l + k - 2; j += 2) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
x0r = a[i][j] + a[i][j1];
x0i = a[i][j + 1] + a[i][j1 + 1];
x1r = a[i][j] - a[i][j1];
x1i = a[i][j + 1] - a[i][j1 + 1];
x2r = a[i][j2] + a[i][j3];
x2i = a[i][j2 + 1] + a[i][j3 + 1];
x3r = a[i][j2] - a[i][j3];
x3i = a[i][j2 + 1] - a[i][j3 + 1];
a[i][j] = x0r + x2r;
a[i][j + 1] = x0i + x2i;
x0r -= x2r;
x0i -= x2i;
a[i][j2] = wk2r * x0r + wk2i * x0i;
a[i][j2 + 1] = wk2r * x0i - wk2i * x0r;
x0r = x1r + x3i;
x0i = x1i - x3r;
a[i][j1] = wk1r * x0r + wk1i * x0i;
a[i][j1 + 1] = wk1r * x0i - wk1i * x0r;
x0r = x1r - x3i;
x0i = x1i + x3r;
a[i][j3] = wk3r * x0r + wk3i * x0i;
a[i][j3 + 1] = wk3r * x0i - wk3i * x0r;
}
}
}
l = m;
}
if (l < n) {
for (j = 0; j <= l - 2; j += 2) {
j1 = j + l;
x0r = a[i][j] - a[i][j1];
x0i = a[i][j + 1] - a[i][j1 + 1];
a[i][j] += a[i][j1];
a[i][j + 1] += a[i][j1 + 1];
a[i][j1] = x0r;
a[i][j1 + 1] = x0i;
}
}
}
}
static void cftfrow(int n, int n2, double **a, double *w)
{
int i, j, j1, j2, j3, k, k1, ks, l, m;
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
l = 1;
while ((l << 1) < n) {
m = l << 2;
for (j = 0; j <= l - 1; j++) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] + a[j1][i];
x0i = a[j][i + 1] + a[j1][i + 1];
x1r = a[j][i] - a[j1][i];
x1i = a[j][i + 1] - a[j1][i + 1];
x2r = a[j2][i] + a[j3][i];
x2i = a[j2][i + 1] + a[j3][i + 1];
x3r = a[j2][i] - a[j3][i];
x3i = a[j2][i + 1] - a[j3][i + 1];
a[j][i] = x0r + x2r;
a[j][i + 1] = x0i + x2i;
a[j2][i] = x0r - x2r;
a[j2][i + 1] = x0i - x2i;
a[j1][i] = x1r + x3i;
a[j1][i + 1] = x1i - x3r;
a[j3][i] = x1r - x3i;
a[j3][i + 1] = x1i + x3r;
}
}
if (m < n) {
wk1r = w[2];
for (j = m; j <= l + m - 1; j++) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] + a[j1][i];
x0i = a[j][i + 1] + a[j1][i + 1];
x1r = a[j][i] - a[j1][i];
x1i = a[j][i + 1] - a[j1][i + 1];
x2r = a[j2][i] + a[j3][i];
x2i = a[j2][i + 1] + a[j3][i + 1];
x3r = a[j2][i] - a[j3][i];
x3i = a[j2][i + 1] - a[j3][i + 1];
a[j][i] = x0r + x2r;
a[j][i + 1] = x0i + x2i;
a[j2][i] = x0i - x2i;
a[j2][i + 1] = x2r - x0r;
x0r = x1r + x3i;
x0i = x1i - x3r;
a[j1][i] = wk1r * (x0i + x0r);
a[j1][i + 1] = wk1r * (x0i - x0r);
x0r = x3i - x1r;
x0i = x3r + x1i;
a[j3][i] = wk1r * (x0r + x0i);
a[j3][i + 1] = wk1r * (x0r - x0i);
}
}
k1 = 1;
ks = -1;
for (k = (m << 1); k <= n - m; k += m) {
k1++;
ks = -ks;
wk1r = w[k1 << 1];
wk1i = w[(k1 << 1) + 1];
wk2r = ks * w[k1];
wk2i = w[k1 + ks];
wk3r = wk1r - 2 * wk2i * wk1i;
wk3i = 2 * wk2i * wk1r - wk1i;
for (j = k; j <= l + k - 1; j++) {
j1 = j + l;
j2 = j1 + l;
j3 = j2 + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] + a[j1][i];
x0i = a[j][i + 1] + a[j1][i + 1];
x1r = a[j][i] - a[j1][i];
x1i = a[j][i + 1] - a[j1][i + 1];
x2r = a[j2][i] + a[j3][i];
x2i = a[j2][i + 1] + a[j3][i + 1];
x3r = a[j2][i] - a[j3][i];
x3i = a[j2][i + 1] - a[j3][i + 1];
a[j][i] = x0r + x2r;
a[j][i + 1] = x0i + x2i;
x0r -= x2r;
x0i -= x2i;
a[j2][i] = wk2r * x0r + wk2i * x0i;
a[j2][i + 1] = wk2r * x0i - wk2i * x0r;
x0r = x1r + x3i;
x0i = x1i - x3r;
a[j1][i] = wk1r * x0r + wk1i * x0i;
a[j1][i + 1] = wk1r * x0i - wk1i * x0r;
x0r = x1r - x3i;
x0i = x1i + x3r;
a[j3][i] = wk3r * x0r + wk3i * x0i;
a[j3][i + 1] = wk3r * x0i - wk3i * x0r;
}
}
}
}
l = m;
}
if (l < n) {
for (j = 0; j <= l - 1; j++) {
j1 = j + l;
for (i = 0; i <= n2 - 2; i += 2) {
x0r = a[j][i] - a[j1][i];
x0i = a[j][i + 1] - a[j1][i + 1];
a[j][i] += a[j1][i];
a[j][i + 1] += a[j1][i + 1];
a[j1][i] = x0r;
a[j1][i + 1] = x0i;
}
}
}
}
static int *alloc_1d_int(int n1)
{
int *i;
i = (int *) malloc(sizeof(int) * n1);
return i;
}
static void free_1d_int(int *i) { free(i); }
static double *alloc_1d_double(int n1)
{
double *d;
d = (double *) malloc(sizeof(double) * n1);
return d;
}
static void free_1d_double(double *d) { free(d); }
static double **alloc_2d_double(int n1, int n2)
{
double **dd, *d;
int j;
dd = (double **) malloc(sizeof(double *) * n1);
d = (double *) malloc(sizeof(double) * n1 * n2);
dd[0] = d;
for (j = 1; j < n1; j++) {
dd[j] = dd[j - 1] + n2;
}
return dd;
}
static void free_2d_double(double **dd) { free(dd[0]); free(dd); }
static void cdft2d(int n1, int n2, int isgn, double **a, int *ip, double *w)
{
int n;
n = n1 << 1;
if (n < n2) {
n = n2;
}
if (n > (ip[0] << 2)) {
makewt(n >> 2, ip, w);
}
if (n2 > 4) {
bitrv2col(n1, n2, ip + 2, a);
}
if (n1 > 2) {
bitrv2row(n1, n2, ip + 2, a);
}
if (isgn < 0) {
cftfcol(n1, n2, a, w);
cftfrow(n1, n2, a, w);
} else {
cftbcol(n1, n2, a, w);
cftbrow(n1, n2, a, w);
}
}
};

View File

@ -42,6 +42,7 @@
#include "graphwidget.h" #include "graphwidget.h"
#include "edge.h" #include "edge.h"
#include "node.h" #include "node.h"
#include "fft.h"
#include <iostream> #include <iostream>
#include <QDebug> #include <QDebug>
@ -50,86 +51,9 @@
#include <math.h> #include <math.h>
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
void fourn(double data[],unsigned long nn[],unsigned long ndim,int isign)
{
int i1,i2,i3,i2rev,i3rev,ip1,ip2,ip3,ifp1,ifp2;
int ibit,idim,k1,k2,n,nprev,nrem,ntot;
double tempi,tempr;
double theta,wi,wpi,wpr,wr,wtemp;
ntot=1;
for (idim=1;idim<=(long)ndim;++idim)
ntot *= nn[idim];
nprev=1;
for (idim=ndim;idim>=1;idim--) {
n=nn[idim];
nrem=ntot/(n*nprev);
ip1=nprev << 1;
ip2=ip1*n;
ip3=ip2*nrem;
i2rev=1;
for (i2=1;i2<=ip2;i2+=ip1) {
if (i2 < i2rev) {
for (i1=i2;i1<=i2+ip1-2;i1+=2) {
for (i3=i1;i3<=ip3;i3+=ip2) {
i3rev=i2rev+i3-i2;
SWAP(data[i3],data[i3rev]);
SWAP(data[i3+1],data[i3rev+1]);
}
}
}
ibit=ip2 >> 1;
while (ibit >= ip1 && i2rev > ibit) {
i2rev -= ibit;
ibit >>= 1;
}
i2rev += ibit;
}
ifp1=ip1;
while (ifp1 < ip2) {
ifp2=ifp1 << 1;
theta=isign*6.28318530717959/(ifp2/ip1);
wtemp=sin(0.5*theta);
wpr = -2.0*wtemp*wtemp;
wpi=sin(theta);
wr=1.0;
wi=0.0;
for (i3=1;i3<=ifp1;i3+=ip1) {
for (i1=i3;i1<=i3+ip1-2;i1+=2) {
for (i2=i1;i2<=ip3;i2+=ifp2) {
k1=i2;
k2=k1+ifp1;
tempr=wr*data[k2]-wi*data[k2+1];
tempi=wr*data[k2+1]+wi*data[k2];
data[k2]=data[k1]-tempr;
data[k2+1]=data[k1+1]-tempi;
data[k1] += tempr;
data[k1+1] += tempi;
}
}
wr=(wtemp=wr)*wpr-wi*wpi+wr;
wi=wi*wpr+wtemp*wpi+wi;
}
ifp1=ifp2;
}
nprev *= n;
}
}
#undef SWAP
GraphWidget::GraphWidget(QWidget *) GraphWidget::GraphWidget(QWidget *)
: timerId(0), mIsFrozen(false) : timerId(0), mIsFrozen(false)
{ {
// QGraphicsScene *scene = new QGraphicsScene(QRectF(0,0,500,500),this);
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
// scene->clear() ;
// setScene(scene);
// scene()->setSceneRect(0, 0, width(), height());
setCacheMode(CacheBackground); setCacheMode(CacheBackground);
setViewportUpdateMode(BoundingRectViewportUpdate); setViewportUpdateMode(BoundingRectViewportUpdate);
setRenderHint(QPainter::Antialiasing); setRenderHint(QPainter::Antialiasing);
@ -142,18 +66,6 @@ GraphWidget::GraphWidget(QWidget *)
void GraphWidget::clearGraph() void GraphWidget::clearGraph()
{ {
// QGraphicsScene *scene = new QGraphicsScene(this);
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
// setScene(scene);
// scene->addItem(centerNode);
// centerNode->setPos(0, 0);
// if (oldscene != NULL)
// {
// delete oldscene;
// }
scene()->clear(); scene()->clear();
scene()->setSceneRect(0, 0, width(), height()); scene()->setSceneRect(0, 0, width(), height());
@ -229,18 +141,6 @@ void GraphWidget::itemMoved()
void GraphWidget::keyPressEvent(QKeyEvent *event) void GraphWidget::keyPressEvent(QKeyEvent *event)
{ {
switch (event->key()) { switch (event->key()) {
// case Qt::Key_Up:
// centerNode->moveBy(0, -20);
// break;
// case Qt::Key_Down:
// centerNode->moveBy(0, 20);
// break;
// case Qt::Key_Left:
// centerNode->moveBy(-20, 0);
// break;
// case Qt::Key_Right:
// centerNode->moveBy(20, 0);
// break;
case Qt::Key_Plus: case Qt::Key_Plus:
scaleView(qreal(1.2)); scaleView(qreal(1.2));
break; break;
@ -259,44 +159,62 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
} }
} }
static void convolveWithGaussian(double *forceMap,unsigned int S,int /*s*/) static void convolveWithForce(double *forceMap,unsigned int S,int /*s*/)
{ {
static double *bf = NULL ; static double **bf = NULL ;
static double **tmp = NULL ;
static int *ip = NULL ;
static double *w = NULL ;
static uint32_t last_S = 0 ;
if(bf == NULL) if(bf == NULL)
{ {
bf = new double[S*S*2] ; bf = fft::alloc_2d_double(S, 2*S);
for(unsigned int i=0;i<S;++i) for(unsigned int i=0;i<S;++i)
for(unsigned int j=0;j<S;++j) for(unsigned int j=0;j<S;++j)
{ {
int x = (i<S/2)?i:(S-i) ; int x = (i<S/2)?i:(S-i) ;
int y = (j<S/2)?j:(S-j) ; int y = (j<S/2)?j:(S-j) ;
// int l=2*(x*x+y*y);
bf[2*(i+S*j)] = log(sqrtf(0.1 + x*x+y*y)); // linear -> derivative is constant bf[i][j*2+0] = log(sqrtf(0.1 + x*x+y*y)); // linear -> derivative is constant
bf[2*(i+S*j)+1] = 0 ; bf[i][j*2+1] = 0 ;
} }
unsigned long nn[2] = {S,S}; ip = fft::alloc_1d_int(2 + (int) sqrt(S + 0.5));
fourn(&bf[-1],&nn[-1],2,1) ; w = fft::alloc_1d_double(S/2+S);
ip[0] = 0;
fft::cdft2d(S, 2*S, 1, bf, ip, w);
} }
unsigned long nn[2] = {S,S}; if(last_S != S)
fourn(&forceMap[-1],&nn[-1],2,1) ; {
if(tmp)
fft::free_2d_double(tmp) ;
tmp = fft::alloc_2d_double(S, 2*S);
last_S = S ;
}
memcpy(tmp[0],forceMap,S*S*2*sizeof(double)) ;
fft::cdft2d(S, 2*S, 1, tmp, ip, w);
for (unsigned int i=0;i<S;++i) for (unsigned int i=0;i<S;++i)
for (unsigned int j=0;j<S;++j) for (unsigned int j=0;j<S;++j)
{ {
float a = forceMap[2*(i+S*j)]*bf[2*(i+S*j)] - forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)+1] ; float a = tmp[i][2*j+0]*bf[i][2*j+0] - tmp[i][2*j+1]*bf[i][2*j+1] ;
float b = forceMap[2*(i+S*j)]*bf[2*(i+S*j)+1] + forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)] ; float b = tmp[i][2*j+0]*bf[i][2*j+1] + tmp[i][2*j+1]*bf[i][2*j+0] ;
forceMap[2*(i+S*j)] = a ; tmp[i][2*j+0] = a ;
forceMap[2*(i+S*j)+1] = b ; tmp[i][2*j+1] = b ;
} }
fourn(&forceMap[-1],&nn[-1],2,-1) ; fft::cdft2d(S, 2*S,-1, tmp, ip, w);
for(unsigned int i=0;i<S*S*2;++i) memcpy(forceMap,tmp[0],S*S*2*sizeof(double)) ;
for(uint32_t i=0;i<2*S*S;++i)
forceMap[i] /= S*S; forceMap[i] /= S*S;
} }
@ -322,7 +240,7 @@ void GraphWidget::timerEvent(QTimerEvent *event)
QRectF R(scene()->sceneRect()) ; QRectF R(scene()->sceneRect()) ;
if( (hit++ & 7) == 0) if( (hit++ & 3) == 0)
{ {
memset(forceMap,0,2*S*S*sizeof(double)) ; memset(forceMap,0,2*S*S*sizeof(double)) ;
@ -348,7 +266,7 @@ void GraphWidget::timerEvent(QTimerEvent *event)
} }
// compute convolution with 1/omega kernel. // compute convolution with 1/omega kernel.
convolveWithGaussian(forceMap,S,20) ; convolveWithForce(forceMap,S,20) ;
} }
foreach (Node *node, _nodes) foreach (Node *node, _nodes)
@ -435,43 +353,6 @@ void GraphWidget::wheelEvent(QWheelEvent *event)
scaleView(pow((double)2, -event->delta() / 240.0)); scaleView(pow((double)2, -event->delta() / 240.0));
} }
//void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
//{
// Q_UNUSED(rect);
//
// // Shadow
// QRectF sceneRect = this->sceneRect();
// QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
// QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
// if (rightShadow.intersects(rect) || rightShadow.contains(rect))
// painter->fillRect(rightShadow, Qt::darkGray);
// if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
// painter->fillRect(bottomShadow, Qt::darkGray);
//
// // Fill
// QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
// gradient.setColorAt(0, Qt::white);
// gradient.setColorAt(1, Qt::lightGray);
// painter->fillRect(rect.intersected(sceneRect), gradient);
// painter->setBrush(Qt::NoBrush);
// painter->drawRect(sceneRect);
//
// // Text
// QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
// sceneRect.width() - 4, sceneRect.height() - 4);
// QString message(tr("Click and drag the nodes around, and zoom with the mouse "
// "wheel or the '+' and '-' keys"));
//
// QFont font = painter->font();
// font.setBold(true);
// font.setPointSize(14);
// painter->setFont(font);
// painter->setPen(Qt::lightGray);
// painter->drawText(textRect.translated(2, 2), message);
// painter->setPen(Qt::black);
// painter->drawText(textRect, message);
//}
void GraphWidget::scaleView(qreal scaleFactor) void GraphWidget::scaleView(qreal scaleFactor)
{ {
qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width(); qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();

View File

@ -863,6 +863,7 @@ void GxsGroupDialog::requestGroup(const RsGxsGroupId &groupId)
std::cerr << std::endl; std::cerr << std::endl;
uint32_t token; uint32_t token;
if (mInternalTokenQueue)
mInternalTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, GXSGROUP_INTERNAL_LOADGROUP) ; mInternalTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, GXSGROUP_INTERNAL_LOADGROUP) ;
} }

View File

@ -60,6 +60,7 @@
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/mail_new.png" #define IMAGE_MESSAGE ":/images/mail_new.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png" #define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEEDIT ":/images/edit_16.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png" #define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
#define IMAGE_DOWNLOAD ":/images/start.png" #define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png" #define IMAGE_DOWNLOADALL ":/images/startall.png"
@ -485,7 +486,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
QMenu contextMnu(this); QMenu contextMnu(this);
QAction *editAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Edit"), &contextMnu); QAction *editAct = new QAction(QIcon(IMAGE_MESSAGEEDIT), tr("Edit"), &contextMnu);
connect(editAct, SIGNAL(triggered()), this, SLOT(editforummessage())); connect(editAct, SIGNAL(triggered()), this, SLOT(editforummessage()));
QAction *replyAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply"), &contextMnu); QAction *replyAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply"), &contextMnu);
@ -531,7 +532,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu); QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu);
connect(markMsgAsUnreadChildren, SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren())); connect(markMsgAsUnreadChildren, SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren()));
QAction *showinpeopleAct = new QAction(QIcon(":/images/message-mail.png"), tr("Show author in people tab"), &contextMnu); QAction *showinpeopleAct = new QAction(QIcon(":/images/info16.png"), tr("Show author in people tab"), &contextMnu);
connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab())); connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab()));
if (IS_GROUP_SUBSCRIBED(mSubscribeFlags)) { if (IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>images/logo/logo_spash2.png</file>
<file>images/network_map.png</file> <file>images/network_map.png</file>
<file>images/global_switch_on.png</file> <file>images/global_switch_on.png</file>
<file>images/global_switch_off.png</file> <file>images/global_switch_off.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 B

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -29,6 +29,7 @@
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsdht.h> #include <retroshare/rsdht.h>
#include "util/misc.h"
#include <QTimer> #include <QTimer>
@ -127,35 +128,37 @@ void RelayPage::load()
uint32_t count; uint32_t count;
uint32_t bandwidth; uint32_t bandwidth;
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, count, bandwidth); rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, count, bandwidth);
ui.noFriendSpinBox->setValue(count); whileBlocking(ui.noFriendSpinBox)->setValue(count);
ui.bandFriendSpinBox->setValue(bandwidth / 1000); whileBlocking(ui.bandFriendSpinBox)->setValue(bandwidth / 1024);
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FOF, count, bandwidth); rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FOF, count, bandwidth);
ui.noFOFSpinBox->setValue(count); whileBlocking(ui.noFOFSpinBox)->setValue(count);
ui.bandFOFSpinBox->setValue(bandwidth / 1000); whileBlocking(ui.bandFOFSpinBox)->setValue(bandwidth / 1024);
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, count, bandwidth); rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, count, bandwidth);
ui.noGeneralSpinBox->setValue(count); whileBlocking(ui.noGeneralSpinBox)->setValue(count);
ui.bandGeneralSpinBox->setValue(bandwidth / 1000); whileBlocking(ui.bandGeneralSpinBox)->setValue(bandwidth / 1024);
updateTotals();
uint32_t relayMode = rsDht->getRelayMode(); uint32_t relayMode = rsDht->getRelayMode();
if (relayMode & RSDHT_RELAY_ENABLED) if (relayMode & RSDHT_RELAY_ENABLED)
{ {
ui.enableCheckBox->setCheckState(Qt::Checked); whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Checked);
if ((relayMode & RSDHT_RELAY_MODE_MASK) == RSDHT_RELAY_MODE_OFF) if ((relayMode & RSDHT_RELAY_MODE_MASK) == RSDHT_RELAY_MODE_OFF)
{ {
ui.serverCheckBox->setCheckState(Qt::Unchecked); whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked);
} }
else else
{ {
ui.serverCheckBox->setCheckState(Qt::Checked); whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Checked);
} }
} }
else else
{ {
ui.enableCheckBox->setCheckState(Qt::Unchecked); whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Unchecked);
ui.serverCheckBox->setCheckState(Qt::Unchecked); whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked);
} }
loadServers(); loadServers();

View File

@ -107,6 +107,8 @@ void BWGraphSource::update()
// remove empty lists // remove empty lists
float duration = 0.0f;
for(std::map<std::string,std::list<std::pair<qint64,float> > >::iterator it=_points.begin();it!=_points.end();) for(std::map<std::string,std::list<std::pair<qint64,float> > >::iterator it=_points.begin();it!=_points.end();)
if(it->second.empty()) if(it->second.empty())
{ {
@ -116,7 +118,14 @@ void BWGraphSource::update()
it=tmp ; it=tmp ;
} }
else else
{
float d = it->second.back().first - it->second.front().first;
if(duration < d)
duration = d ;
++it ; ++it ;
}
// also clears history // also clears history
@ -138,11 +147,36 @@ void BWGraphSource::update()
break ; break ;
} }
// now update the totals, and possibly convert into an average if the unit requires it.
updateTotals();
if(_current_unit == UNIT_KILOBYTES)
for(std::map<std::string,float>::iterator it(_totals.begin());it!=_totals.end();++it)
it->second /= (duration/1000.0) ;
#ifdef BWGRAPH_DEBUG #ifdef BWGRAPH_DEBUG
std::cerr << "Traffic history has size " << mTrafficHistory.size() << std::endl; std::cerr << "Traffic history has size " << mTrafficHistory.size() << std::endl;
#endif #endif
} }
std::string BWGraphSource::makeSubItemName(uint16_t service_id,uint8_t sub_item_type) const
{
RsServiceInfoWithNames& s(mServiceInfoMap[service_id]) ;
if(s.item_names.empty())
return "item #"+QString("%1").arg(sub_item_type,2,16,QChar('0')).toStdString() ;
else
{
std::map<uint8_t,std::string>::const_iterator it = s.item_names.find(sub_item_type) ;
if(it == s.item_names.end())
return "item #"+QString("%1").arg(sub_item_type,2,16,QChar('0')).toStdString() + " (undocumented)";
return QString("%1").arg(sub_item_type,2,16,QChar('0')).toStdString()+": " + it->second ;
}
}
void BWGraphSource::convertTrafficClueToValues(const std::list<RSTrafficClue>& lst,std::map<std::string,float>& vals) const void BWGraphSource::convertTrafficClueToValues(const std::list<RSTrafficClue>& lst,std::map<std::string,float>& vals) const
{ {
vals.clear() ; vals.clear() ;
@ -162,7 +196,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list<RSTrafficClue>& l
for(uint32_t i=0;i<256;++i) for(uint32_t i=0;i<256;++i)
if(clue_per_sub_id[i].count > 0) if(clue_per_sub_id[i].count > 0)
vals["item #"+QString::number(i,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size):(clue_per_sub_id[i].count) ; vals[makeSubItemName(clue_per_sub_id[i].service_id,i)] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size):(clue_per_sub_id[i].count) ;
} }
break ; break ;
@ -233,11 +267,14 @@ void BWGraphSource::convertTrafficClueToValues(const std::list<RSTrafficClue>& l
for(std::list<RSTrafficClue>::const_iterator it(lst.begin());it!=lst.end();++it) for(std::list<RSTrafficClue>::const_iterator it(lst.begin());it!=lst.end();++it)
if(it->service_id == _current_selected_service) if(it->service_id == _current_selected_service)
{
clue_per_sub_id[it->service_sub_id] += *it ; clue_per_sub_id[it->service_sub_id] += *it ;
clue_per_sub_id[it->service_sub_id].service_id = it->service_id ;
}
for(uint32_t i=0;i<256;++i) for(uint32_t i=0;i<256;++i)
if(clue_per_sub_id[i].count > 0) if(clue_per_sub_id[i].count > 0)
vals["item #"+QString::number(i,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size):(clue_per_sub_id[i].count) ; vals[makeSubItemName(clue_per_sub_id[i].service_id,i)] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size):(clue_per_sub_id[i].count) ;
} }
break ; break ;
@ -297,7 +334,11 @@ BWGraphSource::BWGraphSource()
rsServiceControl->getOwnServices(rspsi) ; rsServiceControl->getOwnServices(rspsi) ;
for(std::map<uint32_t,RsServiceInfo>::const_iterator it(rspsi.mServiceList.begin());it!=rspsi.mServiceList.end();++it) for(std::map<uint32_t,RsServiceInfo>::const_iterator it(rspsi.mServiceList.begin());it!=rspsi.mServiceList.end();++it)
{
mServiceInfoMap[ (it->first >> 8) & 0xffff ] = it->second ; mServiceInfoMap[ (it->first >> 8) & 0xffff ] = it->second ;
rsServiceControl->getServiceItemNames(it->first,mServiceInfoMap[(it->first >> 8) & 0xffff].item_names) ;
}
} }
void BWGraphSource::getValues(std::map<std::string,float>& values) const void BWGraphSource::getValues(std::map<std::string,float>& values) const
@ -359,9 +400,9 @@ QString BWGraphSource::displayValue(float v) const
return QString() ; return QString() ;
} }
QString BWGraphSource::legend(int i,float v) const QString BWGraphSource::legend(int i,float v,bool show_value) const
{ {
return RSGraphSource::legend(i,v) ;//+ " Total: " + niceNumber(_total_recv) ; return RSGraphSource::legend(i,v,show_value) ;
} }
QString BWGraphSource::niceNumber(float v) const QString BWGraphSource::niceNumber(float v) const
{ {
@ -446,6 +487,7 @@ void BWGraphSource::setUnit(int unit)
recomputeCurrentCurves() ; recomputeCurrentCurves() ;
} }
void BWGraphSource::setDirection(int dir) void BWGraphSource::setDirection(int dir)
{ {
if(dir == _current_direction) if(dir == _current_direction)

View File

@ -13,6 +13,14 @@ public:
std::list<RSTrafficClue> out_rstcl ; std::list<RSTrafficClue> out_rstcl ;
std::list<RSTrafficClue> in_rstcl ; std::list<RSTrafficClue> in_rstcl ;
}; };
class RsServiceInfoWithNames: public RsServiceInfo
{
public:
RsServiceInfoWithNames(const RsServiceInfo& s) : RsServiceInfo(s) {}
RsServiceInfoWithNames(){}
std::map<uint8_t,std::string> item_names ;
};
BWGraphSource() ; BWGraphSource() ;
@ -25,7 +33,7 @@ public:
virtual void getValues(std::map<std::string,float>& values) const; virtual void getValues(std::map<std::string,float>& values) const;
virtual QString displayValue(float v) const; virtual QString displayValue(float v) const;
virtual QString legend(int i,float v) const; virtual QString legend(int i,float v,bool show_value=true) const;
virtual void update(); virtual void update();
QString unitName() const ; QString unitName() const ;
@ -45,6 +53,7 @@ public:
protected: protected:
void convertTrafficClueToValues(const std::list<RSTrafficClue> &lst, std::map<std::string, float> &vals) const; void convertTrafficClueToValues(const std::list<RSTrafficClue> &lst, std::map<std::string, float> &vals) const;
std::string makeSubItemName(uint16_t service_id,uint8_t sub_item_type) const;
void recomputeCurrentCurves() ; void recomputeCurrentCurves() ;
std::string visibleFriendName(const RsPeerId &pid) const ; std::string visibleFriendName(const RsPeerId &pid) const ;
@ -67,7 +76,7 @@ private:
std::map<RsPeerId,std::string> mVisibleFriends ; std::map<RsPeerId,std::string> mVisibleFriends ;
std::set<uint16_t> mVisibleServices ; std::set<uint16_t> mVisibleServices ;
mutable std::map<uint16_t,RsServiceInfo> mServiceInfoMap ; mutable std::map<uint16_t,RsServiceInfoWithNames> mServiceInfoMap ;
}; };
class BWGraph: public RSGraphWidget class BWGraph: public RSGraphWidget

View File

@ -28,12 +28,17 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ; ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ; ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LEGEND_CUMULATED) ;
updateUnitSelection(0);
// Setup connections // Setup connections
QObject::connect(ui.friend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateFriendSelection(int ))) ; QObject::connect(ui.friend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateFriendSelection(int ))) ;
QObject::connect(ui.updn_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateUpDownSelection(int ))) ; QObject::connect(ui.updn_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateUpDownSelection(int ))) ;
QObject::connect(ui.unit_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateUnitSelection(int ))) ; QObject::connect(ui.unit_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateUnitSelection(int ))) ;
QObject::connect(ui.service_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT(updateServiceSelection(int ))) ; QObject::connect(ui.service_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT(updateServiceSelection(int ))) ;
QObject::connect(ui.legend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateLegendType(int ))) ;
QObject::connect(ui.logScale_CB,SIGNAL( toggled(bool)),this, SLOT( toggleLogScale(bool))) ; QObject::connect(ui.logScale_CB,SIGNAL( toggled(bool)),this, SLOT( toggleLogScale(bool))) ;
// setup one timer for auto-update // setup one timer for auto-update
@ -156,6 +161,13 @@ void BandwidthStatsWidget::updateFriendSelection(int n)
ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SINGLE,ui.friend_CB->itemData(ci,Qt::UserRole).toString().toStdString()) ; ui.bwgraph_BW->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SINGLE,ui.friend_CB->itemData(ci,Qt::UserRole).toString().toStdString()) ;
} }
} }
void BandwidthStatsWidget::updateLegendType(int n)
{
if(n==0)
ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LEGEND_CUMULATED) ;
else
ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_LEGEND_CUMULATED) ;
}
void BandwidthStatsWidget::updateServiceSelection(int n) void BandwidthStatsWidget::updateServiceSelection(int n)
{ {
if(n == 0) if(n == 0)
@ -187,7 +199,13 @@ void BandwidthStatsWidget::updateUpDownSelection(int n)
void BandwidthStatsWidget::updateUnitSelection(int n) void BandwidthStatsWidget::updateUnitSelection(int n)
{ {
if(n==0) if(n==0)
{
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ; ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
else ui.legend_CB->setItemText(1,tr("Average"));
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_COUNT) ; }
else
{
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_COUNT) ;
ui.legend_CB->setItemText(1,tr("Total"));
}
} }

View File

@ -15,6 +15,7 @@ protected slots:
void updateUpDownSelection(int n); void updateUpDownSelection(int n);
void updateUnitSelection(int n); void updateUnitSelection(int n);
void toggleLogScale(bool b); void toggleLogScale(bool b);
void updateLegendType(int n);
private: private:
Ui::BwStatsWidget ui; Ui::BwStatsWidget ui;

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1128</width> <width>1148</width>
<height>385</height> <height>385</height>
</rect> </rect>
</property> </property>
@ -14,7 +14,16 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -103,6 +112,27 @@
<item> <item>
<widget class="QComboBox" name="unit_CB"/> <widget class="QComboBox" name="unit_CB"/>
</item> </item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Legend:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="legend_CB">
<item>
<property name="text">
<string>Current</string>
</property>
</item>
<item>
<property name="text">
<string>Total</string>
</property>
</item>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="logScale_CB"> <widget class="QCheckBox" name="logScale_CB">
<property name="text"> <property name="text">

View File

@ -230,12 +230,13 @@ bool RsHtml::canReplaceAnchor(QDomDocument &/*doc*/, QDomElement &/*element*/, c
case RetroShareLink::TYPE_PERSON: case RetroShareLink::TYPE_PERSON:
case RetroShareLink::TYPE_FORUM: case RetroShareLink::TYPE_FORUM:
case RetroShareLink::TYPE_CHANNEL: case RetroShareLink::TYPE_CHANNEL:
case RetroShareLink::TYPE_POSTED:
case RetroShareLink::TYPE_SEARCH: case RetroShareLink::TYPE_SEARCH:
case RetroShareLink::TYPE_MESSAGE: case RetroShareLink::TYPE_MESSAGE:
case RetroShareLink::TYPE_EXTRAFILE: case RetroShareLink::TYPE_EXTRAFILE:
case RetroShareLink::TYPE_PRIVATE_CHAT: case RetroShareLink::TYPE_PRIVATE_CHAT:
case RetroShareLink::TYPE_PUBLIC_MSG: case RetroShareLink::TYPE_PUBLIC_MSG:
case RetroShareLink::TYPE_POSTED:
case RetroShareLink::TYPE_IDENTITY:
// not yet implemented // not yet implemented
break; break;
@ -259,12 +260,13 @@ void RsHtml::anchorStylesheetForImg(QDomDocument &/*doc*/, QDomElement &/*elemen
case RetroShareLink::TYPE_PERSON: case RetroShareLink::TYPE_PERSON:
case RetroShareLink::TYPE_FORUM: case RetroShareLink::TYPE_FORUM:
case RetroShareLink::TYPE_CHANNEL: case RetroShareLink::TYPE_CHANNEL:
case RetroShareLink::TYPE_POSTED:
case RetroShareLink::TYPE_SEARCH: case RetroShareLink::TYPE_SEARCH:
case RetroShareLink::TYPE_MESSAGE: case RetroShareLink::TYPE_MESSAGE:
case RetroShareLink::TYPE_EXTRAFILE: case RetroShareLink::TYPE_EXTRAFILE:
case RetroShareLink::TYPE_PRIVATE_CHAT: case RetroShareLink::TYPE_PRIVATE_CHAT:
case RetroShareLink::TYPE_PUBLIC_MSG: case RetroShareLink::TYPE_PUBLIC_MSG:
case RetroShareLink::TYPE_POSTED:
case RetroShareLink::TYPE_IDENTITY:
// not yet implemented // not yet implemented
break; break;

View File

@ -53,6 +53,7 @@ public:
{ {
return recvItem(i); return recvItem(i);
} }
bool getServiceItemNames(uint32_t /*service_type*/, std::map<uint8_t,std::string>& /*names*/) { return false; }
private: private:
RsPeerId mPeerId; RsPeerId mPeerId;
RecvPeerItemIface* mRecvIface; RecvPeerItemIface* mRecvIface;