Merge remote-tracking branch 'g1o/android_share_intent' into qml_app_ui_aesthetic

This commit is contained in:
Angela Mazzurco 2017-07-09 13:18:12 +02:00
commit 02d4790890
62 changed files with 2294 additions and 1438 deletions

View File

@ -1,5 +1,265 @@
retroshare06 (0.6.2-1.XXXXXX~YYYYYY) YYYYYY; urgency=low retroshare06 (0.6.2-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
244e8a8 csoler Sat, 1 Jul 2017 15:29:48 +0200 fixed display of GxsTrans statistics
27774ba csoler Thu, 29 Jun 2017 22:13:04 +0200 Merge pull request #911 from csoler/v0.6-GxsTransport
b294b4b csoler Thu, 29 Jun 2017 22:11:44 +0200 changed sorting of popular forums w.r.t. time of last post rather than number of supplier friends
a864cf7 csoler Thu, 29 Jun 2017 21:12:42 +0200 Merge pull request #910 from csoler/v0.6-GxsTransport
4b94b2e csoler Thu, 29 Jun 2017 21:12:02 +0200 improved display of GxsTrans statistics
1b4e8a4 csoler Thu, 29 Jun 2017 18:38:10 +0200 Merge pull request #909 from csoler/v0.6-GxsTransport
64e3fc9 csoler Thu, 29 Jun 2017 18:37:39 +0200 fixed bug preventing correct subscribe in GxsTrans
700d114 csoler Thu, 29 Jun 2017 18:27:00 +0200 fixed bug causing failure of group autosubscribe in GxsTrans
cb31a92 csoler Thu, 29 Jun 2017 18:03:31 +0200 Merge pull request #907 from PhenomRetroShare/Add_GeneralDirectDLSetting
b4071d1 Phenom Mon, 26 Jun 2017 23:35:01 +0200 Add General Direct Download setting.
a3e8b96 csoler Thu, 29 Jun 2017 13:50:41 +0200 Merge pull request #908 from csoler/v0.6-GxsTransport
37edcc1 csoler Thu, 29 Jun 2017 13:44:40 +0200 fixed subscribe policy to GxsTrans groups as a function of last available post and group usage
dc605c0 csoler Thu, 29 Jun 2017 13:15:39 +0200 added a last modif TS in GrpNetworkStats, that is inited from network Grp statistics, and used to provide a value for unsubscribed groups
533e2a8 csoler Wed, 28 Jun 2017 23:23:27 +0200 added check to fix existing wrong storage time value in GxsTrans
f37ba83 csoler Wed, 28 Jun 2017 23:12:33 +0200 moved msg keep period settings to netService and made the initialisation obei the default settings of the service
b96effb csoler Wed, 28 Jun 2017 22:37:50 +0200 Merge pull request #895 from PhenomRetroShare/Add_HelpInRelayTab
3550971 csoler Wed, 28 Jun 2017 22:37:05 +0200 Merge pull request #902 from Emotyco/libresapi_avatar_handlers
12b5628 csoler Tue, 27 Jun 2017 22:21:35 +0200 added more debug info in GxsUtil
51c7e18 csoler Tue, 27 Jun 2017 19:56:21 +0200 added last msg time in GxsTrans stats. Added mutex to protect non atomic mPreferredGroup
579c944 csoler Sun, 25 Jun 2017 21:50:51 +0200 Merge pull request #903 from sehraf/improve-server-page
3c54beb sehraf Sun, 25 Jun 2017 19:19:07 +0200 hide hidden service port for I2P instead of just disabling it (it's not used for I2P)
e128fcb Konrad Sun, 25 Jun 2017 15:35:23 +0200 Added: Creating identity with avatar in libresapi
54166ce Konrad Sun, 25 Jun 2017 14:30:38 +0200 Added: Handling requests to set and get identity avatar
c3a78ce csoler Sat, 24 Jun 2017 13:14:24 +0200 Merge pull request #900 from csoler/v0.6-GxsTransport
8c4396c csoler Sat, 24 Jun 2017 12:54:06 +0200 Merge pull request #899 from Emotyco/libresapi_wrong_password_notification
66a9dad Konrad Sat, 24 Jun 2017 12:05:32 +0200 Fixed: Information about wrong password
2aac999 Konrad Sat, 24 Jun 2017 12:02:28 +0200 Fixed: Duplication of handler declaration
332fedd csoler Sat, 24 Jun 2017 11:38:48 +0200 fixed mismatched free/delete[] in AvatarDefs
2bb49f6 csoler Fri, 23 Jun 2017 21:58:54 +0200 Merge pull request #898 from csoler/v0.6-GxsTransport
0f99647 csoler Fri, 23 Jun 2017 21:58:17 +0200 fixed memory leak in GxsTrans
25a71c9 csoler Fri, 23 Jun 2017 21:24:37 +0200 Merge pull request #897 from PhenomRetroShare/Fix_ChannelPostButton
adfc594 Phenom Fri, 23 Jun 2017 20:33:43 +0200 Fix GxsChannelPostItem button, like "download" or "Play" never shown.
c415e11 Phenom Thu, 22 Jun 2017 18:52:03 +0200 Add help in Relay setting tab.
07ecbec csoler Thu, 22 Jun 2017 18:05:39 +0200 fixed bug in makeSourcePackage which would always grab the release branch
-- Retroshare Dev Team <contact@retroshare.net> Sat, 01 Jul 2017 16:00:00 +0100
retroshare06 (0.6.2-1.20170623.07ecbec6~precise) precise; urgency=low
c34165e csoler Wed, 21 Jun 2017 08:08:29 +0200 pushed new changelog to force update of the date...
8950acc csoler Thu, 22 Jun 2017 00:39:03 +0200 Merge pull request #892 from PhenomRetroShare/Add_MoveRelayPageToNetwork
ea8af8a Phenom Wed, 21 Jun 2017 17:57:14 +0200 Move Relay setting page to network one.
8cc82f9 csoler Wed, 21 Jun 2017 18:32:51 +0200 Merge pull request #891 from PhenomRetroShare/Fix_MessageToHeight
812e606 csoler Tue, 20 Jun 2017 23:40:58 +0200 fixed changelog for typo
1f9320c csoler Tue, 20 Jun 2017 21:17:21 +0200 updated changelog
310c848 csoler Wed, 21 Jun 2017 07:42:15 +0200 Merge pull request #890 from G10h4ck/qml_app_identity_avatar
c46c747 Phenom Wed, 21 Jun 2017 06:35:29 +0200 Fix To, Cc & Bcc height in MessageWidget.
1d03191 Gioacc Tue, 20 Jun 2017 17:16:27 +0200 Created a dedicated component for avatar image
8c62c2a Gioacc Tue, 20 Jun 2017 15:35:05 +0200 Qml app: show contact avatar in details if available
b206015 Gioacc Tue, 20 Jun 2017 15:33:28 +0200 libresapi: expose identity avatar in JSON API
0133be7 csoler Sat, 17 Jun 2017 23:07:10 +0200 Merge pull request #887 from csoler/v0.6-GxsTransport
12a4529 csoler Sat, 17 Jun 2017 23:02:28 +0200 added ifdef for comments on GxsTrans
eb4bb5b csoler Sat, 17 Jun 2017 21:42:00 +0200 fixed bug in gxs trans stats counting
43dcddc csoler Fri, 16 Jun 2017 12:37:09 +0200 Merge pull request #880 from PhenomRetroShare/Add_GxsCircleNotify
a29bc44 csoler Fri, 16 Jun 2017 12:24:45 +0200 Merge pull request #874 from G10h4ck/silent_initiate_distant_chat_api
12eed8e csoler Fri, 16 Jun 2017 12:22:57 +0200 Merge pull request #884 from sehraf/pr-fix-bob-settings
25565a7 csoler Thu, 15 Jun 2017 23:58:29 +0200 merged upstream/master
6633b04 csoler Thu, 15 Jun 2017 23:57:02 +0200 changed constants for GxsTransport anti-spam
26bb865 csoler Thu, 15 Jun 2017 19:32:31 +0200 added code to reject messages based on existing per-user statistics
65ab68b sehraf Thu, 15 Jun 2017 07:20:24 +0200 fix stop button being wrongly disabled
fe5ec8b sehraf Thu, 15 Jun 2017 07:06:52 +0200 reduce BOB log level
09ff94c csoler Wed, 14 Jun 2017 23:19:52 +0200 added new virtual method to refuse incoming msgs (similar to groups) in RsGenExchange, and used it in p3GxsTrans to refuse msgs from peers who send too much
c451d3a csoler Mon, 12 Jun 2017 22:18:34 +0200 Merge pull request #873 from RetroPooh/tunnstats
1e7feec csoler Mon, 12 Jun 2017 22:16:46 +0200 Merge pull request #882 from topcat/iss879
79825eb csoler Mon, 12 Jun 2017 20:36:02 +0200 fixed thread issue in RsGxsCleanupThread that caused random crashes
80ec9b7 Jeetu Mon, 12 Jun 2017 15:51:26 +0530 Included QStringList header in ApiServerLocal.cpp [Issue 879]
aa64c4d Phenom Tue, 30 May 2017 22:23:31 +0200 Add Circle Feed Item.
1766087 csoler Wed, 7 Jun 2017 23:10:59 +0200 fixed update notification and display in GxsTransStatistics
9853b53 csoler Wed, 7 Jun 2017 23:10:24 +0200 fixed debug output in GxsNetService
7691a8e csoler Wed, 7 Jun 2017 21:41:20 +0200 removed debug info
4cb7522 csoler Wed, 7 Jun 2017 21:41:00 +0200 added deleted gxs messages to the reject list of GxsNetService to avoid re-downloading them right away
edd82d0 Gioacc Wed, 7 Jun 2017 21:37:03 +0200 libresapi: stop assuming first chat message is own
318ea31 csoler Sat, 3 Jun 2017 10:30:22 +0200 fixed layout of GxsTrans stats
23156ab csoler Sat, 3 Jun 2017 10:30:02 +0200 fixed malloc problem when chat avatar is missing
e726bd1 csoler Wed, 7 Jun 2017 13:37:38 +0200 attempt to fix the crash in DataStore by not calling deleteMsgs directly
39f003f csoler Tue, 6 Jun 2017 22:00:08 +0200 Merge pull request #875 from csoler/v0.6-GxsTransport
528317d Gioacc Tue, 6 Jun 2017 18:57:32 +0200 libresapi: silent /chat/initiate_distant_chat
f62028b csoler Tue, 6 Jun 2017 00:15:06 +0200 moved metadata info to members of OutgoingRecord, so that the un-serialized meta is not lost when saved. Ensured backward compatibility when reloading old items.
1e652d6 csoler Mon, 5 Jun 2017 22:27:54 +0200 reduced number of calls to indicateConfigChanged(), and renamed mIngoingQueue into mIncomingQueue in GxsTrans
0098433 csoler Mon, 5 Jun 2017 21:51:59 +0200 Merge pull request #871 from Emotyco/changed_socket_path_windows
b7c09bd csoler Mon, 5 Jun 2017 21:15:42 +0200 added calls to indicateConfigChanged() to force saving GxsTrans outgoing records when updated
2d8fd07 RetroP Mon, 5 Jun 2017 14:25:09 +0300 stats tunnels rearranged columns for better readablilty
ca1dc9d Konrad Sun, 4 Jun 2017 22:10:41 +0200 Changed: Unified socket path across systems.
318b2cb csoler Sun, 4 Jun 2017 20:38:20 +0200 Merge pull request #870 from BabushkaRetroShare/master
7fb0419 Babush Sun, 4 Jun 2017 20:34:10 +0200 Typo fixes
458e180 csoler Sun, 4 Jun 2017 18:44:26 +0200 Merge pull request #869 from csoler/v0.6-GxsTransport
1967204 csoler Sun, 4 Jun 2017 18:43:12 +0200 restored GXS trans cleanign delay
831b560 csoler Sun, 4 Jun 2017 18:37:38 +0200 moved deletion of msgs in GxsTransport inside the service thread
5eaab25 csoler Sat, 3 Jun 2017 20:00:54 +0200 Merge pull request #833 from Emotyco/libresapi_network_configuration
861dab3 csoler Sat, 3 Jun 2017 13:27:21 +0200 Merge pull request #863 from G10h4ck/qmlapp_pex_alpha
e3cd3b6 csoler Fri, 2 Jun 2017 23:26:24 +0200 fixed bug causing display of null group in GxsTransportStatistics
fb7ac7a csoler Fri, 2 Jun 2017 23:10:43 +0200 fixed mismatched free/delete (free is used in rschatitems.cc to delete avatars)
efdfa46 Gioacc Fri, 2 Jun 2017 10:39:42 +0200 Merge branch 'libresapi_attempt_connection' into qmlapp_pex_alpha
8b72c9c Gioacc Fri, 2 Jun 2017 10:26:15 +0200 libresapi expose connection attempt method
8e7e700 csoler Thu, 1 Jun 2017 10:16:30 +0200 fixed compilation for windows
59b77da Gioacc Wed, 31 May 2017 12:11:15 +0200 Merge branch 'master' into qmlapp_pex_alpha
1ebcc60 csoler Tue, 30 May 2017 22:22:06 +0200 Merge pull request #861 from RetroShare/v0.6-GxsTransport
d7797f1 csoler Tue, 30 May 2017 21:42:29 +0200 Merge pull request #856 from G10h4ck/GxsTransOptionalChat
eacf23d csoler Tue, 30 May 2017 21:40:41 +0200 Merge pull request #860 from csoler/v0.6-GxsTransport
832ba69 csoler Tue, 30 May 2017 21:38:59 +0200 fixed up cleanup for GxsTransport
a7eb167 csoler Tue, 30 May 2017 20:57:20 +0200 fixed a bug in RsThread which made finished threads unaware of their state
32ad43a csoler Tue, 30 May 2017 20:46:49 +0200 Merge pull request #859 from PhenomRetroShare/Fix_StartDialogMargin
5410c51 csoler Tue, 30 May 2017 20:45:39 +0200 added cleanup thread for GxsTransport
34fbee2 Phenom Tue, 30 May 2017 20:34:12 +0200 Fix StartDialog margins.
5c71d52 Gioacc Tue, 30 May 2017 15:43:43 +0200 async chat disabled by default in GUI
f4c167c csoler Tue, 30 May 2017 13:57:11 +0200 improved display of GXS Transport stats
2e3f62a csoler Mon, 29 May 2017 23:06:31 +0200 added msg ids to GxsTransport statistics.
bd1edbc csoler Sun, 28 May 2017 22:50:34 +0200 Merge pull request #850 from csoler/v0.6-GxsTransport
0868b64 csoler Sun, 28 May 2017 22:49:07 +0200 fixed uninitialized memory read in GxsTrans msg Id
4c07050 csoler Sun, 28 May 2017 22:02:14 +0200 Merge pull request #841 from sehraf/pr-minor-fix
048045a csoler Sun, 28 May 2017 22:01:28 +0200 Merge pull request #849 from PhenomRetroShare/Fix_logo_web_nobackground
54e91e3 csoler Sun, 28 May 2017 22:00:49 +0200 Merge pull request #840 from felisucoibi/master
9121ff6 csoler Sun, 28 May 2017 21:59:48 +0200 Merge pull request #848 from PhenomRetroShare/Fix_WindowsCompil
9d2e0d7 Phenom Sun, 28 May 2017 15:19:27 +0200 Fix Appveyor
5c99297 Phenom Sun, 28 May 2017 13:19:22 +0200 Fix logo_web_nobackground
28119b5 Phenom Sun, 28 May 2017 12:57:36 +0200 Fix Windows Compilation
6d76624 csoler Sat, 27 May 2017 23:16:20 +0200 fixed uninitialized memory read in grouter
e0498ba csoler Sat, 27 May 2017 22:37:14 +0200 Merge pull request #846 from csoler/v0.6-GxsTransport
eea63ac csoler Sat, 27 May 2017 22:19:52 +0200 minor code cleaning in p3GxsTrans (struct->class for consistency, sendMail->sendData), added popularity+subscribed status display in statistics
753867e csoler Sat, 27 May 2017 15:22:32 +0200 Merge pull request #845 from csoler/v0.6-GxsTransport
6da8b2a csoler Sat, 27 May 2017 15:13:23 +0200 fixed up icons in statistics window
e06bd9b csoler Sat, 27 May 2017 14:48:08 +0200 added icon for GxsTransport
4fef4d6 csoler Sat, 27 May 2017 14:23:16 +0200 added display of the various GxsTrans groups and their respective sizes
7c43998 csoler Fri, 26 May 2017 22:04:33 +0200 Merge pull request #842 from csoler/v0.6-GxsTransport
541b42a sehraf Fri, 26 May 2017 20:29:43 +0200 minor fix
a3096f2 csoler Fri, 26 May 2017 20:28:44 +0200 added data hash to GxsTrans display
95b0273 felisu Fri, 26 May 2017 18:54:02 +0200 small fix removed ... from text login screen.
4fa6cbe csoler Fri, 26 May 2017 18:42:52 +0200 fixed display in GxsTrans stats widget
95f1719 felisu Fri, 26 May 2017 18:37:05 +0200 Changed login screen add Profile/Node text.
1e8df12 felisu Fri, 26 May 2017 18:19:06 +0200 Final step to change again size and design of start up login screen. 4/4
7281222 felisu Fri, 26 May 2017 18:15:14 +0200 Login screen 3 / 4
2dbe3a1 felisu Fri, 26 May 2017 18:13:57 +0200 Start login 2/4
0fa3b9e felisu Fri, 26 May 2017 18:12:24 +0200 smaller login screen and less blue 1
873131f csoler Thu, 25 May 2017 22:20:18 +0200 Merge pull request #836 from sehraf/pr-add-i2p-bob-v2.1
14b9a54 csoler Thu, 25 May 2017 16:56:29 +0200 added group data retrieval to GxsTransStatistics
a3ee85a sehraf Sun, 9 Oct 2016 14:32:52 +0200 Add I2P BOB support to libretroashare and RetroShare GUI
9ff81b9 csoler Tue, 23 May 2017 22:06:46 +0200 Merge pull request #835 from felisucoibi/master
483d538 defnax Tue, 23 May 2017 18:46:50 +0200 fit the background image to the login page
a136fb6 csoler Mon, 22 May 2017 23:54:55 +0200 added display of ongoing record status for GxsTrans. Unfinished.
ac66ee7 felisu Mon, 22 May 2017 15:21:06 +0200 Improved GUI gencert
9b67e93 Konrad Sun, 21 May 2017 19:51:52 +0200 Added: Network configuration to libresapi.
fbeb6ff csoler Sun, 21 May 2017 15:57:10 +0200 added infrastructure for gathering statistics about GxsTransport. Unfinished.
8c1babe csoler Sun, 21 May 2017 15:12:49 +0200 Merge pull request #832 from felisucoibi/master
2adde95 felisu Sun, 21 May 2017 15:08:07 +0200 fixed bad uploading of previous pr
dbc2396 csoler Sun, 21 May 2017 14:52:20 +0200 Merge pull request #830 from Gottox/fix-libressl
6bc72dd felisu Sun, 21 May 2017 14:51:43 +0200 restored start dialog and fixed
33ab7fa csoler Sun, 21 May 2017 14:49:13 +0200 Merge pull request #831 from Gottox/fix-musl
b341fea csoler Sun, 21 May 2017 13:49:41 +0200 merged upstream/master
a5cebb9 felisu Sun, 21 May 2017 12:35:43 +0200 simplified and upgraded gui logo added
ecf3fc5 felisu Sun, 21 May 2017 12:34:52 +0200 simplified gui
d83c42d felisu Sun, 21 May 2017 12:33:40 +0200 Add files via upload
a578acd Enno B Sun, 21 May 2017 10:54:19 +0200 fix building with musl libc
2046d9e Enno B Sun, 21 May 2017 10:48:58 +0200 fix building with libressl
95c9b37 defnax Sun, 21 May 2017 04:12:34 +0200 update background image resolution
a439fbf csoler Sat, 20 May 2017 23:01:56 +0200 fixed bug (due to new serializer) that caused a wrong hash to be computed when sending distant messages
ef59a60 csoler Sat, 20 May 2017 22:39:53 +0200 Merge pull request #828 from csoler/v0.6-EditPosts
162095b csoler Sat, 20 May 2017 22:37:31 +0200 fixed count of unread/new posts by not counting older versions
8b079f8 csoler Sat, 20 May 2017 18:34:07 +0200 Merge pull request #827 from csoler/v0.6-EditPosts
0321037 csoler Sat, 20 May 2017 18:15:57 +0200 fixed centering of comments
7a2807a defnax Sat, 20 May 2017 18:06:23 +0200 added missed icon
9da1e1c csoler Sat, 20 May 2017 17:53:25 +0200 fixed proper comment number in channels feeds
51710c1 csoler Sat, 20 May 2017 17:33:05 +0200 merge comments between channel item versions
bda7a50 defnax Sat, 20 May 2017 15:14:43 +0200 Improved look & feel for Generate and Login Window
d79c117 csoler Fri, 19 May 2017 22:12:02 +0200 Merge pull request #826 from PhenomRetroShare/Fix_ChatFontSetting
7acefda Phenom Fri, 19 May 2017 18:40:17 +0200 Fix Chat Font setting saving.
6b09fa0 csoler Thu, 18 May 2017 22:31:52 +0200 allow GxsFeedItems to have versions. Unfinished (does not compile)
db3dad3 Gioacc Thu, 18 May 2017 21:57:24 +0200 Local API binary output support + qml image example
e59366d Gioacc Wed, 17 May 2017 15:49:26 +0200 Qml app: made contact sorting case insensitive
97a0e00 Gioacc Wed, 17 May 2017 15:34:29 +0200 Qml Better debugging for token manager
c1c1d5d Gioacc Wed, 17 May 2017 15:33:10 +0200 Qml app: fixed unread messages count displaying
d5ec641 csoler Tue, 16 May 2017 19:45:27 +0200 changing background color as a function of commenter ID (needs to be further adapted to all styles)
86118d9 csoler Tue, 16 May 2017 10:26:03 +0200 Merge pull request #823 from csoler/v0.6-EditPosts
fd136c1 csoler Tue, 16 May 2017 10:24:23 +0200 made gxs comments multi-lines
b9d19c2 csoler Mon, 15 May 2017 22:17:26 +0200 Merge pull request #822 from csoler/v0.6-EditPosts
2bc36bc csoler Mon, 15 May 2017 22:13:36 +0200 properly merge new version feed items in channels when some items are already present
84e588b csoler Mon, 15 May 2017 21:37:22 +0200 switch file to REMOTE state in subfileitem if the attachment has already been checked in the past but the file is not here anymore
635918e csoler Mon, 15 May 2017 20:09:58 +0200 Merge pull request #821 from G10h4ck/v0.6-GxsTransport
de9a44f Gioacc Mon, 15 May 2017 19:16:08 +0200 Merge branch 'v0.6-GxsTransport' into qmlapp_pex_alpha
10ec527 Gioacc Mon, 15 May 2017 15:00:21 +0200 Fix GxsTrans related serialization regressions
745462a Gioacc Mon, 15 May 2017 15:05:07 +0200 Merge branch 'v0.6-GxsTransport' into qmlapp_pex_alpha
93a6b7d Gioacc Mon, 15 May 2017 15:00:21 +0200 Fix serialization regression in async chat
d335d45 thunder2 Mon, 15 May 2017 09:43:47 +0200 Fixed build script for Windows
32b7003 csoler Sun, 14 May 2017 21:44:08 +0200 Merge pull request #820 from csoler/v0.6-EditPosts
18e37de csoler Sun, 14 May 2017 21:41:26 +0200 hide download buttons when the file is local in sub file item
1824da1 csoler Sun, 14 May 2017 21:29:04 +0200 Merge pull request #819 from csoler/v0.6-EditPosts
f832f3d csoler Sun, 14 May 2017 21:26:45 +0200 added delete button to channel attached files
af57545 csoler Sun, 14 May 2017 20:59:43 +0200 removed unused button in GxsChannelPostsWidget
9077d80 csoler Sun, 14 May 2017 17:52:40 +0200 Merge pull request #817 from csoler/v0.6-EditPosts
2f43927 csoler Sat, 13 May 2017 21:13:24 +0200 Merge pull request #698 from G10h4ck/gxs_mail_experiments
c0c5cc5 csoler Sat, 13 May 2017 21:08:16 +0200 Merge branch 'master' into gxs_mail_experiments
01bb4b0 csoler Sat, 13 May 2017 20:41:56 +0200 added ifdefs around debug info and fixed a few bugs in channel post edit
6859e0d csoler Sat, 13 May 2017 17:13:05 +0200 fixed post replacement algorithm in channel editing
022c545 Gioacc Sat, 13 May 2017 12:52:45 +0200 Qml app: show contact details when avater clicked
0b82b73 Gioacc Sat, 13 May 2017 11:43:31 +0200 Qml app: fixed import/export of plain certificate
659e3c9 csoler Fri, 12 May 2017 23:55:09 +0200 merged upstream/master
305c5d6 csoler Fri, 12 May 2017 23:54:02 +0200 added collapsing of new versions of channel posts
2f17a80 defnax Fri, 12 May 2017 21:39:50 +0200 added missed icons
837fcd7 defnax Fri, 12 May 2017 18:29:39 +0200 Added Placeholder text for Password field, removed "Password:" label.
5044ac1 csoler Thu, 11 May 2017 23:44:57 +0200 moved the edit button from top bar to each channel post
5406da9 csoler Thu, 11 May 2017 23:21:13 +0200 first part of channel post editing
38d0743 csoler Thu, 11 May 2017 18:46:40 +0200 used more saturated colors in stats graph
7a19dee csoler Thu, 11 May 2017 14:52:26 +0200 small fix to statistics view
eb30af5 csoler Thu, 11 May 2017 14:42:06 +0200 improved display in bw statistics
d73e850 defnax Thu, 11 May 2017 18:14:21 +0200 look n feel improvements
7eb5e8e csoler Wed, 10 May 2017 21:37:06 +0200 added warning when switching opmode status to non turtle for the first time
1ff1b89 Phenom Sun, 7 Feb 2016 11:45:55 +0100 Save last state of OpMode status bar droplist and restore it at start.
3cc79fb csoler Wed, 10 May 2017 20:00:42 +0200 Merge pull request #774 from PhenomRetroShare/Fix_LobbyTopic
af18e4c csoler Wed, 10 May 2017 19:34:53 +0200 Merge pull request #816 from PhenomRetroShare/Fix_StartPasswordFocus
6ffae36 Phenom Wed, 10 May 2017 19:06:03 +0200 Fix Start page password focus.
11708c8 csoler Tue, 9 May 2017 22:44:00 +0200 Merge pull request #814 from csoler/v0.6-ImprovedGUI
bd9a8ae csoler Tue, 9 May 2017 22:39:15 +0200 prevent to remove old forum messages that have follow-ups.
5d7d8c0 csoler Tue, 9 May 2017 21:56:22 +0200 Merge pull request #813 from csoler/v0.6-ImprovedGUI
52a0aea csoler Tue, 9 May 2017 21:33:02 +0200 fixed bug causing edited posts to turn into missing messages when they have submessages
0edbc26 csoler Tue, 9 May 2017 19:34:48 +0200 Merge pull request #812 from PhenomRetroShare/Fix_TextColorGrayForumThread
a5386eb Phenom Tue, 9 May 2017 19:19:13 +0200 Fix text's color gray in Forum thread when selected.
0af05d2 csoler Tue, 9 May 2017 19:06:31 +0200 patch to avoid re-asking for rejected plugins when the executable is upgraded.
88525e4 csoler Tue, 9 May 2017 18:55:28 +0200 Merge pull request #811 from PhenomRetroShare/Add_OpenCertFileInHomeAddFriend
237db96 Phenom Mon, 8 May 2017 17:26:12 +0200 Add Open Cert File in Home Add Friend wizard.
34dd68d csoler Mon, 8 May 2017 23:05:16 +0200 Merge pull request #809 from csoler/v0.6-FT
e0cb0f4 csoler Mon, 8 May 2017 23:04:04 +0200 fixed previous commit
9a0df3f csoler Mon, 8 May 2017 22:21:28 +0200 Merge pull request #804 from PhenomRetroShare/Fix_Warnings
9a7f78f csoler Mon, 8 May 2017 22:18:51 +0200 Merge pull request #805 from PhenomRetroShare/Fix_Commit_#77adc82
caa36b4 csoler Mon, 8 May 2017 22:17:09 +0200 Merge pull request #807 from PhenomRetroShare/Fix_ToasterPositionSetting
d74bb2a csoler Mon, 8 May 2017 22:16:39 +0200 Merge pull request #806 from PhenomRetroShare/Fix_LobbySoundNotification
4a2f5f0 csoler Mon, 8 May 2017 22:02:38 +0200 Merge pull request #808 from csoler/v0.6-FT
8a86b9e csoler Mon, 8 May 2017 22:00:51 +0200 added a per-friend upload slots limit in FT. Default is 0=unlimited
39646f3 Gioacc Mon, 8 May 2017 20:44:15 +0200 qml app removed unused icon
d0b881f Gioacc Mon, 8 May 2017 20:35:15 +0200 Added view to show/edit contact details
52a04e1 csoler Mon, 8 May 2017 18:24:32 +0200 updated ubuntu changelog
f67617a Gioacc Mon, 8 May 2017 16:57:37 +0200 Add override and final placeolders for old GCC compatibility
d02cba5 Phenom Sun, 16 Apr 2017 17:53:37 +0200 Fix Lobby Topic not send on invite.
594ab53 Phenom Mon, 8 May 2017 15:37:18 +0200 Fix Toaster Position Setting.
a869a37 Phenom Mon, 8 May 2017 15:29:11 +0200 Fix Lobby's sound notification.
79bbe0e Phenom Mon, 8 May 2017 14:53:53 +0200 Fix Commit #77adc82
ccaf488 Gioacc Mon, 8 May 2017 13:38:29 +0200 Merge branch 'master' into qmlapp_pex_alpha
4a2f688 Phenom Mon, 8 May 2017 13:01:34 +0200 Fix Windows Compilation:
8f30634 Gioacc Mon, 8 May 2017 12:33:40 +0200 Merge branch 'gxs_mail_experiments' into qmlapp_pex_alpha
5022ef0 Phenom Mon, 8 May 2017 12:26:37 +0200 Fix Warnings: this if clause does not guard...
f352939 Phenom Mon, 8 May 2017 12:25:29 +0200 Fix Warnings:
bf47edf Phenom Mon, 8 May 2017 12:22:46 +0200 Fix Warnings:
523730f Phenom Mon, 8 May 2017 12:21:08 +0200 Fix Warnings: unused parameter resp, 'req' & 'resp'
a6acc72 Phenom Mon, 8 May 2017 12:18:51 +0200 Fix Warnings: this if clause does not guard...
58c812a Phenom Mon, 8 May 2017 12:17:01 +0200 Fix Warnings: unused parameter s
ee7e92d Phenom Mon, 8 May 2017 12:15:45 +0200 Fix Warnings: this if clause does not guard...
9b1209d Phenom Mon, 8 May 2017 12:14:04 +0200 Fix Warnings: unused parameter s & 'n'
91e3cc3 Phenom Mon, 8 May 2017 12:08:29 +0200 Fix Warnings: variable p set but not used
ca291b7 Phenom Mon, 8 May 2017 12:05:58 +0200 Fix Warnings: warning: unused variable i2d
9021609 Phenom Mon, 8 May 2017 11:55:23 +0200 Fix Warnings: unused variable p
7892004 Phenom Mon, 8 May 2017 11:53:16 +0200 Fix Warnings: unused parameter member_name
381aca4 Phenom Mon, 8 May 2017 11:49:39 +0200 Fix Warnings: unused parameter j, 'ctx' & 'name'
dd089a9 Phenom Mon, 8 May 2017 11:46:54 +0200 Fix Warnings: this if clause does not guard
5050d4f Phenom Mon, 8 May 2017 11:42:49 +0200 Fix Warnings: unused parameter indent warning: unused parameter indent [-Wunused-parameter] virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) { return out; } // derived from RsItem, but should be removed
8e9b3c9 Gioacc Mon, 8 May 2017 12:03:42 +0200 Fix missing include
add529f csoler Mon, 8 May 2017 11:41:34 +0200 Merge pull request #803 from PhenomRetroShare/Fix_UnitTest
4e2db2f Phenom Mon, 8 May 2017 11:30:54 +0200 Fix UnitTest
-- Retroshare Dev Team <contact@retroshare.net> Mon, 20 Jun 2017 22:00:00 +0100
retroshare06 (0.6.2-1.20170508.52a04e1f~precise) precise; urgency=low
9714409 csoler Mon, 8 May 2017 10:57:00 +0200 Merge pull request #802 from csoler/v0.6-ImprovedGUI 9714409 csoler Mon, 8 May 2017 10:57:00 +0200 Merge pull request #802 from csoler/v0.6-ImprovedGUI
de0f8b9 csoler Mon, 8 May 2017 10:51:15 +0200 moved passphrase box into start dialog, and removed blank logo, replaced it by RS splash logo de0f8b9 csoler Mon, 8 May 2017 10:51:15 +0200 moved passphrase box into start dialog, and removed blank logo, replaced it by RS splash logo
6cb4990 csoler Mon, 8 May 2017 10:06:40 +0200 fixed compilation with qt4 6cb4990 csoler Mon, 8 May 2017 10:06:40 +0200 fixed compilation with qt4

View File

@ -4,7 +4,7 @@
version="0.6.2" version="0.6.2"
gitpath="https://github.com/RetroShare/RetroShare.git" gitpath="https://github.com/RetroShare/RetroShare.git"
workdir=retroshare06-${version} workdir=retroshare06-${version}
branch="v0.6.2-official_release" branch="master"
#bubba3="Y" # comment out to compile for bubba3 #bubba3="Y" # comment out to compile for bubba3
###################################################### ######################################################

View File

@ -266,7 +266,8 @@ void ChatHandler::tick()
else else
{ {
LobbyParticipantsInfo& pi = mit->second; LobbyParticipantsInfo& pi = mit->second;
if(!std::equal(pi.participants.begin(), pi.participants.end(), info.gxs_ids.begin())) if(!std::equal(pi.participants.begin(), pi.participants.end(), info.gxs_ids.begin())
|| pi.participants.size() != info.gxs_ids.size())
{ {
pi.participants = info.gxs_ids; pi.participants = info.gxs_ids;
mStateTokenServer->replaceToken(pi.state_token); mStateTokenServer->replaceToken(pi.state_token);

View File

@ -87,6 +87,15 @@ protected:
<< makeKeyValueReference("name", params.nickname) << makeKeyValueReference("name", params.nickname)
<< makeKeyValueReference("pgp_linked", params.isPgpLinked); << makeKeyValueReference("pgp_linked", params.isPgpLinked);
std::string avatar;
req.mStream << makeKeyValueReference("avatar", avatar);
std::vector<uint8_t> avatar_data = Radix64::decode(avatar);
uint8_t *p_avatar_data = &avatar_data[0];
uint32_t size = avatar_data.size();
params.mImage.clear();
params.mImage.copy(p_avatar_data, size);
if(params.nickname == "") if(params.nickname == "")
{ {
resp.setFail("name can't be empty"); resp.setFail("name can't be empty");
@ -164,9 +173,6 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify,
addResourceHandler("notown_ids", this, addResourceHandler("notown_ids", this,
&IdentityHandler::handleNotOwnIdsRequest); &IdentityHandler::handleNotOwnIdsRequest);
addResourceHandler("create_identity", this,
&IdentityHandler::handleCreateIdentity);
addResourceHandler("export_key", this, &IdentityHandler::handleExportKey); addResourceHandler("export_key", this, &IdentityHandler::handleExportKey);
addResourceHandler("import_key", this, &IdentityHandler::handleImportKey); addResourceHandler("import_key", this, &IdentityHandler::handleImportKey);
@ -178,6 +184,9 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify,
addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails); addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails);
addResourceHandler("get_avatar", this, &IdentityHandler::handleGetAvatar);
addResourceHandler("set_avatar", this, &IdentityHandler::handleSetAvatar);
addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode); addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode);
addResourceHandler("set_opinion", this, &IdentityHandler::handleSetOpinion); addResourceHandler("set_opinion", this, &IdentityHandler::handleSetOpinion);
} }
@ -520,6 +529,89 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
resp.setOk(); resp.setOk();
} }
void IdentityHandler::handleSetAvatar(Request& req, Response& resp)
{
std::string gxs_id;
std::string avatar;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
req.mStream << makeKeyValueReference("avatar", avatar);
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];
if(!avatar.empty())
{
std::vector<uint8_t> avatar_data = Radix64::decode(avatar);
uint8_t *p_avatar_data = &avatar_data[0];
uint32_t size = avatar_data.size();
data.mImage.clear();
data.mImage.copy(p_avatar_data, size);
std::string base64Avatar;
Radix64::encode(data.mImage.mData, data.mImage.mSize, base64Avatar);
resp.mDataStream << makeKeyValue("avatar", base64Avatar);
}
else
data.mImage.clear();
uint32_t dummyToken = 0;
mRsIdentity->updateIdentity(dummyToken, data);
resp.setOk();
}
void IdentityHandler::handleGetAvatar(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsIdentityDetails details;
bool got = mRsIdentity->getIdDetails(RsGxsId(gxs_id), details);
std::string base64Avatar;
Radix64::encode(details.mAvatar.mData, details.mAvatar.mSize, base64Avatar);
resp.mDataStream << makeKeyValue("avatar", base64Avatar);
if(got)
resp.setOk();
else
resp.setFail();
}
void IdentityHandler::handleSetBanNode(Request& req, Response& resp) void IdentityHandler::handleSetBanNode(Request& req, Response& resp)
{ {
std::string pgp_id; std::string pgp_id;

View File

@ -53,6 +53,9 @@ private:
void handleGetIdentityDetails(Request& req, Response& resp); void handleGetIdentityDetails(Request& req, Response& resp);
void handleGetAvatar(Request& req, Response& resp);
void handleSetAvatar(Request& req, Response& resp);
void handleSetBanNode(Request& req, Response& resp); void handleSetBanNode(Request& req, Response& resp);
void handleSetOpinion(Request& req, Response& resp); void handleSetOpinion(Request& req, Response& resp);

View File

@ -26,6 +26,7 @@ RsControlModule::RsControlModule(int argc, char **argv, StateTokenServer* sts, A
mAutoLoginNextTime(false), mAutoLoginNextTime(false),
mWantPassword(false), mWantPassword(false),
mPrevIsBad(false), mPrevIsBad(false),
mCountAttempts(0),
mPassword("") mPassword("")
{ {
mStateToken = sts->getNewToken(); mStateToken = sts->getNewToken();
@ -64,7 +65,14 @@ bool RsControlModule::askForPassword(const std::string &title, const std::string
{ {
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED ********** RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mCountAttempts++;
if(mCountAttempts == 3)
{
mPrevIsBad = prev_is_bad; mPrevIsBad = prev_is_bad;
mCountAttempts = 0;
}
else
mPrevIsBad = false;
if(mFixedPassword != "") if(mFixedPassword != "")
{ {

View File

@ -78,7 +78,8 @@ private:
// to notify that a password callback is waiting // to notify that a password callback is waiting
// to answer the request, clear the flag and set the password // to answer the request, clear the flag and set the password
bool mWantPassword; bool mWantPassword;
bool mPrevIsBad ; bool mPrevIsBad;
int mCountAttempts;
std::string mTitle; std::string mTitle;
std::string mKeyName; std::string mKeyName;
std::string mPassword; std::string mPassword;

View File

@ -102,21 +102,24 @@ ftController::ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t f
: p3Config(), : p3Config(),
last_save_time(0), last_save_time(0),
last_clean_time(0), last_clean_time(0),
mSearch(NULL),
mDataplex(dm), mDataplex(dm),
mExtraList(NULL),
mTurtle(NULL), mTurtle(NULL),
mFtServer(NULL), mFtServer(NULL),
mServiceCtrl(sc), mServiceCtrl(sc),
mFtServiceType(ftServiceId), mFtServiceType(ftServiceId),
mDefaultEncryptionPolicy(RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE),
mFilePermDirectDLPolicy(RS_FILE_PERM_DIRECT_DL_PER_USER),
cnt(0),
ctrlMutex("ftController"), ctrlMutex("ftController"),
doneMutex("ftController"), doneMutex("ftController"),
mFtActive(false), mFtActive(false),
mDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE) mFtPendingDone(false),
mDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE),
_max_active_downloads(5), // default queue size
_max_uploads_per_friend(FT_FILECONTROL_MAX_UPLOAD_SLOTS_DEFAULT)
{ {
_max_active_downloads = 5 ; // default queue size
mDefaultEncryptionPolicy = RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE;
_max_uploads_per_friend = FT_FILECONTROL_MAX_UPLOAD_SLOTS_DEFAULT ;
/* TODO */
cnt = 0 ;
} }
void ftController::setTurtleRouter(p3turtle *pt) { mTurtle = pt ; } void ftController::setTurtleRouter(p3turtle *pt) { mTurtle = pt ; }
@ -278,17 +281,26 @@ void ftController::data_tick()
void ftController::searchForDirectSources() void ftController::searchForDirectSources()
{ {
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/ RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
if (!mSearch) return;
for(std::map<RsFileHash,ftFileControl*>::iterator it(mDownloads.begin()); it != mDownloads.end(); ++it) for(std::map<RsFileHash,ftFileControl*>::iterator it(mDownloads.begin()); it != mDownloads.end(); ++it )
if(it->second->mState != ftFileControl::QUEUED && it->second->mState != ftFileControl::PAUSED) if(it->second->mState != ftFileControl::QUEUED && it->second->mState != ftFileControl::PAUSED )
{ {
FileInfo info ; // info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there) FileInfo info ; // Info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there)
if(mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info)) if( mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info) )
for(std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit) for( std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit )
if(rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL) {
if(it->second->mTransfer->addFileSource(pit->peerId)) /* if the sources don't exist already - add in */ bool bAllowDirectDL = false;
setPeerState(it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mServiceCtrl->isPeerConnected(mFtServiceType, pit->peerId)); switch (rsFiles->filePermDirectDL()) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;
}
if( bAllowDirectDL )
if( it->second->mTransfer->addFileSource(pit->peerId) ) /* if the sources don't exist already - add in */
setPeerState( it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mServiceCtrl->isPeerConnected(mFtServiceType, pit->peerId) );
}
} }
} }
@ -748,6 +760,7 @@ bool ftController::completeFile(const RsFileHash& hash)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if(mExtraList)
mExtraList->addExtraFile(path, hash, size, period, extraflags); mExtraList->addExtraFile(path, hash, size, period, extraflags);
} }
else else
@ -855,6 +868,7 @@ bool ftController::alreadyHaveFile(const RsFileHash& hash, FileInfo &info)
return true ; return true ;
// check for file lists // check for file lists
if (mSearch) return false;
if (mSearch->search(hash, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info)) if (mSearch->search(hash, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info))
return true ; return true ;
@ -945,15 +959,24 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
// remove the sources from the list, if they don't have clearance for direct transfer. This happens only for non cache files. // remove the sources from the list, if they don't have clearance for direct transfer. This happens only for non cache files.
// //
for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); ) for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
if(!(rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL))
{ {
std::list<RsPeerId>::iterator tmp(it) ; bool bAllowDirectDL = false;
++tmp ; switch (rsFiles->filePermDirectDL()) {
srcIds.erase(it) ; case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
it = tmp ; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break;
}
if(!bAllowDirectDL)
{
std::list<RsPeerId>::iterator tmp(it);
++tmp;
srcIds.erase(it);
it = tmp;
} }
else else
++it ; ++it;
}
std::list<RsPeerId>::const_iterator it; std::list<RsPeerId>::const_iterator it;
std::list<TransferInfo>::const_iterator pit; std::list<TransferInfo>::const_iterator pit;
@ -1001,7 +1024,14 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
*/ */
for(it = srcIds.begin(); it != srcIds.end(); ++it) for(it = srcIds.begin(); it != srcIds.end(); ++it)
if(rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL) {
bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break;
}
if(bAllowDirectDL)
{ {
uint32_t i, j; uint32_t i, j;
if ((dit->second)->mTransfer->getPeerState(*it, i, j)) if ((dit->second)->mTransfer->getPeerState(*it, i, j))
@ -1020,6 +1050,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
(dit->second)->mTransfer->addFileSource(*it); (dit->second)->mTransfer->addFileSource(*it);
setPeerState(dit->second->mTransfer, *it, rate, mServiceCtrl->isPeerConnected(mFtServiceType, *it)); setPeerState(dit->second->mTransfer, *it, rate, mServiceCtrl->isPeerConnected(mFtServiceType, *it));
} }
}
if (srcIds.empty()) if (srcIds.empty())
{ {
@ -1034,7 +1065,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
} /******* UNLOCKED ********/ } /******* UNLOCKED ********/
if(!(flags & RS_FILE_REQ_NO_SEARCH)) if(mSearch && !(flags & RS_FILE_REQ_NO_SEARCH))
{ {
/* do a source search - for any extra sources */ /* do a source search - for any extra sources */
// add sources only in direct mode // add sources only in direct mode
@ -1056,7 +1087,14 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
#endif #endif
// Because this is auto-add, we only add sources that we allow to DL from using direct transfers. // Because this is auto-add, we only add sources that we allow to DL from using direct transfers.
if ((srcIds.end() == std::find( srcIds.begin(), srcIds.end(), pit->peerId)) && (RS_NODE_PERM_DIRECT_DL & rsPeers->servicePermissionFlags(pit->peerId))) bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;
}
if ((srcIds.end() == std::find( srcIds.begin(), srcIds.end(), pit->peerId)) && bAllowDirectDL)
{ {
srcIds.push_back(pit->peerId); srcIds.push_back(pit->peerId);
@ -1729,6 +1767,7 @@ const std::string max_uploads_per_friend_ss("MAX_UPLOADS_PER_FRIEND");
const std::string default_chunk_strategy_ss("DEFAULT_CHUNK_STRATEGY"); const std::string default_chunk_strategy_ss("DEFAULT_CHUNK_STRATEGY");
const std::string free_space_limit_ss("FREE_SPACE_LIMIT"); const std::string free_space_limit_ss("FREE_SPACE_LIMIT");
const std::string default_encryption_policy_ss("DEFAULT_ENCRYPTION_POLICY"); const std::string default_encryption_policy_ss("DEFAULT_ENCRYPTION_POLICY");
const std::string file_perm_direct_dl_ss("FILE_PERM_DIRECT_DL");
/* p3Config Interface */ /* p3Config Interface */
@ -1779,6 +1818,15 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
configMap[default_encryption_policy_ss] = (mDefaultEncryptionPolicy==RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE)?"PERMISSIVE":"STRICT" ; configMap[default_encryption_policy_ss] = (mDefaultEncryptionPolicy==RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE)?"PERMISSIVE":"STRICT" ;
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: configMap[file_perm_direct_dl_ss] = "YES" ;
break;
case RS_FILE_PERM_DIRECT_DL_NO: configMap[file_perm_direct_dl_ss] = "NO" ;
break;
default: configMap[file_perm_direct_dl_ss] = "PER_USER" ;
break;
}
rs_sprintf(s, "%lu", RsDiscSpace::freeSpaceLimit()); rs_sprintf(s, "%lu", RsDiscSpace::freeSpaceLimit());
configMap[free_space_limit_ss] = s ; configMap[free_space_limit_ss] = s ;
@ -1995,9 +2043,9 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
{ {
std::map<std::string, std::string>::iterator mit; std::map<std::string, std::string>::iterator mit;
std::string str_true("true"); //std::string str_true("true");
std::string empty(""); //std::string empty("");
std::string dir = "notempty"; //std::string dir = "notempty";
if (configMap.end() != (mit = configMap.find(download_dir_ss))) if (configMap.end() != (mit = configMap.find(download_dir_ss)))
setDownloadDirectory(mit->second); setDownloadDirectory(mit->second);
@ -2072,6 +2120,26 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
_max_uploads_per_friend = n ; _max_uploads_per_friend = n ;
} }
} }
if(configMap.end() != (mit = configMap.find(file_perm_direct_dl_ss)))
{
if(mit->second == "YES")
{
mFilePermDirectDLPolicy = RS_FILE_PERM_DIRECT_DL_YES ;
std::cerr << "Note: loading default value for file permission direct download: YES" << std::endl;
}
else if(mit->second == "NO")
{
mFilePermDirectDLPolicy = RS_FILE_PERM_DIRECT_DL_NO ;
std::cerr << "Note: loading default value for file permission direct download: NO" << std::endl;
}
else if(mit->second == "PER_USER")
{
mFilePermDirectDLPolicy = RS_FILE_PERM_DIRECT_DL_PER_USER ;
std::cerr << "Note: loading default value for file permission direct download: PER_USER" << std::endl;
}
}
return true; return true;
} }
@ -2097,6 +2165,22 @@ uint32_t ftController::defaultEncryptionPolicy()
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/ RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
return mDefaultEncryptionPolicy ; return mDefaultEncryptionPolicy ;
} }
void ftController::setFilePermDirectDL(uint32_t perm)
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
if (mFilePermDirectDLPolicy != perm)
{
mFilePermDirectDLPolicy = perm;
IndicateConfigChanged();
}
}
uint32_t ftController::filePermDirectDL()
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
return mFilePermDirectDLPolicy;
}
void ftController::setFreeDiskSpaceLimit(uint32_t size_in_mb) void ftController::setFreeDiskSpaceLimit(uint32_t size_in_mb)
{ {
RsDiscSpace::setFreeSpaceLimit(size_in_mb) ; RsDiscSpace::setFreeSpaceLimit(size_in_mb) ;

View File

@ -149,6 +149,9 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
void setMaxUploadsPerFriend(uint32_t m) ; void setMaxUploadsPerFriend(uint32_t m) ;
uint32_t getMaxUploadsPerFriend() ; uint32_t getMaxUploadsPerFriend() ;
void setFilePermDirectDL(uint32_t perm) ;
uint32_t filePermDirectDL() ;
bool FileCancel(const RsFileHash& hash); bool FileCancel(const RsFileHash& hash);
bool FileControl(const RsFileHash& hash, uint32_t flags); bool FileControl(const RsFileHash& hash, uint32_t flags);
bool FileClearCompleted(); bool FileClearCompleted();
@ -237,7 +240,8 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
ftServer *mFtServer ; ftServer *mFtServer ;
p3ServiceControl *mServiceCtrl; p3ServiceControl *mServiceCtrl;
uint32_t mFtServiceType; uint32_t mFtServiceType;
uint32_t mDefaultEncryptionPolicy ; uint32_t mDefaultEncryptionPolicy;
uint32_t mFilePermDirectDLPolicy;
uint32_t cnt ; uint32_t cnt ;
RsMutex ctrlMutex; RsMutex ctrlMutex;

View File

@ -291,18 +291,28 @@ bool ftServer::activateTunnels(const RsFileHash& hash,uint32_t encryption_policy
return true ; return true ;
} }
bool ftServer::setDestinationName(const RsFileHash& hash,const std::string& name)
{
return mFtController->setDestinationName(hash,name);
}
bool ftServer::setDestinationDirectory(const RsFileHash& hash,const std::string& directory) bool ftServer::setDestinationDirectory(const RsFileHash& hash,const std::string& directory)
{ {
return mFtController->setDestinationDirectory(hash,directory); return mFtController->setDestinationDirectory(hash,directory);
} }
bool ftServer::setDestinationName(const RsFileHash& hash,const std::string& name)
{
return mFtController->setDestinationName(hash,name);
}
bool ftServer::setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy s) bool ftServer::setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy s)
{ {
return mFtController->setChunkStrategy(hash,s); return mFtController->setChunkStrategy(hash,s);
} }
void ftServer::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy s)
{
mFtController->setDefaultChunkStrategy(s) ;
}
FileChunksInfo::ChunkStrategy ftServer::defaultChunkStrategy()
{
return mFtController->defaultChunkStrategy() ;
}
uint32_t ftServer::freeDiskSpaceLimit()const uint32_t ftServer::freeDiskSpaceLimit()const
{ {
return mFtController->freeDiskSpaceLimit() ; return mFtController->freeDiskSpaceLimit() ;
@ -311,9 +321,10 @@ void ftServer::setFreeDiskSpaceLimit(uint32_t s)
{ {
mFtController->setFreeDiskSpaceLimit(s) ; mFtController->setFreeDiskSpaceLimit(s) ;
} }
void ftServer::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy s)
void ftServer::setDefaultEncryptionPolicy(uint32_t s)
{ {
mFtController->setDefaultChunkStrategy(s) ; mFtController->setDefaultEncryptionPolicy(s) ;
} }
uint32_t ftServer::defaultEncryptionPolicy() uint32_t ftServer::defaultEncryptionPolicy()
{ {
@ -329,14 +340,15 @@ uint32_t ftServer::getMaxUploadSlotsPerFriend()
return mFtController->getMaxUploadsPerFriend() ; return mFtController->getMaxUploadsPerFriend() ;
} }
void ftServer::setDefaultEncryptionPolicy(uint32_t s) void ftServer::setFilePermDirectDL(uint32_t perm)
{ {
mFtController->setDefaultEncryptionPolicy(s) ; mFtController->setFilePermDirectDL(perm);
} }
FileChunksInfo::ChunkStrategy ftServer::defaultChunkStrategy() uint32_t ftServer::filePermDirectDL()
{ {
return mFtController->defaultChunkStrategy() ; return mFtController->filePermDirectDL() ;
} }
bool ftServer::FileCancel(const RsFileHash& hash) bool ftServer::FileCancel(const RsFileHash& hash)
{ {
// Remove from both queue and ftController, by default. // Remove from both queue and ftController, by default.

View File

@ -140,6 +140,8 @@ public:
virtual uint32_t defaultEncryptionPolicy() ; virtual uint32_t defaultEncryptionPolicy() ;
virtual void setMaxUploadSlotsPerFriend(uint32_t n) ; virtual void setMaxUploadSlotsPerFriend(uint32_t n) ;
virtual uint32_t getMaxUploadSlotsPerFriend() ; virtual uint32_t getMaxUploadSlotsPerFriend() ;
virtual void setFilePermDirectDL(uint32_t perm) ;
virtual uint32_t filePermDirectDL() ;
/*** /***
* Control of Downloads Priority. * Control of Downloads Priority.

View File

@ -92,6 +92,7 @@ public:
uint32_t mMaxVisibleCount ; uint32_t mMaxVisibleCount ;
bool mGrpAutoSync ; bool mGrpAutoSync ;
bool mAllowMsgSync; bool mAllowMsgSync;
time_t mLastGroupModificationTS ;
}; };
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult; typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;

View File

@ -70,7 +70,7 @@ static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes
RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns, RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns,
RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs, RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs,
uint32_t authenPolicy, uint32_t messageStorePeriod) uint32_t authenPolicy)
: mGenMtx("GenExchange"), : mGenMtx("GenExchange"),
mDataStore(gds), mDataStore(gds),
mNetService(ns), mNetService(ns),
@ -78,7 +78,6 @@ RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService
mServType(servType), mServType(servType),
mGixs(gixs), mGixs(gixs),
mAuthenPolicy(authenPolicy), mAuthenPolicy(authenPolicy),
MESSAGE_STORE_PERIOD(messageStorePeriod),
mCleaning(false), mCleaning(false),
mLastClean((int)time(NULL) - (int)(RSRandom::random_u32() % MSG_CLEANUP_PERIOD)), // this helps unsynchronising the checks for the different services mLastClean((int)time(NULL) - (int)(RSRandom::random_u32() % MSG_CLEANUP_PERIOD)), // this helps unsynchronising the checks for the different services
mMsgCleanUp(NULL), mMsgCleanUp(NULL),
@ -94,9 +93,7 @@ RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService
VALIDATE_FAIL_TRY_LATER(2), VALIDATE_FAIL_TRY_LATER(2),
VALIDATE_MAX_WAITING_TIME(60) VALIDATE_MAX_WAITING_TIME(60)
{ {
mDataAccess = new RsGxsDataAccess(gds); mDataAccess = new RsGxsDataAccess(gds);
} }
void RsGenExchange::setNetworkExchangeService(RsNetworkExchangeService *ns) void RsGenExchange::setNetworkExchangeService(RsNetworkExchangeService *ns)
@ -104,7 +101,9 @@ void RsGenExchange::setNetworkExchangeService(RsNetworkExchangeService *ns)
if(mNetService != NULL) if(mNetService != NULL)
std::cerr << "(EE) Cannot override existing network exchange service. Make sure it has been deleted otherwise." << std::endl; std::cerr << "(EE) Cannot override existing network exchange service. Make sure it has been deleted otherwise." << std::endl;
else else
{
mNetService = ns ; mNetService = ns ;
}
} }
RsGenExchange::~RsGenExchange() RsGenExchange::~RsGenExchange()
@ -244,10 +243,13 @@ void RsGenExchange::tick()
bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta) bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta)
{ {
time_t st = MESSAGE_STORE_PERIOD; if(!mNetService)
{
std::cerr << "(EE) No network service in service " << std::hex << serviceType() << std::dec << ": cannot read message storage time." << std::endl;
return false ;
}
if(mNetService) uint32_t st = mNetService->getKeepAge(meta.mGroupId);
st = mNetService->getKeepAge(meta.mGroupId, st);
time_t storageTimeLimit = meta.mPublishTs + st; time_t storageTimeLimit = meta.mPublishTs + st;
@ -1374,6 +1376,13 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
gItem->meta.mVisibleMsgCount = 0; gItem->meta.mVisibleMsgCount = 0;
} }
// When the group is not subscribed, the last post value is not updated, because there's no message stored. As a consequence,
// we rely on network statistics to give this value, but it is not as accurate as if it was locally computed, because of blocked
// posts, friends not available, sync delays, etc.
if(!(IS_GROUP_SUBSCRIBED(gItem->meta.mSubscribeFlags)))
gItem->meta.mLastPost = sts.mLastGroupModificationTS ;
// Also check the group privacy flags. A while ago, it as possible to publish a group without privacy flags. Now it is not possible anymore. // Also check the group privacy flags. A while ago, it as possible to publish a group without privacy flags. Now it is not possible anymore.
// As a consequence, it's important to supply a correct value in this flag before the data can be edited/updated. // As a consequence, it's important to supply a correct value in this flag before the data can be edited/updated.
@ -1825,10 +1834,12 @@ uint32_t RsGenExchange::getStoragePeriod(const RsGxsGroupId& grpId)
{ {
RS_STACK_MUTEX(mGenMtx) ; RS_STACK_MUTEX(mGenMtx) ;
if(mNetService != NULL) if(!mNetService)
return mNetService->getKeepAge(grpId,MESSAGE_STORE_PERIOD) ; {
else std::cerr << "(EE) No network service in service " << std::hex << serviceType() << std::dec << ": cannot read message storage time. Returning infinity." << std::endl;
return MESSAGE_STORE_PERIOD; return false ;
}
return mNetService->getKeepAge(grpId) ;
} }
void RsGenExchange::setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) void RsGenExchange::setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs)
{ {

View File

@ -117,9 +117,7 @@ public:
* @param gixs This is used for verification of msgs and groups received by Gen Exchange using identities. * @param gixs This is used for verification of msgs and groups received by Gen Exchange using identities.
* @param authenPolicy This determines the authentication used for verfying authorship of msgs and groups * @param authenPolicy This determines the authentication used for verfying authorship of msgs and groups
*/ */
RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy);
RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy,
uint32_t messageStorePeriod = RS_GXS_DEFAULT_MSG_STORE_PERIOD);
virtual ~RsGenExchange(); virtual ~RsGenExchange();
@ -665,7 +663,7 @@ public:
* \brief getDefaultStoragePeriod. All times in seconds. * \brief getDefaultStoragePeriod. All times in seconds.
* \return * \return
*/ */
virtual uint32_t getDefaultStoragePeriod() { return MESSAGE_STORE_PERIOD; } virtual uint32_t getDefaultStoragePeriod() { return mNetService->getDefaultKeepAge() ; }
virtual uint32_t getStoragePeriod(const RsGxsGroupId& grpId) ; virtual uint32_t getStoragePeriod(const RsGxsGroupId& grpId) ;
virtual void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ; virtual void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
@ -893,8 +891,6 @@ private:
std::vector<GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > mMsgPendingValidate; std::vector<GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > mMsgPendingValidate;
typedef std::vector<GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > NxsMsgPendingVect; typedef std::vector<GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > NxsMsgPendingVect;
const uint32_t MESSAGE_STORE_PERIOD;
bool mCleaning; bool mCleaning;
time_t mLastClean; time_t mLastClean;
RsGxsMessageCleanUp* mMsgCleanUp; RsGxsMessageCleanUp* mMsgCleanUp;

View File

@ -311,7 +311,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs,
const RsServiceInfo serviceInfo, const RsServiceInfo serviceInfo,
RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs, RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs,
PgpAuxUtils *pgpUtils, bool grpAutoSync,bool msgAutoSync) PgpAuxUtils *pgpUtils, bool grpAutoSync, bool msgAutoSync, uint32_t default_store_period, uint32_t default_sync_period)
: p3ThreadedService(), p3Config(), mTransactionN(0), : p3ThreadedService(), p3Config(), mTransactionN(0),
mObserver(nxsObs), mDataStore(gds), mObserver(nxsObs), mDataStore(gds),
mServType(servType), mTransactionTimeOut(TRANSAC_TIMEOUT), mServType(servType), mTransactionTimeOut(TRANSAC_TIMEOUT),
@ -321,11 +321,20 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
mCircles(circles), mGixs(gixs), mCircles(circles), mGixs(gixs),
mReputations(reputations), mPgpUtils(pgpUtils), mReputations(reputations), mPgpUtils(pgpUtils),
mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync), mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync),
mServiceInfo(serviceInfo) mServiceInfo(serviceInfo), mDefaultMsgStorePeriod(default_store_period),
mDefaultMsgSyncPeriod(default_sync_period)
{ {
addSerialType(new RsNxsSerialiser(mServType)); addSerialType(new RsNxsSerialiser(mServType));
mOwnId = mNetMgr->getOwnId(); mOwnId = mNetMgr->getOwnId();
mUpdateCounter = 0; mUpdateCounter = 0;
// check the consistency
if(mDefaultMsgStorePeriod > 0 && mDefaultMsgSyncPeriod > mDefaultMsgStorePeriod)
{
std::cerr << "(WW) in GXS service \"" << getServiceInfo().mServiceName << "\": too large message sync period will be set to message store period." << std::endl;
mDefaultMsgSyncPeriod = mDefaultMsgStorePeriod ;
}
} }
void RsGxsNetService::getItemNames(std::map<uint8_t,std::string>& names) const void RsGxsNetService::getItemNames(std::map<uint8_t,std::string>& names) const
@ -623,8 +632,8 @@ void RsGxsNetService::syncWithPeers()
msg->PeerId(peerId); msg->PeerId(peerId);
msg->updateTS = updateTS; msg->updateTS = updateTS;
int req_delay = (int)mServerGrpConfigMap[grpId].msg_req_delay ; int req_delay = (int)locked_getGrpConfig(grpId).msg_req_delay ;
int keep_delay = (int)mServerGrpConfigMap[grpId].msg_keep_delay ; int keep_delay = (int)locked_getGrpConfig(grpId).msg_keep_delay ;
// If we store for less than we request, we request less, otherwise the posts will be deleted after being obtained. // If we store for less than we request, we request less, otherwise the posts will be deleted after being obtained.
@ -681,12 +690,13 @@ void RsGxsNetService::syncGrpStatistics()
for(std::map<RsGxsGroupId,RsGxsGrpMetaData*>::const_iterator it(grpMeta.begin());it!=grpMeta.end();++it) for(std::map<RsGxsGroupId,RsGxsGrpMetaData*>::const_iterator it(grpMeta.begin());it!=grpMeta.end();++it)
{ {
const RsGxsGrpConfig& rec = mServerGrpConfigMap[it->first] ; const RsGxsGrpConfig& rec = locked_getGrpConfig(it->first) ;
#ifdef NXS_NET_DEBUG_6 #ifdef NXS_NET_DEBUG_6
GXSNETDEBUG__G(it->first) << " group " << it->first ; GXSNETDEBUG__G(it->first) << " group " << it->first ;
#endif #endif
if(rec.update_TS + GROUP_STATS_UPDATE_DELAY < now && rec.suppliers.ids.size() > 0) if(rec.statistics_update_TS + GROUP_STATS_UPDATE_DELAY < now && rec.suppliers.ids.size() > 0)
{ {
#ifdef NXS_NET_DEBUG_6 #ifdef NXS_NET_DEBUG_6
GXSNETDEBUG__G(it->first) << " needs update. Randomly asking to some friends" << std::endl; GXSNETDEBUG__G(it->first) << " needs update. Randomly asking to some friends" << std::endl;
@ -786,7 +796,10 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
grs_resp->grpId = grs->grpId; grs_resp->grpId = grs->grpId;
grs_resp->PeerId(grs->PeerId()) ; grs_resp->PeerId(grs->PeerId()) ;
grs_resp->last_post_TS = 0 ; grs_resp->last_post_TS = grpMeta->mPublishTs ; // This is not zero, and necessarily older than any message in the group up to clock precision.
// This allows us to use 0 as "uninitialized" proof. If the group meta has been changed, this time
// will be more recent than some messages. This shouldn't be a problem, since this value can only
// be used to discard groups that are not used.
for(uint32_t i=0;i<vec.size();++i) for(uint32_t i=0;i<vec.size();++i)
{ {
@ -807,14 +820,16 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << "Received Grp update stats item from peer " << grs->PeerId() << " for group " << grs->grpId << ", reporting " << grs->number_of_posts << " posts." << std::endl; GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << "Received Grp update stats item from peer " << grs->PeerId() << " for group " << grs->grpId << ", reporting " << grs->number_of_posts << " posts." << std::endl;
#endif #endif
RS_STACK_MUTEX(mNxsMutex) ; RS_STACK_MUTEX(mNxsMutex) ;
RsGxsGrpConfig& rec(mServerGrpConfigMap[grs->grpId]) ;
RsGxsGrpConfig& rec(locked_getGrpConfig(grs->grpId)) ;
uint32_t old_count = rec.max_visible_count ; uint32_t old_count = rec.max_visible_count ;
uint32_t old_suppliers_count = rec.suppliers.ids.size() ; uint32_t old_suppliers_count = rec.suppliers.ids.size() ;
rec.suppliers.ids.insert(grs->PeerId()) ; rec.suppliers.ids.insert(grs->PeerId()) ;
rec.max_visible_count = std::max(rec.max_visible_count,grs->number_of_posts) ; rec.max_visible_count = std::max(rec.max_visible_count,grs->number_of_posts) ;
rec.update_TS = time(NULL) ; rec.statistics_update_TS = time(NULL) ;
rec.last_group_modification_TS = grs->last_post_TS;
if (old_count != rec.max_visible_count || old_suppliers_count != rec.suppliers.ids.size()) if (old_count != rec.max_visible_count || old_suppliers_count != rec.suppliers.ids.size())
mNewStatsToNotify.insert(grs->grpId) ; mNewStatsToNotify.insert(grs->grpId) ;
@ -1422,7 +1437,7 @@ bool RsGxsNetService::loadList(std::list<RsItem *> &load)
// the update time stamp is randomised so as not to ask all friends at once about group statistics. // the update time stamp is randomised so as not to ask all friends at once about group statistics.
it->second.update_TS = now - GROUP_STATS_UPDATE_DELAY + (RSRandom::random_u32()%(GROUP_STATS_UPDATE_DELAY/10)) ; it->second.statistics_update_TS = now - GROUP_STATS_UPDATE_DELAY + (RSRandom::random_u32()%(GROUP_STATS_UPDATE_DELAY/10)) ;
// Similarly, we remove all suppliers. // Similarly, we remove all suppliers.
// Actual suppliers will come back automatically. // Actual suppliers will come back automatically.
@ -2296,6 +2311,7 @@ bool RsGxsNetService::getGroupNetworkStats(const RsGxsGroupId& gid,RsGroupNetwor
stats.mMaxVisibleCount = it->second.max_visible_count ; stats.mMaxVisibleCount = it->second.max_visible_count ;
stats.mAllowMsgSync = mAllowMsgSync ; stats.mAllowMsgSync = mAllowMsgSync ;
stats.mGrpAutoSync = mGrpAutoSync ; stats.mGrpAutoSync = mGrpAutoSync ;
stats.mLastGroupModificationTS = it->second.last_group_modification_TS ;
return true ; return true ;
} }
@ -2684,7 +2700,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
uint32_t mcount = msgItemL.size() ; uint32_t mcount = msgItemL.size() ;
RsPeerId pid = msgItemL.front()->PeerId() ; RsPeerId pid = msgItemL.front()->PeerId() ;
RsGxsGrpConfig& gnsr(mServerGrpConfigMap[grpId]) ; RsGxsGrpConfig& gnsr(locked_getGrpConfig(grpId));
std::set<RsPeerId>::size_type oldSuppliersCount = gnsr.suppliers.ids.size(); std::set<RsPeerId>::size_type oldSuppliersCount = gnsr.suppliers.ids.size();
uint32_t oldVisibleCount = gnsr.max_visible_count; uint32_t oldVisibleCount = gnsr.max_visible_count;
@ -4058,7 +4074,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
if(grp_is_known || mServerGrpConfigMap.find(item->grpId)!=mServerGrpConfigMap.end()) if(grp_is_known || mServerGrpConfigMap.find(item->grpId)!=mServerGrpConfigMap.end())
{ {
RsGxsGrpConfig & rec(mServerGrpConfigMap[item->grpId]) ; // this creates it if needed. When the grp is unknown (and hashed) this will would create a unused entry RsGxsGrpConfig& rec(locked_getGrpConfig(item->grpId)); // this creates it if needed. When the grp is unknown (and hashed) this will would create a unused entry
rec.suppliers.ids.insert(peer) ; rec.suppliers.ids.insert(peer) ;
} }
if(!peer_can_receive_update) if(!peer_can_receive_update)
@ -4128,7 +4144,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
time_t now = time(NULL) ; time_t now = time(NULL) ;
uint32_t max_send_delay = mServerGrpConfigMap[item->grpId].msg_req_delay; // we should use "sync" but there's only one variable used in the GUI: the req one. uint32_t max_send_delay = locked_getGrpConfig(item->grpId).msg_req_delay; // we should use "sync" but there's only one variable used in the GUI: the req one.
if(canSendMsgIds(msgMetas, *grpMeta, peer, should_encrypt_to_this_circle_id)) if(canSendMsgIds(msgMetas, *grpMeta, peer, should_encrypt_to_this_circle_id))
{ {
@ -4417,7 +4433,7 @@ bool RsGxsNetService::checkPermissionsForFriendGroup(const RsPeerId& sslId,const
void RsGxsNetService::pauseSynchronisation(bool /* enabled */) void RsGxsNetService::pauseSynchronisation(bool /* enabled */)
{ {
std::cerr << "(EE) RsGxsNetService::pauseSynchronisation() called, but not implemented." << std::endl;
} }
void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs) void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs)
@ -4426,7 +4442,7 @@ void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
locked_checkDelay(age_in_secs) ; locked_checkDelay(age_in_secs) ;
RsGxsGrpConfig& conf(mServerGrpConfigMap[grpId]) ; RsGxsGrpConfig& conf(locked_getGrpConfig(grpId));
if(conf.msg_req_delay != age_in_secs) if(conf.msg_req_delay != age_in_secs)
{ {
@ -4444,7 +4460,7 @@ void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
locked_checkDelay(age_in_secs) ; locked_checkDelay(age_in_secs) ;
RsGxsGrpConfig& conf(mServerGrpConfigMap[grpId]) ; RsGxsGrpConfig& conf(locked_getGrpConfig(grpId));
if(conf.msg_keep_delay != age_in_secs) if(conf.msg_keep_delay != age_in_secs)
{ {
@ -4453,27 +4469,39 @@ void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
} }
} }
RsGxsGrpConfig& RsGxsNetService::locked_getGrpConfig(const RsGxsGroupId& grp_id)
{
GrpConfigMap::iterator it = mServerGrpConfigMap.find(grp_id);
if(it == mServerGrpConfigMap.end())
{
RsGxsGrpConfig& conf(mServerGrpConfigMap[grp_id]) ;
conf.msg_keep_delay = mDefaultMsgStorePeriod;
conf.msg_send_delay = mDefaultMsgSyncPeriod;
conf.msg_req_delay = mDefaultMsgSyncPeriod;
conf.max_visible_count = 0 ;
conf.statistics_update_TS = 0 ;
conf.last_group_modification_TS = 0 ;
return conf ;
}
else
return it->second;
}
uint32_t RsGxsNetService::getSyncAge(const RsGxsGroupId& grpId) uint32_t RsGxsNetService::getSyncAge(const RsGxsGroupId& grpId)
{ {
RS_STACK_MUTEX(mNxsMutex) ; RS_STACK_MUTEX(mNxsMutex) ;
GrpConfigMap::const_iterator it = mServerGrpConfigMap.find(grpId) ; return locked_getGrpConfig(grpId).msg_req_delay ;
if(it == mServerGrpConfigMap.end())
return RS_GXS_DEFAULT_MSG_REQ_PERIOD ;
else
return it->second.msg_req_delay ;
} }
uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId,uint32_t default_value) uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId)
{ {
RS_STACK_MUTEX(mNxsMutex) ; RS_STACK_MUTEX(mNxsMutex) ;
GrpConfigMap::const_iterator it = mServerGrpConfigMap.find(grpId) ; return locked_getGrpConfig(grpId).msg_keep_delay ;
if(it == mServerGrpConfigMap.end())
return default_value ;
else
return it->second.msg_keep_delay ;
} }
int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId) int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)
@ -4776,6 +4804,8 @@ bool RsGxsNetService::removeGroups(const std::list<RsGxsGroupId>& groups)
GXSNETDEBUG__G(*git) << " deleting info for group " << *git << std::endl; GXSNETDEBUG__G(*git) << " deleting info for group " << *git << std::endl;
#endif #endif
// Here we do not use locked_getGrpConfig() because we dont want the entry to be created if it doesnot already exist.
GrpConfigMap::iterator it = mServerGrpConfigMap.find(*git) ; GrpConfigMap::iterator it = mServerGrpConfigMap.find(*git) ;
if(it != mServerGrpConfigMap.end()) if(it != mServerGrpConfigMap.end())

View File

@ -93,13 +93,16 @@ public:
const RsServiceInfo serviceInfo, const RsServiceInfo serviceInfo,
RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL, RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL,
PgpAuxUtils *pgpUtils = NULL, PgpAuxUtils *pgpUtils = NULL,
bool grpAutoSync = true, bool msgAutoSync = true); bool grpAutoSync = true, bool msgAutoSync = true,
uint32_t default_store_period = RS_GXS_DEFAULT_MSG_STORE_PERIOD,
uint32_t default_sync_period = RS_GXS_DEFAULT_MSG_REQ_PERIOD);
virtual ~RsGxsNetService(); virtual ~RsGxsNetService();
virtual RsServiceInfo getServiceInfo() { return mServiceInfo; } virtual RsServiceInfo getServiceInfo() { return mServiceInfo; }
virtual void getItemNames(std::map<uint8_t,std::string>& names) const ; virtual void getItemNames(std::map<uint8_t,std::string>& names) const ;
public: public:
@ -111,9 +114,13 @@ public:
virtual void setKeepAge(const RsGxsGroupId& grpId,uint32_t age_in_secs); virtual void setKeepAge(const RsGxsGroupId& grpId,uint32_t age_in_secs);
virtual uint32_t getSyncAge(const RsGxsGroupId& id); virtual uint32_t getSyncAge(const RsGxsGroupId& id);
virtual uint32_t getKeepAge(const RsGxsGroupId& id,uint32_t default_value); virtual uint32_t getKeepAge(const RsGxsGroupId& id);
virtual uint32_t getDefaultSyncAge() { return RS_GXS_DEFAULT_MSG_REQ_PERIOD ; } virtual uint32_t getDefaultSyncAge() { return mDefaultMsgSyncPeriod ; }
virtual uint32_t getDefaultKeepAge() { return mDefaultMsgStorePeriod ; }
virtual void setDefaultKeepAge(uint32_t t) { mDefaultMsgStorePeriod = t ; }
virtual void setDefaultSyncAge(uint32_t t) { mDefaultMsgSyncPeriod = t ; }
/*! /*!
* pauses synchronisation of subscribed groups and request for group id * pauses synchronisation of subscribed groups and request for group id
@ -413,6 +420,7 @@ private:
static RsGxsGroupId hashGrpId(const RsGxsGroupId& gid,const RsPeerId& pid) ; static RsGxsGroupId hashGrpId(const RsGxsGroupId& gid,const RsPeerId& pid) ;
RsGxsGrpConfig& locked_getGrpConfig(const RsGxsGroupId& grp_id);
private: private:
typedef std::vector<RsNxsGrp*> GrpFragments; typedef std::vector<RsNxsGrp*> GrpFragments;
@ -573,6 +581,9 @@ private:
std::set<RsGxsGroupId> mNewPublishKeysToNotify ; std::set<RsGxsGroupId> mNewPublishKeysToNotify ;
void debugDump(); void debugDump();
uint32_t mDefaultMsgStorePeriod ;
uint32_t mDefaultMsgSyncPeriod ;
}; };
#endif // RSGXSNETSERVICE_H #endif // RSGXSNETSERVICE_H

View File

@ -35,7 +35,7 @@ static const uint32_t MAX_GXS_IDS_REQUESTS_NET = 10 ; // max number of reques
//#define DEBUG_GXSUTIL 1 //#define DEBUG_GXSUTIL 1
#define GXSUTIL_DEBUG() std::cerr << time(NULL) << " : GXS_UTIL : " << __FUNCTION__ << " : " #define GXSUTIL_DEBUG() std::cerr << "[" << time(NULL) << "] : GXS_UTIL : " << __FUNCTION__ << " : "
RsGxsMessageCleanUp::RsGxsMessageCleanUp(RsGeneralDataService* const dataService, RsGenExchange *genex, uint32_t chunkSize) RsGxsMessageCleanUp::RsGxsMessageCleanUp(RsGeneralDataService* const dataService, RsGenExchange *genex, uint32_t chunkSize)
: mDs(dataService), mGenExchangeClient(genex), CHUNK_SIZE(chunkSize) : mDs(dataService), mGenExchangeClient(genex), CHUNK_SIZE(chunkSize)
@ -57,7 +57,8 @@ bool RsGxsMessageCleanUp::clean()
time_t now = time(NULL); time_t now = time(NULL);
#ifdef DEBUG_GXSUTIL #ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " Cleaning up groups in service" << std::hex << mGenExchangeClient->serviceType() << std::dec << std::endl; uint16_t service_type = mGenExchangeClient->serviceType() ;
GXSUTIL_DEBUG() << " Cleaning up groups in service " << std::hex << service_type << std::dec << std::endl;
#endif #endif
while(!mGrpMeta.empty()) while(!mGrpMeta.empty())
{ {
@ -97,8 +98,10 @@ bool RsGxsMessageCleanUp::clean()
{ {
RsGxsMsgMetaData* meta = metaV[i]; RsGxsMsgMetaData* meta = metaV[i];
bool have_kids = (messages_with_kids.find(meta->mMsgId)!=messages_with_kids.end());
// check if expired // check if expired
bool remove = store_period > 0 && ((meta->mPublishTs + store_period) < now) && (messages_with_kids.find(meta->mMsgId)==messages_with_kids.end()); bool remove = store_period > 0 && ((meta->mPublishTs + store_period) < now) && !have_kids;
// check client does not want the message kept regardless of age // check client does not want the message kept regardless of age
remove &= !(meta->mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP); remove &= !(meta->mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP);
@ -107,12 +110,18 @@ bool RsGxsMessageCleanUp::clean()
remove = remove || (grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED); remove = remove || (grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED);
remove = remove || !(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED); remove = remove || !(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
GXSUTIL_DEBUG() << " msg id " << meta->mMsgId << " in grp " << grpId << ": keep_flag=" << bool(meta->mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP)
<< " subscribed: " << bool(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) << " store_period: " << store_period
<< " kids: " << have_kids << " now - meta->mPublishTs: " << now - meta->mPublishTs ;
if( remove ) if( remove )
{ {
req[grpId].push_back(meta->mMsgId); req[grpId].push_back(meta->mMsgId);
GXSUTIL_DEBUG() << " Scheduling msg id " << meta->mMsgId << " in grp " << grpId << " for removal." << std::endl; std::cerr << " Scheduling for removal." << std::endl;
} }
else
std::cerr << std::endl;
delete meta; delete meta;
} }
@ -313,7 +322,7 @@ bool RsGxsIntegrityCheck::check()
{ {
gxs_ids.push_back(*it) ; gxs_ids.push_back(*it) ;
#ifdef DEBUG_GXSUTIL #ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " " << *it << std::endl; GXSUTIL_DEBUG() << " " << it->first << std::endl;
#endif #endif
} }
uint32_t nb_requested_not_in_cache = 0; uint32_t nb_requested_not_in_cache = 0;
@ -328,7 +337,7 @@ bool RsGxsIntegrityCheck::check()
{ {
uint32_t n = RSRandom::random_u32() % gxs_ids.size() ; uint32_t n = RSRandom::random_u32() % gxs_ids.size() ;
#ifdef DEBUG_GXSUTIL #ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " requesting ID " << gxs_ids[n] ; GXSUTIL_DEBUG() << " requesting ID " << gxs_ids[n].first ;
#endif #endif
if(!mGixs->haveKey(gxs_ids[n].first)) // checks if we have it already in the cache (conservative way to ensure that we atually have it) if(!mGixs->haveKey(gxs_ids[n].first)) // checks if we have it already in the cache (conservative way to ensure that we atually have it)

View File

@ -73,9 +73,13 @@ public:
virtual void setKeepAge(const RsGxsGroupId& id,uint32_t age_in_secs) =0; virtual void setKeepAge(const RsGxsGroupId& id,uint32_t age_in_secs) =0;
virtual uint32_t getSyncAge(const RsGxsGroupId& id) =0; virtual uint32_t getSyncAge(const RsGxsGroupId& id) =0;
virtual uint32_t getKeepAge(const RsGxsGroupId& id,uint32_t default_value) =0; virtual uint32_t getKeepAge(const RsGxsGroupId& id) =0;
virtual void setDefaultKeepAge(uint32_t t) =0;
virtual void setDefaultSyncAge(uint32_t t) =0;
virtual uint32_t getDefaultSyncAge() =0; virtual uint32_t getDefaultSyncAge() =0;
virtual uint32_t getDefaultKeepAge() =0;
/*! /*!
* Initiates a search through the network * Initiates a search through the network

View File

@ -20,7 +20,8 @@
#include "gxstrans/p3gxstrans.h" #include "gxstrans/p3gxstrans.h"
#include "util/stacktrace.h" #include "util/stacktrace.h"
#define DEBUG_GXSTRANS 1 //#define DEBUG_GXSTRANS 1
typedef unsigned int uint; typedef unsigned int uint;
RsGxsTrans *rsGxsTrans = NULL ; RsGxsTrans *rsGxsTrans = NULL ;
@ -39,7 +40,10 @@ p3GxsTrans::~p3GxsTrans()
bool p3GxsTrans::getStatistics(GxsTransStatistics& stats) bool p3GxsTrans::getStatistics(GxsTransStatistics& stats)
{ {
{
RS_STACK_MUTEX(mDataMutex);
stats.prefered_group_id = mPreferredGroupId; stats.prefered_group_id = mPreferredGroupId;
}
stats.outgoing_records.clear(); stats.outgoing_records.clear();
{ {
@ -139,9 +143,33 @@ void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type)
{ {
case GROUPS_LIST: case GROUPS_LIST:
{ {
#ifdef DEBUG_GXSTRANS
std::cerr << " Reviewing available groups. " << std::endl;
#endif
std::vector<RsGxsGrpItem*> groups; std::vector<RsGxsGrpItem*> groups;
getGroupData(token, groups); getGroupData(token, groups);
// First recompute the prefered group Id.
{
RS_STACK_MUTEX(mDataMutex);
for( auto grp : groups )
{
locked_supersedePreferredGroup(grp->meta.mGroupId);
if(RsGenExchange::getStoragePeriod(grp->meta.mGroupId) != GXS_STORAGE_PERIOD)
{
std::cerr << "(WW) forcing storage period in GxsTrans group " << grp->meta.mGroupId << " to " << GXS_STORAGE_PERIOD << " seconds. Value was " << RsGenExchange::getStoragePeriod(grp->meta.mGroupId) << std::endl;
RsGenExchange::setStoragePeriod(grp->meta.mGroupId,GXS_STORAGE_PERIOD) ;
}
}
}
#ifdef DEBUG_GXSTRANS
std::cerr << " computed preferred group id: " << mPreferredGroupId << std::endl;
#endif
for( auto grp : groups ) for( auto grp : groups )
{ {
/* For each group check if it is better candidate then /* For each group check if it is better candidate then
@ -154,18 +182,29 @@ void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type)
const RsGroupMetaData& meta = grp->meta; const RsGroupMetaData& meta = grp->meta;
bool subscribed = IS_GROUP_SUBSCRIBED(meta.mSubscribeFlags); bool subscribed = IS_GROUP_SUBSCRIBED(meta.mSubscribeFlags);
bool old = olderThen( meta.mLastPost,
UNUSED_GROUP_UNSUBSCRIBE_INTERVAL ); // if mLastPost is 0, then the group is not subscribed, so it only has impact on shouldSubscribe. In any case, a group
bool supersede = supersedePreferredGroup(meta.mGroupId); // with no information shouldn't be subscribed, so the olderThen() test is still valid in the case mLastPost=0.
bool old = olderThen( meta.mLastPost, UNUSED_GROUP_UNSUBSCRIBE_INTERVAL );
uint32_t token; uint32_t token;
bool shoudlSubscribe = !subscribed && ( !old || supersede ); bool shouldSubscribe = false ;
bool shoudlUnSubscribe = subscribed && old bool shouldUnSubscribe = false ;
&& meta.mGroupId != mPreferredGroupId; {
RS_STACK_MUTEX(mDataMutex);
if(shoudlSubscribe) shouldSubscribe = (!subscribed) && ((!old)|| meta.mGroupId == mPreferredGroupId );
shouldUnSubscribe = ( subscribed) && old && meta.mGroupId != mPreferredGroupId;
}
#ifdef DEBUG_GXSTRANS
std::cout << " group " << grp->meta.mGroupId << ", subscribed: " << subscribed << " last post: " << meta.mLastPost << " should subscribe: "<< shouldSubscribe
<< ", should unsubscribe: " << shouldUnSubscribe << std::endl;
#endif
if(shouldSubscribe)
RsGenExchange::subscribeToGroup(token, meta.mGroupId, true); RsGenExchange::subscribeToGroup(token, meta.mGroupId, true);
else if(shoudlUnSubscribe) else if(shouldUnSubscribe)
RsGenExchange::subscribeToGroup(token, meta.mGroupId, false); RsGenExchange::subscribeToGroup(token, meta.mGroupId, false);
#ifdef GXS_MAIL_GRP_DEBUG #ifdef GXS_MAIL_GRP_DEBUG
@ -187,7 +226,14 @@ void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type)
delete grp; delete grp;
} }
if(mPreferredGroupId.isNull()) bool have_preferred_group = false ;
{
RS_STACK_MUTEX(mDataMutex);
have_preferred_group = !mPreferredGroupId.isNull();
}
if(!have_preferred_group)
{ {
/* This is true only at first run when we haven't received mail /* This is true only at first run when we haven't received mail
* distribuition groups from friends * distribuition groups from friends
@ -213,7 +259,9 @@ void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type)
#endif #endif
RsGxsGroupId grpId; RsGxsGroupId grpId;
acknowledgeTokenGrp(token, grpId); acknowledgeTokenGrp(token, grpId);
supersedePreferredGroup(grpId);
RS_STACK_MUTEX(mDataMutex);
locked_supersedePreferredGroup(grpId);
break; break;
} }
case MAILS_UPDATE: case MAILS_UPDATE:
@ -345,6 +393,9 @@ void p3GxsTrans::GxsTransIntegrityCleanupThread::run()
{ {
std::vector<RsNxsMsg*>& msgV = mit->second; std::vector<RsNxsMsg*>& msgV = mit->second;
std::vector<RsNxsMsg*>::iterator vit = msgV.begin(); std::vector<RsNxsMsg*>::iterator vit = msgV.begin();
#ifdef DEBUG_GXSTRANS
std::cerr << "Group " << mit->first << ": " << std::endl;
#endif
for(; vit != msgV.end(); ++vit) for(; vit != msgV.end(); ++vit)
{ {
@ -380,6 +431,9 @@ void p3GxsTrans::GxsTransIntegrityCleanupThread::run()
totalMessageSizeAndCount[msg->metaData->mAuthorId].size += msg->msg.bin_len ; totalMessageSizeAndCount[msg->metaData->mAuthorId].size += msg->msg.bin_len ;
totalMessageSizeAndCount[msg->metaData->mAuthorId].count++; totalMessageSizeAndCount[msg->metaData->mAuthorId].count++;
delete msg; delete msg;
if(item != NULL)
delete item ;
} }
} }
@ -444,6 +498,10 @@ void p3GxsTrans::service_tick()
mCleanupThread->start() ; mCleanupThread->start() ;
mLastMsgCleanup = now ; mLastMsgCleanup = now ;
} }
// This forces to review all groups, and decide to subscribe or not to each of them.
requestGroupsData();
} }
// now grab collected messages to delete // now grab collected messages to delete
@ -813,6 +871,8 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
} }
case GxsTransSendStatus::PENDING_PREFERRED_GROUP: case GxsTransSendStatus::PENDING_PREFERRED_GROUP:
{ {
RS_STACK_MUTEX(mDataMutex);
if(mPreferredGroupId.isNull()) if(mPreferredGroupId.isNull())
{ {
requestGroupsData(); requestGroupsData();
@ -837,7 +897,10 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
grsrz.resize(grsz); grsrz.resize(grsz);
RsGxsTransSerializer().serialise(&grcpt, &grsrz[0], &grsz); RsGxsTransSerializer().serialise(&grcpt, &grsrz[0], &grsz);
{
RS_STACK_MUTEX(mDataMutex);
pr.presignedReceipt.grpId = mPreferredGroupId; pr.presignedReceipt.grpId = mPreferredGroupId;
}
pr.presignedReceipt.metaData = new RsGxsMsgMetaData(); pr.presignedReceipt.metaData = new RsGxsMsgMetaData();
*pr.presignedReceipt.metaData = grcpt.meta; *pr.presignedReceipt.metaData = grcpt.meta;
pr.presignedReceipt.msg.setBinData(&grsrz[0], grsz); pr.presignedReceipt.msg.setBinData(&grsrz[0], grsz);

View File

@ -92,14 +92,15 @@ public:
p3IdService& identities ) : p3IdService& identities ) :
RsGenExchange( gds, nes, new RsGxsTransSerializer(), RsGenExchange( gds, nes, new RsGxsTransSerializer(),
RS_SERVICE_TYPE_GXS_TRANS, &identities, RS_SERVICE_TYPE_GXS_TRANS, &identities,
AuthenPolicy(), GXS_STORAGE_PERIOD ), AuthenPolicy()),
GxsTokenQueue(this), GxsTokenQueue(this),
RsGxsTrans(this), RsGxsTrans(this),
mIdService(identities), mIdService(identities),
mServClientsMutex("p3GxsTrans client services map mutex"), mServClientsMutex("p3GxsTrans client services map mutex"),
mOutgoingMutex("p3GxsTrans outgoing queue map mutex"), mOutgoingMutex("p3GxsTrans outgoing queue map mutex"),
mIngoingMutex("p3GxsTrans ingoing queue map mutex"), mIngoingMutex("p3GxsTrans ingoing queue map mutex"),
mPerUserStatsMutex("p3GxsTrans user stats mutex") mPerUserStatsMutex("p3GxsTrans user stats mutex"),
mDataMutex("p3GxsTrans data mutex")
{ {
mLastMsgCleanup = time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30; // always check 30 secs after start mLastMsgCleanup = time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30; // always check 30 secs after start
mCleanupThread = NULL ; mCleanupThread = NULL ;
@ -149,10 +150,12 @@ public:
/// @see RsGenExchange::getServiceInfo() /// @see RsGenExchange::getServiceInfo()
virtual RsServiceInfo getServiceInfo() { return RsServiceInfo( RS_SERVICE_TYPE_GXS_TRANS, "GXS Mails", 0, 1, 0, 1 ); } virtual RsServiceInfo getServiceInfo() { return RsServiceInfo( RS_SERVICE_TYPE_GXS_TRANS, "GXS Mails", 0, 1, 0, 1 ); }
static const uint32_t GXS_STORAGE_PERIOD = 15*86400; // 15 days.
static const uint32_t GXS_SYNC_PERIOD = 15*86400;
private: private:
/** Time interval of inactivity before a distribution group is unsubscribed. /** Time interval of inactivity before a distribution group is unsubscribed.
* Approximatively 3 months seems ok ATM. */ * Approximatively 3 months seems ok ATM. */
const static int32_t UNUSED_GROUP_UNSUBSCRIBE_INTERVAL = 0x76A700; const static int32_t UNUSED_GROUP_UNSUBSCRIBE_INTERVAL = 16*86400; // 16 days
/** /**
* This should be as little as possible as the size of the database can grow * This should be as little as possible as the size of the database can grow
@ -167,7 +170,6 @@ private:
* signed acknowledged is received for each of them. * signed acknowledged is received for each of them.
* Two weeks seems fair ATM. * Two weeks seems fair ATM.
*/ */
static const uint32_t GXS_STORAGE_PERIOD = 0x127500;
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS ; // every 20 mins. Could be less. static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS ; // every 20 mins. Could be less.
time_t mLastMsgCleanup ; time_t mLastMsgCleanup ;
@ -253,7 +255,7 @@ private:
* @return true if preferredGroupId has been supeseded by potentialGrId * @return true if preferredGroupId has been supeseded by potentialGrId
* false otherwise. * false otherwise.
*/ */
bool inline supersedePreferredGroup(const RsGxsGroupId& potentialGrId) bool inline locked_supersedePreferredGroup(const RsGxsGroupId& potentialGrId)
{ {
if(mPreferredGroupId < potentialGrId) if(mPreferredGroupId < potentialGrId)
{ {
@ -320,5 +322,9 @@ private:
RsMutex mPerUserStatsMutex; RsMutex mPerUserStatsMutex;
std::map<RsGxsId,MsgSizeCount> per_user_statistics ; std::map<RsGxsId,MsgSizeCount> per_user_statistics ;
// Mutex to protect local data
RsMutex mDataMutex;
}; };

View File

@ -46,6 +46,10 @@ const uint32_t RS_FILE_CTRL_FORCE_CHECK = 0x00000400;
const uint32_t RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT = 0x00000001 ; const uint32_t RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT = 0x00000001 ;
const uint32_t RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE = 0x00000002 ; const uint32_t RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE = 0x00000002 ;
const uint32_t RS_FILE_PERM_DIRECT_DL_YES = 0x00000001 ;
const uint32_t RS_FILE_PERM_DIRECT_DL_NO = 0x00000002 ;
const uint32_t RS_FILE_PERM_DIRECT_DL_PER_USER = 0x00000003 ;
const uint32_t RS_FILE_RATE_TRICKLE = 0x00000001; const uint32_t RS_FILE_RATE_TRICKLE = 0x00000001;
const uint32_t RS_FILE_RATE_SLOW = 0x00000002; const uint32_t RS_FILE_RATE_SLOW = 0x00000002;
const uint32_t RS_FILE_RATE_STANDARD = 0x00000003; const uint32_t RS_FILE_RATE_STANDARD = 0x00000003;
@ -165,10 +169,12 @@ class RsFiles
virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) =0; virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) =0;
virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0; virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0;
virtual bool FileClearCompleted() = 0; virtual bool FileClearCompleted() = 0;
virtual void setDefaultEncryptionPolicy(uint32_t policy)=0 ; // RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT/PERMISSIVE virtual void setDefaultEncryptionPolicy(uint32_t policy)=0; // RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT/PERMISSIVE
virtual uint32_t defaultEncryptionPolicy()=0 ; virtual uint32_t defaultEncryptionPolicy()=0;
virtual void setMaxUploadSlotsPerFriend(uint32_t n)=0 ; virtual void setMaxUploadSlotsPerFriend(uint32_t n)=0;
virtual uint32_t getMaxUploadSlotsPerFriend()=0 ; virtual uint32_t getMaxUploadSlotsPerFriend()=0;
virtual void setFilePermDirectDL(uint32_t perm)=0;
virtual uint32_t filePermDirectDL()=0;
/*** /***
* Control of Downloads Priority. * Control of Downloads Priority.

View File

@ -68,7 +68,8 @@ public:
msg_req_delay = RS_GXS_DEFAULT_MSG_REQ_PERIOD ; msg_req_delay = RS_GXS_DEFAULT_MSG_REQ_PERIOD ;
max_visible_count = 0 ; max_visible_count = 0 ;
update_TS = 0 ; statistics_update_TS = 0 ;
last_group_modification_TS = 0 ;
} }
uint32_t msg_keep_delay ; // delay after which we discard the posts uint32_t msg_keep_delay ; // delay after which we discard the posts
@ -77,7 +78,8 @@ public:
RsTlvPeerIdSet suppliers; // list of friends who feed this group RsTlvPeerIdSet suppliers; // list of friends who feed this group
uint32_t max_visible_count ; // max visible count reported by contributing friends uint32_t max_visible_count ; // max visible count reported by contributing friends
time_t update_TS ; // last time the max visible count was updated. time_t statistics_update_TS ; // last time the max visible count was updated.
time_t last_group_modification_TS ; // last time the group was modified, either in meta data or in the list of messages posted in it.
}; };
class RsGxsGrpConfigItem : public RsGxsNetServiceItem, public RsGxsGrpConfig class RsGxsGrpConfigItem : public RsGxsNetServiceItem, public RsGxsGrpConfig

View File

@ -1298,16 +1298,10 @@ int RsServer::StartupRetroShare()
// //
mPluginsManager->setServiceControl(serviceCtrl) ; mPluginsManager->setServiceControl(serviceCtrl) ;
// std::cerr << "rsinitconf (core 1) = " << (void*)rsInitConfig<<std::endl;
// std::cerr << "gxs_passwd (core 1) = " << (void*)&rsInitConfig->gxs_passwd<<" \"" << rsInitConfig->gxs_passwd << "\""<< std::endl;
// Now load the plugins. This parses the available SO/DLL files for known symbols. // Now load the plugins. This parses the available SO/DLL files for known symbols.
// //
mPluginsManager->loadPlugins(plugins_directories) ; mPluginsManager->loadPlugins(plugins_directories) ;
// std::cerr << "rsinitconf (core 1) = " << (void*)rsInitConfig<<std::endl;
// std::cerr << "gxs_passwd (core 2) = " << (void*)&rsInitConfig->gxs_passwd<< " \"" << rsInitConfig->gxs_passwd << "\""<< std::endl;
// Also load some plugins explicitly. This is helpful for // Also load some plugins explicitly. This is helpful for
// - developping plugins // - developping plugins
// //
@ -1394,7 +1388,6 @@ int RsServer::StartupRetroShare()
mPosted->setNetworkExchangeService(posted_ns) ; mPosted->setNetworkExchangeService(posted_ns) ;
/**** Wiki GXS service ****/ /**** Wiki GXS service ****/
#ifdef RS_USE_WIKI #ifdef RS_USE_WIKI
@ -1493,10 +1486,12 @@ int RsServer::StartupRetroShare()
currGxsDir + "/", "gxstrans_db", RS_SERVICE_TYPE_GXS_TRANS, currGxsDir + "/", "gxstrans_db", RS_SERVICE_TYPE_GXS_TRANS,
NULL, rsInitConfig->gxs_passwd ); NULL, rsInitConfig->gxs_passwd );
mGxsTrans = new p3GxsTrans(gxstrans_ds, NULL, *mGxsIdService); mGxsTrans = new p3GxsTrans(gxstrans_ds, NULL, *mGxsIdService);
RsGxsNetService* gxstrans_ns = new RsGxsNetService( RsGxsNetService* gxstrans_ns = new RsGxsNetService(
RS_SERVICE_TYPE_GXS_TRANS, gxstrans_ds, nxsMgr, mGxsTrans, RS_SERVICE_TYPE_GXS_TRANS, gxstrans_ds, nxsMgr, mGxsTrans,
mGxsTrans->getServiceInfo(), mReputations, mGxsCircles, mGxsTrans->getServiceInfo(), mReputations, mGxsCircles,
mGxsIdService, pgpAuxUtils); mGxsIdService, pgpAuxUtils,true,true,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD);
mGxsTrans->setNetworkExchangeService(gxstrans_ns); mGxsTrans->setNetworkExchangeService(gxstrans_ns);
pqih->addService(gxstrans_ns, true); pqih->addService(gxstrans_ns, true);
# endif // RS_GXS_TRANS # endif // RS_GXS_TRANS

View File

@ -44,8 +44,6 @@
RsGxsForums *rsGxsForums = NULL; RsGxsForums *rsGxsForums = NULL;
const uint32_t GXSFORUMS_MSG_STORE_PERIOD = 60*60*24*31*12; // 12 months / 1 year
#define FORUM_TESTEVENT_DUMMYDATA 0x0001 #define FORUM_TESTEVENT_DUMMYDATA 0x0001
#define DUMMYDATA_PERIOD 60 // long enough for some RsIdentities to be generated. #define DUMMYDATA_PERIOD 60 // long enough for some RsIdentities to be generated.
@ -56,8 +54,7 @@ const uint32_t GXSFORUMS_MSG_STORE_PERIOD = 60*60*24*31*12; // 12 months / 1 yea
p3GxsForums::p3GxsForums( RsGeneralDataService *gds, p3GxsForums::p3GxsForums( RsGeneralDataService *gds,
RsNetworkExchangeService *nes, RsGixs* gixs ) : RsNetworkExchangeService *nes, RsGixs* gixs ) :
RsGenExchange( gds, nes, new RsGxsForumSerialiser(), RsGenExchange( gds, nes, new RsGxsForumSerialiser(),
RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy(), RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy()),
GXSFORUMS_MSG_STORE_PERIOD),
RsGxsForums(this), mGenToken(0), mGenActive(false), mGenCount(0) RsGxsForums(this), mGenToken(0), mGenActive(false), mGenCount(0)
{ {
// Test Data disabled in Repo. // Test Data disabled in Repo.

View File

@ -229,7 +229,7 @@ void NewsFeed::updateDisplay()
addFeedItemPeerNew(fi); addFeedItemPeerNew(fi);
break; break;
case RS_FEED_ITEM_PEER_OFFSET: case RS_FEED_ITEM_PEER_OFFSET:
if (flags & RS_FEED_TYPE_PEER) //if (flags & RS_FEED_TYPE_PEER) //Always allow this feed even if Friend notify is disabled.
addFeedItemPeerOffset(fi); addFeedItemPeerOffset(fi);
break; break;

View File

@ -44,7 +44,7 @@ void AvatarDefs::getOwnAvatar(QPixmap &avatar, const QString& defaultImage)
/* load image */ /* load image */
avatar.loadFromData(data, size, "PNG") ; avatar.loadFromData(data, size, "PNG") ;
delete[] data; free(data);
} }
void AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, const QString& defaultImage) void AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, const QString& defaultImage)
{ {
@ -61,7 +61,7 @@ void AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, cons
/* load image */ /* load image */
avatar.loadFromData(data, size, "PNG") ; avatar.loadFromData(data, size, "PNG") ;
delete[] data; free(data);
} }
void AvatarDefs::getAvatarFromGxsId(const RsGxsId& gxsId, QPixmap &avatar, const QString& defaultImage) void AvatarDefs::getAvatarFromGxsId(const RsGxsId& gxsId, QPixmap &avatar, const QString& defaultImage)
{ {
@ -112,5 +112,5 @@ void AvatarDefs::getAvatarFromGpgId(const RsPgpId& gpgId, QPixmap &avatar, const
/* load image */ /* load image */
avatar.loadFromData(data, size, "PNG") ; avatar.loadFromData(data, size, "PNG") ;
delete[] data; free(data);
} }

View File

@ -27,6 +27,7 @@
#include <iostream> #include <iostream>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <gui/common/GroupDefs.h>
/** Constructor */ /** Constructor */
GroupChooser::GroupChooser(QWidget *parent) GroupChooser::GroupChooser(QWidget *parent)
@ -51,7 +52,7 @@ bool GroupChooser::makeNodeGroupDesc(const RsGroupInfo& info, QString &desc)
if(info.name.empty()) if(info.name.empty())
desc = tr("[Unknown]") ; desc = tr("[Unknown]") ;
else else
desc = "\"" + QString::fromUtf8(info.name.c_str()) + "\""; desc = "\"" + GroupDefs::name(info) + "\"";
desc += " [" ; desc += " [" ;
desc += QString::fromStdString(info.id.toStdString().substr(0,3)); desc += QString::fromStdString(info.id.toStdString().substr(0,3));
@ -88,7 +89,7 @@ void GroupChooser::loadGroups()
std::cerr << std::endl; std::cerr << std::endl;
continue; continue;
} }
QString id = QString::fromStdString(it->id.toStdString()); QString id = QString::fromStdString((*it).id.toStdString()) ;
addItem(str, id); addItem(str, id);

View File

@ -323,15 +323,6 @@ RSGraphWidget::resetGraph()
updateIfPossible(); updateIfPossible();
} }
/** Toggles display of respective graph lines and counters. */
//void
//DhtGraph::setShowCounters(bool showRSDHT, bool showALLDHT)
//{
// _showRSDHT = showRSDHT;
// _showALLDHT = showALLDHT;
// this->update();
//}
/** Overloads default QWidget::paintEvent. Draws the actual /** Overloads default QWidget::paintEvent. Draws the actual
* bandwidth graph. */ * bandwidth graph. */
void RSGraphWidget::paintEvent(QPaintEvent *) void RSGraphWidget::paintEvent(QPaintEvent *)
@ -354,9 +345,11 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
/* Paint the scale */ /* Paint the scale */
paintScale1(); paintScale1();
/* Plot the rsDHT/allDHT data */
/* Plot the data */
paintData(); paintData();
/* Paint the rsDHT/allDHT totals */
/* Paint the totals */
paintTotals(); paintTotals();
// part of the scale that needs to write over the data curves. // part of the scale that needs to write over the data curves.
@ -427,17 +420,19 @@ void RSGraphWidget::paintData()
QColor pcolor = getColor(source.displayName(i).toStdString()) ; QColor pcolor = getColor(source.displayName(i).toStdString()) ;
/* Plot the bandwidth data as area graphs */ /* Plot the bandwidth as solid lines. If the graph style is currently an area graph, we end up outlining the integrals. */
if (_flags & RSGRAPH_FLAGS_PAINT_STYLE_PLAIN)
paintIntegral(points, pcolor, _opacity);
/* Plot the bandwidth as solid lines. If the graph style is currently an
* area graph, we end up outlining the integrals. */
if(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) if(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS)
paintDots(points, pcolor); paintDots(points, pcolor);
else else
paintLine(points, pcolor); paintLine(points, pcolor);
/* Plot the data as area graphs */
points.push_front(QPointF( _rec.width(), _rec.height() - _graph_base)) ; // add a point in the lower right corner, to close the path.
if (_flags & RSGRAPH_FLAGS_PAINT_STYLE_PLAIN)
paintIntegral(points, pcolor, _opacity);
} }
if(_maxValue > 0.0f) if(_maxValue > 0.0f)
{ {
@ -520,7 +515,7 @@ void RSGraphWidget::pointsFromData(const std::vector<QPointF>& values,QVector<QP
points << QPointF(px,py) ; points << QPointF(px,py) ;
if(!(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) && (i==values.size()-1)) if(!(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) && (i==values.size()-1))
points << QPointF(px,y) ; points << QPointF(px,py) ;
last_px = px ; last_px = px ;
last_py = py ; last_py = py ;

View File

@ -19,13 +19,15 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <QUrl> #include <QCheckBox>
#include <QDesktopServices>
#include <QMessageBox>
#include <QClipboard> #include <QClipboard>
#include <QDesktopServices>
#include <QFileDialog> #include <QFileDialog>
#include <QTextStream> #include <QLayout>
#include <QMessageBox>
#include <QTextCodec> #include <QTextCodec>
#include <QTextStream>
#include <QUrl>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QUrlQuery> #include <QUrlQuery>
@ -107,7 +109,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
ui->foffRadioButton->hide(); ui->foffRadioButton->hide();
ui->rsidRadioButton->hide(); ui->rsidRadioButton->hide();
ui->fr_label->hide(); ui->cp_Label->hide();
ui->requestinfolabel->hide(); ui->requestinfolabel->hide();
connect(ui->acceptNoSignGPGCheckBox,SIGNAL(toggled(bool)), ui->_options_GB,SLOT(setEnabled(bool))) ; connect(ui->acceptNoSignGPGCheckBox,SIGNAL(toggled(bool)), ui->_options_GB,SLOT(setEnabled(bool))) ;
@ -135,7 +137,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
else else
{ {
ui->userFrame->hide(); // certificates page - top half with own cert and it's functions ui->userFrame->hide(); // certificates page - top half with own cert and it's functions
ui->horizontalLayout_13->hide(); // Advanced options - key sign, whitelist, direct source ... ui->cp_Frame->hide(); // Advanced options - key sign, whitelist, direct source ...
AdvancedVisible=false; AdvancedVisible=false;
ui->trustLabel->hide(); ui->trustLabel->hide();
ui->trustEdit->hide(); ui->trustEdit->hide();
@ -146,6 +148,24 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
if(friendCount<30) if(friendCount<30)
ui->makefriend_infolabel->hide(); ui->makefriend_infolabel->hide();
//Add warning to direct source checkbox depends general setting.
switch (rsFiles->filePermDirectDL())
{
case RS_FILE_PERM_DIRECT_DL_YES:
ui->_direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB->setToolTip(ui->_direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
ui->_direct_transfer_CB_2->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB_2->setToolTip(ui->_direct_transfer_CB_2->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
break ;
case RS_FILE_PERM_DIRECT_DL_NO:
ui->_direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB->setToolTip(ui->_direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
ui->_direct_transfer_CB_2->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB_2->setToolTip(ui->_direct_transfer_CB_2->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
break ;
default: break ;
}
updateStylesheet(); updateStylesheet();
} }
@ -279,7 +299,7 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion); //setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
setStartId(Page_Conclusion); setStartId(Page_Conclusion);
if (friendRequest){ if (friendRequest){
ui->fr_label->show(); ui->cp_Label->show();
ui->requestinfolabel->show(); ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage, tr("Friend request")); setTitleText(ui->ConclusionPage, tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request")); ui->ConclusionPage->setSubTitle(tr("Details about the request"));
@ -305,7 +325,7 @@ void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId,
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion); //setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
setStartId(Page_Conclusion); setStartId(Page_Conclusion);
if (friendRequest){ if (friendRequest){
ui->fr_label->show(); ui->cp_Label->show();
ui->requestinfolabel->show(); ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage,tr("Friend request")); setTitleText(ui->ConclusionPage,tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request")); ui->ConclusionPage->setSubTitle(tr("Details about the request"));
@ -520,7 +540,7 @@ void ConnectFriendWizard::initializePage(int id)
} }
} }
ui->fr_label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str())); ui->cp_Label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str())); ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
ui->trustEdit->setText(trustString); ui->trustEdit->setText(trustString);
ui->emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str())); ui->emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str()));
@ -619,7 +639,7 @@ void ConnectFriendWizard::initializePage(int id)
ui->fr_nodeEdit->setText(loc); ui->fr_nodeEdit->setText(loc);
ui->fr_label_3->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str())); ui->fr_InfoTopLabel->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
fillGroups(this, ui->fr_groupComboBox, groupId); fillGroups(this, ui->fr_groupComboBox, groupId);
} }
@ -1345,13 +1365,13 @@ void ConnectFriendWizard::toggleAdvanced()
{ {
if(AdvancedVisible) if(AdvancedVisible)
{ {
ui->horizontalLayout_13->hide(); ui->cp_Frame->hide();
ui->toggleadvancedButton->setText("Show advanced options"); ui->toggleadvancedButton->setText("Show advanced options");
AdvancedVisible=false; AdvancedVisible=false;
} }
else else
{ {
ui->horizontalLayout_13->show(); ui->cp_Frame->show();
ui->toggleadvancedButton->setText("Hide advanced options"); ui->toggleadvancedButton->setText("Hide advanced options");
AdvancedVisible=true; AdvancedVisible=true;
} }

View File

@ -27,7 +27,7 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Intro</string> <string notr="true">ConnectFriendWizard::Page_Intro</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="IntroPageVLayout">
<item> <item>
<widget class="QRadioButton" name="textRadioButton"> <widget class="QRadioButton" name="textRadioButton">
<property name="text"> <property name="text">
@ -90,12 +90,12 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Text</string> <string notr="true">ConnectFriendWizard::Page_Text</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="TextPageVLayout">
<item> <item>
<widget class="QFrame" name="userFrame"> <widget class="QFrame" name="userFrame">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="userFrameGLayout">
<item row="1" column="1"> <item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="userCertButtonVLayout">
<item> <item>
<widget class="QToolButton" name="userCertHelpButton"> <widget class="QToolButton" name="userCertHelpButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -235,7 +235,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="userCertButtonVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -396,7 +396,7 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Cert</string> <string notr="true">ConnectFriendWizard::Page_Cert</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="CertificatePageVLayout">
<item> <item>
<widget class="QGroupBox" name="userFileFrame"> <widget class="QGroupBox" name="userFileFrame">
<property name="title"> <property name="title">
@ -405,7 +405,7 @@
<property name="flat"> <property name="flat">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="userFileFrameHLayout">
<item> <item>
<widget class="QLabel" name="userFileLabel"> <widget class="QLabel" name="userFileLabel">
<property name="text"> <property name="text">
@ -434,7 +434,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="friendFileNameHLayout">
<item> <item>
<widget class="DropLineEdit" name="friendFileNameEdit"/> <widget class="DropLineEdit" name="friendFileNameEdit"/>
</item> </item>
@ -459,9 +459,9 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Foff</string> <string notr="true">ConnectFriendWizard::Page_Foff</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_11"> <layout class="QVBoxLayout" name="FofPageVLayout">
<item> <item>
<widget class="QLabel" name="userFileLabel_2"> <widget class="QLabel" name="userSelectionLabel">
<property name="text"> <property name="text">
<string>Show me:</string> <string>Show me:</string>
</property> </property>
@ -506,7 +506,7 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Rsid</string> <string notr="true">ConnectFriendWizard::Page_Rsid</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="RsidPageVLayout">
<item> <item>
<widget class="QGroupBox" name="userRsidFrame"> <widget class="QGroupBox" name="userRsidFrame">
<property name="title"> <property name="title">
@ -515,7 +515,7 @@
<property name="flat"> <property name="flat">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"/> <layout class="QVBoxLayout" name="userRsidFrameVLayout"/>
</widget> </widget>
</item> </item>
<item> <item>
@ -534,7 +534,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWizardPage" name="WebmalPage"> <widget class="QWizardPage" name="WebmailPage">
<property name="title"> <property name="title">
<string>RetroShare is better with Friends </string> <string>RetroShare is better with Friends </string>
</property> </property>
@ -544,9 +544,9 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_WebMail</string> <string notr="true">ConnectFriendWizard::Page_WebMail</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="WebmalPageGLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_10"> <layout class="QHBoxLayout" name="webMailButtonHLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>9</number> <number>9</number>
</property> </property>
@ -560,7 +560,7 @@
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="webMailButtonLHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -693,7 +693,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="webMailButtonRHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -711,37 +711,7 @@
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12"> <spacer name="WebmailPageVSpacer">
<item>
<spacer name="horizontalSpacer_3">
<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>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -765,9 +735,9 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Email</string> <string notr="true">ConnectFriendWizard::Page_Email</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="EmailPageVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="addressHLayout">
<item> <item>
<widget class="QLabel" name="addressLabel"> <widget class="QLabel" name="addressLabel">
<property name="text"> <property name="text">
@ -785,7 +755,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="subjectHLayout">
<item> <item>
<widget class="QLabel" name="subjectLabel"> <widget class="QLabel" name="subjectLabel">
<property name="text"> <property name="text">
@ -817,7 +787,7 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_FriendRequest</string> <string notr="true">ConnectFriendWizard::Page_FriendRequest</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_15"> <layout class="QVBoxLayout" name="FriendRequestPageVLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>6</number> <number>6</number>
</property> </property>
@ -825,10 +795,10 @@
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QFrame" name="frame"> <widget class="QFrame" name="fr_Frame">
<layout class="QVBoxLayout" name="verticalLayout_13"> <layout class="QVBoxLayout" name="fr_FrameVLayout">
<item> <item>
<widget class="StyledLabel" name="fr_label_3"> <widget class="StyledLabel" name="fr_InfoTopLabel">
<property name="text"> <property name="text">
<string notr="true">You have a friend request from</string> <string notr="true">You have a friend request from</string>
</property> </property>
@ -857,7 +827,7 @@
<property name="title"> <property name="title">
<string>Peer details</string> <string>Peer details</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_3"> <layout class="QFormLayout" name="fr_peerDetailsFrameGLayout">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
@ -909,15 +879,15 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="fr_optionslLayout"> <layout class="QHBoxLayout" name="fr_optionsHLayout">
<item> <item>
<widget class="QGroupBox" name="fr_optionsFrame"> <widget class="QGroupBox" name="fr_optionsFrame">
<property name="title"> <property name="title">
<string>Options</string> <string>Options</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_14"> <layout class="QVBoxLayout" name="fr_optionsFrameVLayout">
<item> <item>
<layout class="QHBoxLayout" name="fr_groupLayout"> <layout class="QHBoxLayout" name="fr_groupHLayout">
<item> <item>
<widget class="QLabel" name="fr_groupLabel"> <widget class="QLabel" name="fr_groupLabel">
<property name="sizePolicy"> <property name="sizePolicy">
@ -961,11 +931,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="fr_RVBox">
<property name="title"> <property name="title">
<string>Options</string> <string>Options</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_12"> <layout class="QVBoxLayout" name="fr_RVBoxVLayout">
<item> <item>
<widget class="QCheckBox" name="_direct_transfer_CB"> <widget class="QCheckBox" name="_direct_transfer_CB">
<property name="text"> <property name="text">
@ -988,7 +958,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_5"> <spacer name="fr_RVBoxVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -1009,14 +979,14 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="StyledLabel" name="requestinfolabel_3"> <widget class="StyledLabel" name="fr_InfoBottomLabel">
<property name="text"> <property name="text">
<string>To accept the Friend Request, click the Finish button.</string> <string>To accept the Friend Request, click the Finish button.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="fr_verticalSpacer"> <spacer name="fr_VSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -1040,7 +1010,7 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_ErrorMessage</string> <string notr="true">ConnectFriendWizard::Page_ErrorMessage</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="ErrorMessagePageVLayout">
<item> <item>
<widget class="QLabel" name="messageLabel"> <widget class="QLabel" name="messageLabel">
<property name="text"> <property name="text">
@ -1060,7 +1030,7 @@
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Conclusion</string> <string notr="true">ConnectFriendWizard::Page_Conclusion</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="ConclusionPageVLayout">
<item> <item>
<widget class="StyledLabel" name="makefriend_infolabel"> <widget class="StyledLabel" name="makefriend_infolabel">
<property name="palette"> <property name="palette">
@ -1143,7 +1113,7 @@ resources.</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="StyledLabel" name="fr_label"> <widget class="StyledLabel" name="cp_Label">
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>
@ -1230,7 +1200,7 @@ resources.</string>
<property name="title"> <property name="title">
<string>Peer details</string> <string>Peer details</string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="peerDetailsFrameGLayout">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
@ -1342,13 +1312,13 @@ resources.</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="horizontalLayout_13"> <widget class="QFrame" name="cp_Frame">
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="cp_FrameHLayout">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_18"> <layout class="QVBoxLayout" name="cp_KeyVLayout">
<item> <item>
<widget class="QCheckBox" name="addKeyToKeyring_CB"> <widget class="QCheckBox" name="addKeyToKeyring_CB">
<property name="text"> <property name="text">
@ -1374,7 +1344,7 @@ resources.</string>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_11"> <layout class="QHBoxLayout" name="cp_AddIPHLayout">
<item> <item>
<widget class="QCheckBox" name="_addIPToWhiteList_CB_2"> <widget class="QCheckBox" name="_addIPToWhiteList_CB_2">
<property name="text"> <property name="text">
@ -1388,7 +1358,7 @@ resources.</string>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_9"> <layout class="QHBoxLayout" name="cp_GroupHLayout">
<item> <item>
<widget class="QLabel" name="groupLabel"> <widget class="QLabel" name="groupLabel">
<property name="text"> <property name="text">
@ -1404,7 +1374,7 @@ resources.</string>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_19"> <layout class="QVBoxLayout" name="cp_OptionVLayout">
<item> <item>
<widget class="QGroupBox" name="_options_GB"> <widget class="QGroupBox" name="_options_GB">
<property name="title"> <property name="title">
@ -1445,7 +1415,7 @@ resources.</string>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_4"> <spacer name="cp_OptionVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -1543,7 +1513,7 @@ resources.</string>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="ConclusionPageVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -1567,9 +1537,9 @@ resources.</string>
<attribute name="pageId"> <attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_FriendRecommendations</string> <string notr="true">ConnectFriendWizard::Page_FriendRecommendations</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="FriendRecommendationsPageVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_8"> <layout class="QHBoxLayout" name="frec_HLayout">
<item> <item>
<widget class="FriendSelectionWidget" name="frec_recommendList" native="true"> <widget class="FriendSelectionWidget" name="frec_recommendList" native="true">
<property name="sizePolicy"> <property name="sizePolicy">

View File

@ -152,6 +152,20 @@ void PGPKeyDialog::load()
ui.pgpfingerprint_label->show(); ui.pgpfingerprint_label->show();
ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_DIRECT_DL ) ; ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_DIRECT_DL ) ;
//Add warning to direct source checkbox depends general setting.
switch (rsFiles->filePermDirectDL())
{
case RS_FILE_PERM_DIRECT_DL_YES:
ui._direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui._direct_transfer_CB->setToolTip(ui._direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
break ;
case RS_FILE_PERM_DIRECT_DL_NO:
ui._direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui._direct_transfer_CB->setToolTip(ui._direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
break ;
default: break ;
}
ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ; ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ;
ui._require_WL_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ; ui._require_WL_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;

View File

@ -38,6 +38,7 @@
#include "gui/gxschannels/CreateGxsChannelMsg.h" #include "gui/gxschannels/CreateGxsChannelMsg.h"
#include <iostream> #include <iostream>
#include <cmath>
/**** /****
* #define DEBUG_ITEM 1 * #define DEBUG_ITEM 1
@ -46,16 +47,29 @@
#define COLOR_NORMAL QColor(248, 248, 248) #define COLOR_NORMAL QColor(248, 248, 248)
#define COLOR_NEW QColor(220, 236, 253) #define COLOR_NEW QColor(220, 236, 253)
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) : GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate)
{ {
QVector<RsGxsMessageId> v;
bool self = false;
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
v.push_back(*it) ;
if(older_versions.find(messageId) == older_versions.end())
v.push_back(messageId);
setMessageVersions(v) ;
setup(); setup();
requestGroup(); mLoaded = false ;
requestMessage();
requestComment();
} }
// This code has been suspended because it adds more complexity than usefulness.
// It was used to load a channel post where the post item is already known.
#ifdef SUSPENDED
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) : GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate) GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
{ {
@ -81,10 +95,10 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
setup(); setup();
//setGroup(group, false); setGroup(group, false);
requestGroup();
setPost(post); setPost(post,false);
requestComment(); mLoaded = false ;
} }
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) : GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
@ -97,10 +111,30 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
setup(); setup();
mLoaded = true ;
requestGroup(); requestGroup();
setPost(post); setPost(post);
requestComment(); requestComment();
} }
#endif
void GxsChannelPostItem::paintEvent(QPaintEvent *e)
{
/* This method employs a trick to trigger a deferred loading. The post and group is requested only
* when actually displayed on the screen. */
if(!mLoaded)
{
mLoaded = true ;
requestGroup();
requestMessage();
requestComment();
}
GxsFeedItem::paintEvent(e) ;
}
GxsChannelPostItem::~GxsChannelPostItem() GxsChannelPostItem::~GxsChannelPostItem()
{ {
@ -349,6 +383,14 @@ void GxsChannelPostItem::fill()
QString title; QString title;
if(mPost.mThumbnail.mData != NULL)
{
QPixmap thumbnail;
thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG");
// Wiping data - as its been passed to thumbnail.
ui->logoLabel->setPixmap(thumbnail);
}
if (!mIsHome) if (!mIsHome)
{ {
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) { if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
@ -386,9 +428,12 @@ void GxsChannelPostItem::fill()
/* subject */ /* subject */
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str())); ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->titleLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height());
// fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy // fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy
//ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 4), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 4)) ;
//ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
//QString score = QString::number(post.mTopScore); //QString score = QString::number(post.mTopScore);
// scoreLabel->setText(score); // scoreLabel->setText(score);
@ -496,14 +541,6 @@ void GxsChannelPostItem::fill()
layout->addWidget(fi); layout->addWidget(fi);
} }
if(mPost.mThumbnail.mData != NULL)
{
QPixmap thumbnail;
thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG");
// Wiping data - as its been passed to thumbnail.
ui->logoLabel->setPixmap(thumbnail);
}
mInFill = false; mInFill = false;
} }

View File

@ -41,9 +41,14 @@ class GxsChannelPostItem : public GxsFeedItem
Q_OBJECT Q_OBJECT
public: public:
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate); // This one is used in NewFeed for incoming channel posts. Only the group and msg ids are known at this point.
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); // It can be used for all apparences of channel posts. But in rder to merge comments from the previous versions of the post, the list of
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); // previous posts should be supplied. It's optional. If not supplied only the comments of the new version will be displayed.
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
virtual ~GxsChannelPostItem(); virtual ~GxsChannelPostItem();
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true); bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
@ -62,6 +67,11 @@ protected:
virtual void doExpand(bool open); virtual void doExpand(bool open);
virtual void expandFill(bool first); virtual void expandFill(bool first);
// This does nothing except triggering the loading of the post data and comments. This function is mainly used to detect
// when the post is actually made visible.
virtual void paintEvent(QPaintEvent *);
/* GxsGroupFeedItem */ /* GxsGroupFeedItem */
virtual QString groupName(); virtual QString groupName();
virtual void loadGroup(const uint32_t &token); virtual void loadGroup(const uint32_t &token);
@ -101,6 +111,7 @@ private:
private: private:
bool mInFill; bool mInFill;
bool mCloseOnRead; bool mCloseOnRead;
bool mLoaded;
RsGxsChannelGroup mGroup; RsGxsChannelGroup mGroup;
RsGxsChannelPost mPost; RsGxsChannelPost mPost;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1237</width> <width>1237</width>
<height>622</height> <height>1145</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -370,7 +370,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Messages will only be distributed to the selected subset of your friend nodes. They will not forward messages with each other, but only use your own node as a central hub to distribute them.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Messages will only be distributed to the selected subset of your friend nodes. They will not forward messages with each other, but only use your own node as a central hub to distribute them.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Only For Your Friends</string> <string>Restricted node group </string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../icons.qrc"> <iconset resource="../icons.qrc">
@ -917,8 +917,8 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -815,8 +815,8 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
} }
else else
{ {
/* rate the others by popularity */ //popMap.insert(std::make_pair(it->mPop, groupItemInfo)); /* rate the others by popularity */
popMap.insert(std::make_pair(it->mPop, groupItemInfo)); popMap.insert(std::make_pair(it->mLastPost, groupItemInfo)); /* rate the others by time of last post */
} }
} }
@ -830,17 +830,17 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
uint32_t i = 0; uint32_t i = 0;
uint32_t popLimit = 0; uint32_t popLimit = 0;
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit; std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); ++rit, ++i) ; //for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); ++rit, ++i) ;
if (rit != popMap.rend()) { //if (rit != popMap.rend()) {
popLimit = rit->first; // popLimit = rit->first;
} //}
for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit) { for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit,++i) {
if (rit->second.popularity < (int) popLimit) { //if (rit->second.popularity > (int) popLimit) {
otherList.append(rit->second); if(i < popCount)
} else {
popList.append(rit->second); popList.append(rit->second);
} else
otherList.append(rit->second);
} }
/* now we can add them in as a tree! */ /* now we can add them in as a tree! */

View File

@ -407,10 +407,12 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
if(item) if(item)
{ {
ui->feedWidget->removeFeedItem(item) ; ui->feedWidget->removeFeedItem(item) ;
RsGxsChannelGroup dummyGroup; //RsGxsChannelGroup dummyGroup;
dummyGroup.mMeta.mGroupId = groupId(); //dummyGroup.mMeta.mGroupId = groupId();
dummyGroup.mMeta.mSubscribeFlags = 0xffffffff; //dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false); //GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, false,post.mOlderVersions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
return ; return ;
@ -427,10 +429,13 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
} else { } else {
/* Group is not always available because of the TokenQueue */ /* Group is not always available because of the TokenQueue */
RsGxsChannelGroup dummyGroup;
dummyGroup.mMeta.mGroupId = groupId(); //RsGxsChannelGroup dummyGroup;
dummyGroup.mMeta.mSubscribeFlags = 0xffffffff; //dummyGroup.mMeta.mGroupId = groupId();
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false); //dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
//GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, false,post.mOlderVersions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
} }

View File

@ -135,7 +135,7 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview())); connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl))); connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
connect(ui.sendinviteButton, SIGNAL(clicked()), this, SLOT(sendInvite())); connect(ui.sendInviteButton, SIGNAL(clicked()), this, SLOT(sendInvite()));
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged())); connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged())); connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));
@ -160,10 +160,13 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
QFont font = QFont("Arial", 10, QFont::Bold); QFont font = QFont("Arial", 10, QFont::Bold);
ui.subjectText->setFont(font); ui.subjectText->setFont(font);
ui.bcclabel->setVisible(false); ui.toText->setMaximumHeight(ui.toText->fontMetrics().lineSpacing()*1.5);
ui.bccText->setVisible(false); ui.ccLabel->setVisible(false);
ui.cclabel->setVisible(false);
ui.ccText->setVisible(false); ui.ccText->setVisible(false);
ui.ccText->setMaximumHeight(ui.ccText->fontMetrics().lineSpacing()*1.5);
ui.bccLabel->setVisible(false);
ui.bccText->setVisible(false);
ui.bccText->setMaximumHeight(ui.bccText->fontMetrics().lineSpacing()*1.5);
ui.tagsLabel->setVisible(false); ui.tagsLabel->setVisible(false);
@ -454,11 +457,11 @@ void MessageWidget::fill(const std::string &msgId)
ui.fromText->setText(""); ui.fromText->setText("");
ui.filesText->setText(""); ui.filesText->setText("");
ui.cclabel->setVisible(false); ui.ccLabel->setVisible(false);
ui.ccText->setVisible(false); ui.ccText->setVisible(false);
ui.ccText->clear(); ui.ccText->clear();
ui.bcclabel->setVisible(false); ui.bccLabel->setVisible(false);
ui.bccText->setVisible(false); ui.bccText->setVisible(false);
ui.bccText->clear(); ui.bccText->clear();
@ -519,7 +522,7 @@ void MessageWidget::fill(const std::string &msgId)
if (!msgInfo.rspeerid_msgcc.empty() || !msgInfo.rsgxsid_msgcc.empty()) if (!msgInfo.rspeerid_msgcc.empty() || !msgInfo.rsgxsid_msgcc.empty())
{ {
ui.cclabel->setVisible(true); ui.ccLabel->setVisible(true);
ui.ccText->setVisible(true); ui.ccText->setVisible(true);
text.clear(); text.clear();
@ -528,14 +531,14 @@ void MessageWidget::fill(const std::string &msgId)
ui.ccText->setText(text); ui.ccText->setText(text);
} else { } else {
ui.cclabel->setVisible(false); ui.ccLabel->setVisible(false);
ui.ccText->setVisible(false); ui.ccText->setVisible(false);
ui.ccText->clear(); ui.ccText->clear();
} }
if (!msgInfo.rspeerid_msgbcc.empty() || !msgInfo.rsgxsid_msgbcc.empty()) if (!msgInfo.rspeerid_msgbcc.empty() || !msgInfo.rsgxsid_msgbcc.empty())
{ {
ui.bcclabel->setVisible(true); ui.bccLabel->setVisible(true);
ui.bccText->setVisible(true); ui.bccText->setVisible(true);
text.clear(); text.clear();
@ -544,7 +547,7 @@ void MessageWidget::fill(const std::string &msgId)
ui.bccText->setText(text); ui.bccText->setText(text);
} else { } else {
ui.bcclabel->setVisible(false); ui.bccLabel->setVisible(false);
ui.bccText->setVisible(false); ui.bccText->setVisible(false);
ui.bccText->clear(); ui.bccText->clear();
} }

View File

@ -10,7 +10,7 @@
<height>539</height> <height>539</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QHBoxLayout" name="MessageWidgetHLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -23,36 +23,28 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item>
<widget class="QSplitter" name="mainSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QSplitter" name="msgSplitter"> <widget class="QSplitter" name="msgSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QSplitter" name="msgSplitter_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="msgSplitterVLayout">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<layout class="QHBoxLayout" name="_4"> <layout class="QGridLayout" name="msgSplitterGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>6</number> <number>6</number>
</property> </property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin"> <property name="rightMargin">
<number>6</number> <number>6</number>
</property> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="_5">
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>6</number> <number>6</number>
</property> </property>
@ -60,7 +52,7 @@
<number>3</number> <number>3</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="subjectlabel"> <widget class="QLabel" name="subjectLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -75,8 +67,50 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2" colspan="2">
<layout class="QHBoxLayout" name="subjectHLayout">
<item>
<widget class="QLabel" name="subjectText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dateText">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string notr="true">Date</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="fromlabel"> <widget class="QLabel" name="fromLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -120,7 +154,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="tolabel"> <widget class="QLabel" name="toLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -136,9 +170,18 @@
</widget> </widget>
</item> </item>
<item row="2" column="2" colspan="2"> <item row="2" column="2" colspan="2">
<widget class="QLabel" name="toText"> <widget class="RSTextBrowser" name="toText">
<property name="wordWrap"> <property name="sizePolicy">
<bool>true</bool> <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -146,7 +189,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="cclabel"> <widget class="QLabel" name="ccLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -164,8 +207,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2" colspan="2">
<widget class="RSTextBrowser" name="ccText">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="bcclabel"> <widget class="QLabel" name="bccLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -180,20 +236,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2" colspan="2">
<widget class="QLabel" name="ccText">
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2"> <item row="4" column="2" colspan="2">
<widget class="QLabel" name="bccText"> <widget class="RSTextBrowser" name="bccText">
<property name="wordWrap"> <property name="maximumSize">
<bool>true</bool> <size>
<width>16777215</width>
<height>16</height>
</size>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -219,50 +268,6 @@
<item row="5" column="2" colspan="2"> <item row="5" column="2" colspan="2">
<layout class="QHBoxLayout" name="tagLayout"/> <layout class="QHBoxLayout" name="tagLayout"/>
</item> </item>
<item row="0" column="2" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="subjectText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dateText">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string notr="true">Date</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -403,14 +408,14 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="sendinviteButton"> <widget class="QPushButton" name="sendInviteButton">
<property name="text"> <property name="text">
<string>Send Invite</string> <string>Send Invite</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="inviteHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -426,9 +431,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="_2"> <layout class="QHBoxLayout" name="filesHLayout">
<item> <item>
<layout class="QGridLayout" name="_3"> <layout class="QGridLayout" name="filesGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -445,7 +450,7 @@
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="attLabel">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@ -455,7 +460,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="0" column="4">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="recFilesLabel">
<property name="text"> <property name="text">
<string>Recommended Files</string> <string>Recommended Files</string>
</property> </property>
@ -498,7 +503,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<spacer> <spacer name="filesHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>

View File

@ -1,281 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "RelayPage.h"
#include "rshare.h"
#include <iostream>
#include <retroshare/rsiface.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdht.h>
#include "util/misc.h"
#include <QTimer>
RelayPage::RelayPage(QWidget * parent, Qt::WindowFlags flags)
: ConfigPage(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.addPushButton,SIGNAL(clicked()),this,SLOT(addServer()));
QObject::connect(ui.removePushButton,SIGNAL(clicked()),this,SLOT(removeServer()));
QObject::connect(ui.DhtLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(checkKey()));
QObject::connect(ui.enableCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
QObject::connect(ui.serverCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
}
QString RelayPage::helpText() const
{
return tr("<h1><img width=\"24\" src=\":/icons/help_64.png\">&nbsp;&nbsp;Relays</h1> \
<p>By activating relays, you allow your Retroshare node to act as a bridge between Retroshare \
users who cannot connect directly, e.g. because they're firewalled.</p> \
<p>You may choose to act as a relay by checking <i>enable relay connections</i>, or simply \
benefit from other peers acting as relay, by checking <i>use relay servers</i>. For the former,\
you may specify the bandwidth allocated when acting as a relay for friends of you, for friends \
of your friends, or anyone in the Retroshare network.</p> \
<p>In any case, a Retroshare node acting as a relay cannot see the relayed traffic, since it \
is encrypted and authenticated by the two relayed nodes.</p>") ;
}
void RelayPage::updateTotals()
{
int nFriends = ui.noFriendSpinBox->value();
int friendBandwidth = ui.bandFriendSpinBox->value();
int nFOF = ui.noFOFSpinBox->value();
int fofBandwidth = ui.bandFOFSpinBox->value();
int nGeneral = ui.noGeneralSpinBox->value();
int genBandwidth = ui.bandGeneralSpinBox->value();
int total = nFriends + nFOF + nGeneral;
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_ALL, total, 0);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, nFriends, 1024 * friendBandwidth);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FOF, nFOF, 1024 * fofBandwidth);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth);
}
/** Saves the changes on this page */
void RelayPage::updateRelayMode()
{
uint32_t relayMode = 0;
if (ui.enableCheckBox->isChecked())
{
relayMode |= RSDHT_RELAY_ENABLED;
if (ui.serverCheckBox->isChecked())
{
relayMode |= RSDHT_RELAY_MODE_ON;
}
else
{
relayMode |= RSDHT_RELAY_MODE_OFF;
}
}
else
{
relayMode |= RSDHT_RELAY_MODE_OFF;
}
rsDht->setRelayMode(relayMode);
}
/** Loads the settings for this page */
void RelayPage::load()
{
uint32_t count;
uint32_t bandwidth;
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, count, bandwidth);
whileBlocking(ui.noFriendSpinBox)->setValue(count);
whileBlocking(ui.bandFriendSpinBox)->setValue(bandwidth / 1024);
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FOF, count, bandwidth);
whileBlocking(ui.noFOFSpinBox)->setValue(count);
whileBlocking(ui.bandFOFSpinBox)->setValue(bandwidth / 1024);
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, count, bandwidth);
whileBlocking(ui.noGeneralSpinBox)->setValue(count);
whileBlocking(ui.bandGeneralSpinBox)->setValue(bandwidth / 1024);
updateTotals();
uint32_t relayMode = rsDht->getRelayMode();
if (relayMode & RSDHT_RELAY_ENABLED)
{
whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Checked);
if ((relayMode & RSDHT_RELAY_MODE_MASK) == RSDHT_RELAY_MODE_OFF)
{
whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked);
}
else
{
whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Checked);
}
}
else
{
whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Unchecked);
whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked);
}
loadServers();
updateRelayOptions();
updateEnabled();
checkKey();
}
void RelayPage::loadServers()
{
std::list<std::string> servers;
std::list<std::string>::iterator it;
rsDht->getRelayServerList(servers);
ui.serverTreeWidget->clear();
for(it = servers.begin(); it != servers.end(); ++it)
{
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setData(0, Qt::DisplayRole, QString::fromStdString(*it));
ui.serverTreeWidget->addTopLevelItem(item);
}
}
void RelayPage::updateRelayOptions()
{
int nFriends = ui.noFriendSpinBox->value();
int friendBandwidth = ui.bandFriendSpinBox->value();
int nFOF = ui.noFOFSpinBox->value();
int fofBandwidth = ui.bandFOFSpinBox->value();
int nGeneral = ui.noGeneralSpinBox->value();
int genBandwidth = ui.bandGeneralSpinBox->value();
ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2));
ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2));
ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2));
ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2));
ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral));
}
void RelayPage::updateEnabled()
{
std::cerr << "RelayPage::updateEnabled()" << std::endl;
if (ui.enableCheckBox->isChecked())
{
ui.relayOptionGBox->setEnabled(true);
if (ui.serverCheckBox->isChecked())
{
std::cerr << "RelayPage::updateEnabled() Both Enabled" << std::endl;
ui.serverGroupBox->setEnabled(true);
}
else
{
std::cerr << "RelayPage::updateEnabled() Options Only Enabled" << std::endl;
ui.serverGroupBox->setEnabled(false);
}
}
else
{
std::cerr << "RelayPage::updateEnabled() Both Disabled" << std::endl;
ui.relayOptionGBox->setEnabled(false);
ui.serverGroupBox->setEnabled(false);
}
}
void RelayPage::checkKey()
{
std::string server = ui.DhtLineEdit->text().toStdString();
std::cerr << "RelayPage::checkKey() length: " << server.length();
std::cerr << std::endl;
if (server.length() == 40)
{
ui.keyOkBox->setChecked(Qt::Checked);
}
else
{
ui.keyOkBox->setChecked(Qt::Unchecked);
}
}
void RelayPage::addServer()
{
std::cerr << "RelayPage::addServer()";
std::cerr << std::endl;
if (!ui.keyOkBox->isChecked())
{
return;
}
std::string server = ui.DhtLineEdit->text().toStdString();
bool ok = rsDht->addRelayServer(server);
if (ok)
{
ui.DhtLineEdit->setText(QString(""));
}
loadServers();
}
void RelayPage::removeServer()
{
QTreeWidgetItem *item = ui.serverTreeWidget->currentItem();
if (item)
{
std::string server = item->data(0, Qt::DisplayRole).toString().toStdString();
rsDht->removeRelayServer(server);
}
loadServers();
}

View File

@ -1,61 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef RELAYPAGE_H
#define RELAYPAGE_H
# include <QWidget>
#include <retroshare-gui/configpage.h>
#include "ui_RelayPage.h"
class RelayPage: public ConfigPage
{
Q_OBJECT
public:
RelayPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~RelayPage() {}
/** Loads the settings for this page */
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/server.svg") ; }
virtual QString pageName() const { return tr("Relay") ; }
virtual QString helpText() const ;
public slots:
void updateRelayOptions();
void updateEnabled();
void checkKey();
void addServer();
void removeServer();
void loadServers();
void updateTotals();
void updateRelayMode();
private:
Ui::RelayPage ui;
};
#endif //RELAYPAGE_H

View File

@ -1,416 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RelayPage</class>
<widget class="QWidget" name="RelayPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>794</width>
<height>546</height>
</rect>
</property>
<layout class="QVBoxLayout" name="RelayPageVLayout">
<item>
<layout class="QHBoxLayout" name="topHLayout">
<item>
<widget class="QCheckBox" name="enableCheckBox">
<property name="text">
<string>Enable Relay Connections</string>
</property>
</widget>
</item>
<item>
<spacer name="topLeftHSpacer">
<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="QCheckBox" name="serverCheckBox">
<property name="text">
<string>Use Relay Servers</string>
</property>
</widget>
</item>
<item>
<spacer name="topRightHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="relayOptionGBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Relay options</string>
</property>
<layout class="QGridLayout" name="relayOptionGBoxGLayout">
<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>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="optionHeaderLHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>110</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="headerNumberLabel">
<property name="text">
<string>Number</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="optionHeaderRHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="headerBandwidthLabel">
<property name="text">
<string>Bandwidth per link</string>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="7">
<widget class="Line" name="totalVLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="headerTotalLabel">
<property name="text">
<string>Total Bandwidth</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QLabel" name="friendLabel">
<property name="text">
<string>Friends</string>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<widget class="QSpinBox" name="noFriendSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2" rowspan="2">
<widget class="QLabel" name="xFriendLabel">
<property name="text">
<string notr="true">x</string>
</property>
</widget>
</item>
<item row="1" column="3" rowspan="2">
<widget class="QSpinBox" name="bandFriendSpinBox">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLineEdit" name="totalFriendLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" rowspan="2">
<widget class="QLabel" name="fofLabel">
<property name="text">
<string>Friends of Friends</string>
</property>
</widget>
</item>
<item row="3" column="1" rowspan="2">
<widget class="QSpinBox" name="noFOFSpinBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="2" rowspan="2">
<widget class="QLabel" name="xFOFLabel">
<property name="text">
<string notr="true">x</string>
</property>
</widget>
</item>
<item row="3" column="3" rowspan="2">
<widget class="QSpinBox" name="bandFOFSpinBox">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="5">
<widget class="QLineEdit" name="totalFOFLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" rowspan="2">
<widget class="QLabel" name="generalLabel">
<property name="text">
<string>General</string>
</property>
</widget>
</item>
<item row="5" column="1" rowspan="2">
<widget class="QSpinBox" name="noGeneralSpinBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="5" column="2" rowspan="2">
<widget class="QLabel" name="xGeneralLabel">
<property name="text">
<string notr="true">x</string>
</property>
</widget>
</item>
<item row="5" column="3" rowspan="2">
<widget class="QSpinBox" name="bandGeneralSpinBox">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QLineEdit" name="totalGeneralLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="6">
<widget class="Line" name="totalHLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="totalLabel">
<property name="text">
<string>Total:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="noTotalLineEdit">
<property name="focusPolicy">
<enum>Qt::WheelFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="2" colspan="2">
<spacer name="totalHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>123</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="5">
<widget class="QLineEdit" name="totalBandwidthLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0" colspan="6">
<widget class="QLabel" name="warningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"> border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
</string>
</property>
<property name="text">
<string>Warning: This bandwidth adds up to the max bandwidth.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="serverGroupBox">
<property name="title">
<string>Relay Server Setup</string>
</property>
<layout class="QGridLayout" name="serverGroupBoxGLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="DhtLineEdit">
<property name="inputMask">
<string notr="true">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="keyOkBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="addPushButton">
<property name="text">
<string>Add Server</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTreeWidget" name="serverTreeWidget">
<column>
<property name="text">
<string>Server DHT Key</string>
</property>
</column>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="removePushButton">
<property name="text">
<string>Remove Server</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="mainVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -29,11 +29,13 @@
#include <iostream> #include <iostream>
#include <retroshare/rsbanlist.h>
#include <retroshare/rsconfig.h> #include <retroshare/rsconfig.h>
#include <retroshare/rsdht.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsturtle.h> #include <retroshare/rsturtle.h>
#include <retroshare/rsbanlist.h>
#include <QCheckBox>
#include <QMovie> #include <QMovie>
#include <QMenu> #include <QMenu>
#include <QTcpSocket> #include <QTcpSocket>
@ -170,6 +172,32 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.totalDownloadRate,SIGNAL(valueChanged(int)),this,SLOT(saveRates())); connect(ui.totalDownloadRate,SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
connect(ui.totalUploadRate, SIGNAL(valueChanged(int)),this,SLOT(saveRates())); connect(ui.totalUploadRate, SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
//Relay Tab
QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
QObject::connect(ui.addPushButton,SIGNAL(clicked()),this,SLOT(addServer()));
QObject::connect(ui.removePushButton,SIGNAL(clicked()),this,SLOT(removeServer()));
QObject::connect(ui.DhtLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(checkKey()));
QObject::connect(ui.enableCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
QObject::connect(ui.serverCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
} }
void ServerPage::saveAndTestInProxy() void ServerPage::saveAndTestInProxy()
@ -373,6 +401,49 @@ void ServerPage::load()
updateOutProxyIndicator(); updateOutProxyIndicator();
} }
//Relay Tab
uint32_t count;
uint32_t bandwidth;
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, count, bandwidth);
whileBlocking(ui.noFriendSpinBox)->setValue(count);
whileBlocking(ui.bandFriendSpinBox)->setValue(bandwidth / 1024);
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FOF, count, bandwidth);
whileBlocking(ui.noFOFSpinBox)->setValue(count);
whileBlocking(ui.bandFOFSpinBox)->setValue(bandwidth / 1024);
rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, count, bandwidth);
whileBlocking(ui.noGeneralSpinBox)->setValue(count);
whileBlocking(ui.bandGeneralSpinBox)->setValue(bandwidth / 1024);
updateTotals();
uint32_t relayMode = rsDht->getRelayMode();
if (relayMode & RSDHT_RELAY_ENABLED)
{
whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Checked);
if ((relayMode & RSDHT_RELAY_MODE_MASK) == RSDHT_RELAY_MODE_OFF)
{
whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked);
}
else
{
whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Checked);
}
}
else
{
whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Unchecked);
whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked);
}
loadServers();
updateRelayOptions();
updateEnabled();
checkKey();
} }
void ServerPage::toggleAutoIncludeFriends(bool b) void ServerPage::toggleAutoIncludeFriends(bool b)
@ -1006,7 +1077,7 @@ void ServerPage::loadHiddenNode()
whileBlocking(ui.hiddenpage_serviceAddress)->setText(QString::fromStdString(detail.hiddenNodeAddress)); whileBlocking(ui.hiddenpage_serviceAddress)->setText(QString::fromStdString(detail.hiddenNodeAddress));
whileBlocking(ui.hiddenpage_servicePort) -> setValue(detail.hiddenNodePort); whileBlocking(ui.hiddenpage_servicePort) -> setValue(detail.hiddenNodePort);
/* in I2P there is no port - there is only the address */ /* in I2P there is no port - there is only the address */
whileBlocking(ui.hiddenpage_servicePort)->setEnabled(detail.hiddenType != RS_HIDDEN_TYPE_I2P); whileBlocking(ui.hiddenpage_servicePort)->setHidden(detail.hiddenType == RS_HIDDEN_TYPE_I2P);
/* out proxy settings */ /* out proxy settings */
std::string proxyaddr; std::string proxyaddr;
@ -1732,3 +1803,161 @@ void ServerPage::handleNetworkReply(QNetworkReply *reply)
reply->close(); reply->close();
} }
//#####################################################################
//## Relay Tab
//#####################################################################
void ServerPage::updateTotals()
{
int nFriends = ui.noFriendSpinBox->value();
int friendBandwidth = ui.bandFriendSpinBox->value();
int nFOF = ui.noFOFSpinBox->value();
int fofBandwidth = ui.bandFOFSpinBox->value();
int nGeneral = ui.noGeneralSpinBox->value();
int genBandwidth = ui.bandGeneralSpinBox->value();
int total = nFriends + nFOF + nGeneral;
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_ALL, total, 0);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, nFriends, 1024 * friendBandwidth);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FOF, nFOF, 1024 * fofBandwidth);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth);
}
/** Saves the changes on this page */
void ServerPage::updateRelayMode()
{
uint32_t relayMode = 0;
if (ui.enableCheckBox->isChecked())
{
relayMode |= RSDHT_RELAY_ENABLED;
if (ui.serverCheckBox->isChecked())
{
relayMode |= RSDHT_RELAY_MODE_ON;
}
else
{
relayMode |= RSDHT_RELAY_MODE_OFF;
}
}
else
{
relayMode |= RSDHT_RELAY_MODE_OFF;
}
rsDht->setRelayMode(relayMode);
}
void ServerPage::loadServers()
{
std::list<std::string> servers;
std::list<std::string>::iterator it;
rsDht->getRelayServerList(servers);
ui.serverTreeWidget->clear();
for(it = servers.begin(); it != servers.end(); ++it)
{
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setData(0, Qt::DisplayRole, QString::fromStdString(*it));
ui.serverTreeWidget->addTopLevelItem(item);
}
}
void ServerPage::updateRelayOptions()
{
int nFriends = ui.noFriendSpinBox->value();
int friendBandwidth = ui.bandFriendSpinBox->value();
int nFOF = ui.noFOFSpinBox->value();
int fofBandwidth = ui.bandFOFSpinBox->value();
int nGeneral = ui.noGeneralSpinBox->value();
int genBandwidth = ui.bandGeneralSpinBox->value();
ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2));
ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2));
ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2));
ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2));
ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral));
}
void ServerPage::updateEnabled()
{
std::cerr << "RelayPage::updateEnabled()" << std::endl;
if (ui.enableCheckBox->isChecked())
{
ui.relayOptionGBox->setEnabled(true);
if (ui.serverCheckBox->isChecked())
{
std::cerr << "RelayPage::updateEnabled() Both Enabled" << std::endl;
ui.serverGroupBox->setEnabled(true);
}
else
{
std::cerr << "RelayPage::updateEnabled() Options Only Enabled" << std::endl;
ui.serverGroupBox->setEnabled(false);
}
}
else
{
std::cerr << "RelayPage::updateEnabled() Both Disabled" << std::endl;
ui.relayOptionGBox->setEnabled(false);
ui.serverGroupBox->setEnabled(false);
}
}
void ServerPage::checkKey()
{
std::string server = ui.DhtLineEdit->text().toStdString();
std::cerr << "RelayPage::checkKey() length: " << server.length();
std::cerr << std::endl;
if (server.length() == 40)
{
ui.keyOkBox->setChecked(true);
}
else
{
ui.keyOkBox->setChecked(false);
}
}
void ServerPage::addServer()
{
std::cerr << "RelayPage::addServer()";
std::cerr << std::endl;
if (!ui.keyOkBox->isChecked())
{
return;
}
std::string server = ui.DhtLineEdit->text().toStdString();
bool ok = rsDht->addRelayServer(server);
if (ok)
{
ui.DhtLineEdit->setText(QString(""));
}
loadServers();
}
void ServerPage::removeServer()
{
QTreeWidgetItem *item = ui.serverTreeWidget->currentItem();
if (item)
{
std::string server = item->data(0, Qt::DisplayRole).toString().toStdString();
rsDht->removeRelayServer(server);
}
loadServers();
}

View File

@ -114,6 +114,16 @@ private slots:
void connectionWithoutCert(); void connectionWithoutCert();
//Relay Tab
void updateRelayOptions();
void updateEnabled();
void checkKey();
void addServer();
void removeServer();
void loadServers();
void updateTotals();
void updateRelayMode();
// autoProxyCallback interface // autoProxyCallback interface
public: public:
void taskFinished(taskTicket *&ticket); void taskFinished(taskTicket *&ticket);

View File

@ -811,7 +811,7 @@ behind a firewall or a VPN.</string>
<attribute name="title"> <attribute name="title">
<string>Hidden Service Configuration</string> <string>Hidden Service Configuration</string>
</attribute> </attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="tabHiddenConfHLayout">
<item> <item>
<widget class="QTabWidget" name="hiddenServiceTab"> <widget class="QTabWidget" name="hiddenServiceTab">
<property name="sizePolicy"> <property name="sizePolicy">
@ -827,7 +827,7 @@ behind a firewall or a VPN.</string>
<attribute name="title"> <attribute name="title">
<string>Outgoing Manual Tor/I2P</string> <string>Outgoing Manual Tor/I2P</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="hiddenServiceTabManualVLayout">
<item> <item>
<widget class="QLabel" name="hiddenpage_outHeader"> <widget class="QLabel" name="hiddenpage_outHeader">
<property name="text"> <property name="text">
@ -836,7 +836,7 @@ behind a firewall or a VPN.</string>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="hiddenpage_proxyOKHLayoutGLayout">
<item row="0" column="2"> <item row="0" column="2">
<widget class="QSpinBox" name="hiddenpage_proxyPort_tor"> <widget class="QSpinBox" name="hiddenpage_proxyPort_tor">
<property name="toolTip"> <property name="toolTip">
@ -996,9 +996,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<attribute name="title"> <attribute name="title">
<string>Automatic I2P/BOB</string> <string>Automatic I2P/BOB</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_12"> <layout class="QVBoxLayout" name="hiddenServiceTabI2PBOBVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="bobHLayout">
<item> <item>
<widget class="QCheckBox" name="cb_enableBob"> <widget class="QCheckBox" name="cb_enableBob">
<property name="text"> <property name="text">
@ -1007,7 +1007,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_5"> <spacer name="bobHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -1036,9 +1036,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<property name="title"> <property name="title">
<string>I2P Basic Open Bridge</string> <string>I2P Basic Open Bridge</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="gbBobVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_21"> <layout class="QHBoxLayout" name="i2pBobHLayout">
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -1046,9 +1046,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_22"> <widget class="QLabel" name="i2pInstAddLabel">
<item>
<widget class="QLabel" name="label_17">
<property name="text"> <property name="text">
<string>I2P Instance address</string> <string>I2P Instance address</string>
</property> </property>
@ -1068,7 +1066,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_22"> <widget class="QLabel" name="i2pProxyPortLabel">
<property name="text"> <property name="text">
<string>I2P proxy port</string> <string>I2P proxy port</string>
</property> </property>
@ -1085,7 +1083,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_23"> <layout class="QHBoxLayout" name="bobAccHLayout">
<item> <item>
<widget class="QLabel" name="iconlabel_i2p_outgoing_2"> <widget class="QLabel" name="iconlabel_i2p_outgoing_2">
<property name="text"> <property name="text">
@ -1097,7 +1095,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="bobAccLabel">
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led is green when the port listen on the left is active on your computer. It does not&lt;/p&gt;&lt;p&gt;mean that your Retroshare traffic transits though I2P. It will do so only if &lt;/p&gt;&lt;p&gt;you connect to Hidden nodes, or if you are running a Hidden node yourself.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led is green when the port listen on the left is active on your computer. It does not&lt;/p&gt;&lt;p&gt;mean that your Retroshare traffic transits though I2P. It will do so only if &lt;/p&gt;&lt;p&gt;you connect to Hidden nodes, or if you are running a Hidden node yourself.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
@ -1110,10 +1108,8 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_14"> <layout class="QHBoxLayout" name="bobB32AddrHLayout">
<item> <item>
<widget class="QLabel" name="lBobB32Addr"> <widget class="QLabel" name="lBobB32Addr">
<property name="sizePolicy"> <property name="sizePolicy">
@ -1161,10 +1157,10 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="gbBobSimplePage">
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="gbBobSimplePageVLayout">
<item> <item>
<widget class="QPlainTextEdit" name="pteBobSimple"> <widget class="QPlainTextEdit" name="pteBobSimple">
<property name="sizePolicy"> <property name="sizePolicy">
@ -1193,14 +1189,14 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="gbBobAdvancedPage1"> <widget class="QWidget" name="gbBobAdvancedPage">
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="gbBobAdvancedPageVLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="bobAdvTunnelVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_13"> <layout class="QHBoxLayout" name="bobAdvTunLenHLayout">
<item> <item>
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="bobAdvTunLenLabel">
<property name="text"> <property name="text">
<string>Tunnel length (in/out)</string> <string>Tunnel length (in/out)</string>
</property> </property>
@ -1241,9 +1237,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_12"> <layout class="QHBoxLayout" name="bobAdvTunQuaHLayout">
<item> <item>
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="bobAdvTunQuaLabel">
<property name="text"> <property name="text">
<string>Tunnel quantity (in/out)</string> <string>Tunnel quantity (in/out)</string>
</property> </property>
@ -1290,9 +1286,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="bobAdvTunVarHLayout">
<item> <item>
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="bobAdvTunVarLabel">
<property name="text"> <property name="text">
<string>Tunnel variance (in/out)</string> <string>Tunnel variance (in/out)</string>
</property> </property>
@ -1338,11 +1334,11 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_13"> <layout class="QVBoxLayout" name="bobAdvServKeyVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_25"> <layout class="QHBoxLayout" name="bobAdvServKeyHLayout">
<item> <item>
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="bobAdvServKeyLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1355,7 +1351,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="bobAdvServKeyHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -1399,9 +1395,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_24"> <layout class="QHBoxLayout" name="bobToolBarHLayout">
<item> <item>
<spacer name="horizontalSpacer_4"> <spacer name="bobToolBarHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -1457,7 +1453,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_3"> <spacer name="gbBobVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -1475,7 +1471,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<attribute name="title"> <attribute name="title">
<string>Incoming</string> <string>Incoming</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="hiddenServiceTabIncomingVLayout">
<item> <item>
<widget class="QLabel" name="hiddenpage_inHeader"> <widget class="QLabel" name="hiddenpage_inHeader">
<property name="text"> <property name="text">
@ -1548,7 +1544,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="1" column="3">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="serviceIncomingHLayout">
<item> <item>
<widget class="QLabel" name="iconlabel_service_incoming"> <widget class="QLabel" name="iconlabel_service_incoming">
<property name="maximumSize"> <property name="maximumSize">
@ -1673,6 +1669,436 @@ If you have issues connecting over Tor check the Tor logs too.</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabRelay">
<attribute name="title">
<string>Relay</string>
</attribute>
<layout class="QVBoxLayout" name="RelayPageVLayout">
<item>
<layout class="QHBoxLayout" name="relayTopHLayout">
<item>
<widget class="QCheckBox" name="enableCheckBox">
<property name="text">
<string>Enable Relay Connections</string>
</property>
</widget>
</item>
<item>
<spacer name="relayTopLeftHSpacer">
<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="QCheckBox" name="serverCheckBox">
<property name="text">
<string>Use Relay Servers</string>
</property>
</widget>
</item>
<item>
<spacer name="relayTopRightHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="relayOptionGBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Relay options</string>
</property>
<layout class="QGridLayout" name="relayOptionGBoxGLayout">
<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>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="optionHeaderLHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>110</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="headerNumberLabel">
<property name="text">
<string>Number</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="optionHeaderRHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="headerBandwidthLabel">
<property name="text">
<string>Bandwidth per link</string>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="7">
<widget class="Line" name="totalVLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="headerTotalLabel">
<property name="text">
<string>Total Bandwidth</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QLabel" name="friendLabel">
<property name="text">
<string>Friends</string>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<widget class="QSpinBox" name="noFriendSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2" rowspan="2">
<widget class="QLabel" name="xFriendLabel">
<property name="text">
<string notr="true">x</string>
</property>
</widget>
</item>
<item row="1" column="3" rowspan="2">
<widget class="QSpinBox" name="bandFriendSpinBox">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLineEdit" name="totalFriendLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" rowspan="2">
<widget class="QLabel" name="fofLabel">
<property name="text">
<string>Friends of Friends</string>
</property>
</widget>
</item>
<item row="3" column="1" rowspan="2">
<widget class="QSpinBox" name="noFOFSpinBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="2" rowspan="2">
<widget class="QLabel" name="xFOFLabel">
<property name="text">
<string notr="true">x</string>
</property>
</widget>
</item>
<item row="3" column="3" rowspan="2">
<widget class="QSpinBox" name="bandFOFSpinBox">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="5">
<widget class="QLineEdit" name="totalFOFLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" rowspan="2">
<widget class="QLabel" name="generalLabel">
<property name="text">
<string>General</string>
</property>
</widget>
</item>
<item row="5" column="1" rowspan="2">
<widget class="QSpinBox" name="noGeneralSpinBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="5" column="2" rowspan="2">
<widget class="QLabel" name="xGeneralLabel">
<property name="text">
<string notr="true">x</string>
</property>
</widget>
</item>
<item row="5" column="3" rowspan="2">
<widget class="QSpinBox" name="bandGeneralSpinBox">
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QLineEdit" name="totalGeneralLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="6">
<widget class="Line" name="totalHLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="totalLabel">
<property name="text">
<string>Total:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="noTotalLineEdit">
<property name="focusPolicy">
<enum>Qt::WheelFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="2" colspan="2">
<spacer name="totalHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>123</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="5">
<widget class="QLineEdit" name="totalBandwidthLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0" colspan="6">
<widget class="QLabel" name="warningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"> border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
</string>
</property>
<property name="text">
<string>Warning: This bandwidth adds up to the max bandwidth.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="serverGroupBox">
<property name="title">
<string>Relay Server Setup</string>
</property>
<layout class="QGridLayout" name="serverGroupBoxGLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="DhtLineEdit">
<property name="inputMask">
<string notr="true">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="keyOkBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="addPushButton">
<property name="text">
<string>Add Server</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTreeWidget" name="serverTreeWidget">
<column>
<property name="text">
<string>Server DHT Key</string>
</property>
</column>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="removePushButton">
<property name="text">
<string>Remove Server</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="relayHelpLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"> border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
</string>
</property>
<property name="text">
<string>&lt;p&gt;By activating relays, you allow your Retroshare node to act as a bridge between Retroshare users who cannot connect directly, e.g. because they're firewalled.&lt;/p&gt;
&lt;p&gt;You may choose to act as a relay by checking &lt;i&gt;enable relay connections&lt;/i&gt;, or simply benefit from other peers acting as relay, by checking &lt;i&gt;use relay servers&lt;/i&gt;. For the former, you may specify the bandwidth allocated when acting as a relay for friends of you, for friends of your friends, or anyone in the Retroshare network.&lt;/p&gt;
&lt;p&gt;In any case, a Retroshare node acting as a relay cannot see the relayed traffic, since it is encrypted and authenticated by the two relayed nodes.&lt;/p&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="relayVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -43,6 +43,7 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
QObject::connect(ui._e2e_encryption_CB,SIGNAL(activated(int)),this,SLOT(updateEncryptionPolicy(int))) ; QObject::connect(ui._e2e_encryption_CB,SIGNAL(activated(int)),this,SLOT(updateEncryptionPolicy(int))) ;
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ; QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) ); QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
QObject::connect(ui._filePermDirectDL_CB,SIGNAL(activated(int)),this,SLOT(updateFilePermDirectDL(int)));
QObject::connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); QObject::connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
QObject::connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); QObject::connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
@ -77,6 +78,16 @@ void TransferPage::updateEncryptionPolicy(int b)
} }
} }
void TransferPage::updateFilePermDirectDL(int i)
{
switch (i)
{
case 0: rsFiles->setFilePermDirectDL(RS_FILE_PERM_DIRECT_DL_YES); break;
case 1: rsFiles->setFilePermDirectDL(RS_FILE_PERM_DIRECT_DL_NO); break;
default: rsFiles->setFilePermDirectDL(RS_FILE_PERM_DIRECT_DL_PER_USER); break;
}
}
void TransferPage::load() void TransferPage::load()
{ {
whileBlocking(ui.shareDownloadDirectoryCB)->setChecked(rsFiles->getShareDownloadDirectory()); whileBlocking(ui.shareDownloadDirectoryCB)->setChecked(rsFiles->getShareDownloadDirectory());
@ -107,6 +118,13 @@ void TransferPage::load()
whileBlocking(ui._diskSpaceLimit_SB)->setValue(rsFiles->freeDiskSpaceLimit()) ; whileBlocking(ui._diskSpaceLimit_SB)->setValue(rsFiles->freeDiskSpaceLimit()) ;
whileBlocking(ui._max_tr_up_per_sec_SB)->setValue(rsTurtle->getMaxTRForwardRate()) ; whileBlocking(ui._max_tr_up_per_sec_SB)->setValue(rsTurtle->getMaxTRForwardRate()) ;
whileBlocking(ui._max_up_SB)->setValue(rsFiles->getMaxUploadSlotsPerFriend()) ; whileBlocking(ui._max_up_SB)->setValue(rsFiles->getMaxUploadSlotsPerFriend()) ;
switch (rsFiles->filePermDirectDL())
{
case RS_FILE_PERM_DIRECT_DL_YES: whileBlocking(ui._filePermDirectDL_CB)->setCurrentIndex(0) ; break ;
case RS_FILE_PERM_DIRECT_DL_NO: whileBlocking(ui._filePermDirectDL_CB)->setCurrentIndex(1) ; break ;
default: whileBlocking(ui._filePermDirectDL_CB)->setCurrentIndex(2) ; break ;
}
} }
void TransferPage::updateDefaultStrategy(int i) void TransferPage::updateDefaultStrategy(int i)

View File

@ -49,6 +49,7 @@ class TransferPage: public ConfigPage
void updateMaxTRUpRate(int); void updateMaxTRUpRate(int);
void updateEncryptionPolicy(int); void updateEncryptionPolicy(int);
void updateMaxUploadSlots(int); void updateMaxUploadSlots(int);
void updateFilePermDirectDL(int);
void editDirectories() ; void editDirectories() ;
void setIncomingDirectory(); void setIncomingDirectory();

View File

@ -10,15 +10,15 @@
<height>1099</height> <height>1099</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="TransferPageVLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="sharedGBox">
<property name="title"> <property name="title">
<string>Shared Directories</string> <string>Shared Directories</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="sharedGBoxVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="shareDownloadHLayout">
<item> <item>
<widget class="QCheckBox" name="shareDownloadDirectoryCB"> <widget class="QCheckBox" name="shareDownloadDirectoryCB">
<property name="enabled"> <property name="enabled">
@ -42,10 +42,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"/> <layout class="QHBoxLayout" name="autoCheckDirectoriesHLayout">
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QCheckBox" name="autoCheckDirectories_CB"> <widget class="QCheckBox" name="autoCheckDirectories_CB">
<property name="text"> <property name="text">
@ -74,6 +71,8 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="followSymLinksHLayout">
<item> <item>
<widget class="QCheckBox" name="followSymLinks_CB"> <widget class="QCheckBox" name="followSymLinks_CB">
<property name="toolTip"> <property name="toolTip">
@ -88,14 +87,16 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="incomingGBox">
<property name="title"> <property name="title">
<string>Incoming Directory</string> <string>Incoming Directory</string>
</property> </property>
<layout class="QGridLayout" name="_3"> <layout class="QGridLayout" name="incomingGBoxGLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLineEdit" name="incomingDir"> <widget class="QLineEdit" name="incomingDir">
<property name="readOnly"> <property name="readOnly">
@ -139,11 +140,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="partialGBox">
<property name="title"> <property name="title">
<string>Partials Directory</string> <string>Partials Directory</string>
</property> </property>
<layout class="QGridLayout" name="_2"> <layout class="QGridLayout" name="partialGBoxGLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLineEdit" name="partialsDir"> <widget class="QLineEdit" name="partialsDir">
<property name="readOnly"> <property name="readOnly">
@ -187,61 +188,68 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="transfertGBox">
<property name="title"> <property name="title">
<string>Transfer options</string> <string>Transfer options</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="transfertGBoxVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="transfertHLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="transfertLabelVLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="_queueSize_Label">
<property name="text"> <property name="text">
<string>Maximum simultaneous downloads:</string> <string>Maximum simultaneous downloads:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="_max_up_Label">
<property name="text"> <property name="text">
<string>Maximum uploads per friend (0 = no limit)</string> <string>Maximum uploads per friend (0 = no limit)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="_defaultStrategy_Label">
<property name="text"> <property name="text">
<string>Default chunk strategy:</string> <string>Default chunk strategy:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="_diskSpaceLimit_Label">
<property name="text"> <property name="text">
<string>Safety disk space limit :</string> <string>Safety disk space limit :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="_max_tr_up_per_sec_Label">
<property name="text"> <property name="text">
<string>Max. tunnel req. forwarded per second:</string> <string>Max. tunnel req. forwarded per second:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="_e2e_encryption_Label">
<property name="text"> <property name="text">
<string>End-to-end encryption:</string> <string>End-to-end encryption:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="_filePermDirectDL_Label">
<property name="text">
<string>Allow direct download:</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="transfertValuesVLayout">
<item> <item>
<widget class="QSpinBox" name="_queueSize_SB"> <widget class="QSpinBox" name="_queueSize_SB">
<property name="enabled"> <property name="enabled">
@ -344,6 +352,28 @@
</item> </item>
</widget> </widget>
</item> </item>
<item>
<widget class="QComboBox" name="_filePermDirectDL_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;How RS manage direct download setting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Per user</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -32,7 +32,6 @@
#include "FileAssociationsPage.h" #include "FileAssociationsPage.h"
#include "SoundPage.h" #include "SoundPage.h"
#include "TransferPage.h" #include "TransferPage.h"
#include "RelayPage.h"
#include "ChatPage.h" #include "ChatPage.h"
#include "ChannelPage.h" #include "ChannelPage.h"
#include "PeoplePage.h" #include "PeoplePage.h"
@ -156,7 +155,6 @@ SettingsPage::initStackedWidget()
addPage(new ForumPage()); // FORUMS addPage(new ForumPage()); // FORUMS
addPage(new PostedPage()); // POSTED RENAME TO LINKS addPage(new PostedPage()); // POSTED RENAME TO LINKS
addPage(new NotifyPage()); // NOTIFY addPage(new NotifyPage()); // NOTIFY
addPage(new RelayPage() ); // RELAY SHOUD BE INSIDE NETWORK AS A TAB
addPage(new PluginsPage() ); // PLUGINS addPage(new PluginsPage() ); // PLUGINS
addPage(new AppearancePage()); // APPEARENCE addPage(new AppearancePage()); // APPEARENCE
addPage(new SoundPage() ); // SOUND addPage(new SoundPage() ); // SOUND

View File

@ -60,6 +60,7 @@
#define COL_GROUP_SIZE_MSGS 2 #define COL_GROUP_SIZE_MSGS 2
#define COL_GROUP_SUBSCRIBED 3 #define COL_GROUP_SUBSCRIBED 3
#define COL_GROUP_POPULARITY 4 #define COL_GROUP_POPULARITY 4
#define COL_GROUP_UNIQUE_ID 5
static const int PARTIAL_VIEW_SIZE = 9 ; static const int PARTIAL_VIEW_SIZE = 9 ;
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
@ -70,7 +71,7 @@ static const int GXSTRANS_STATISTICS_DELAY_BETWEEN_GROUP_REQ = 30 ; // never req
#define GXSTRANS_GROUP_STAT 0x03 #define GXSTRANS_GROUP_STAT 0x03
#define GXSTRANS_MSG_META 0x04 #define GXSTRANS_MSG_META 0x04
#define DEBUG_GXSTRANS_STATS 1 //#define DEBUG_GXSTRANS_STATS 1
GxsTransportStatistics::GxsTransportStatistics(QWidget *parent) GxsTransportStatistics::GxsTransportStatistics(QWidget *parent)
: RsGxsUpdateBroadcastPage(rsGxsTrans,parent) : RsGxsUpdateBroadcastPage(rsGxsTrans,parent)
@ -143,8 +144,9 @@ void GxsTransportStatistics::CustomPopupMenu( QPoint )
void GxsTransportStatistics::updateDisplay(bool) void GxsTransportStatistics::updateDisplay(bool)
{ {
time_t now = time(NULL) ; time_t now = time(NULL) ;
#ifdef DEBUG_GXSTRANS_STATS
std::cerr << "GxsTransportStatistics::updateDisplay()" << std::endl; std::cerr << "GxsTransportStatistics::updateDisplay()" << std::endl;
#endif
requestGroupMeta(); requestGroupMeta();
mLastGroupReqTS = now ; mLastGroupReqTS = now ;
@ -195,7 +197,6 @@ void GxsTransportStatistics::updateContent()
rsGxsTrans->getStatistics(transinfo) ; rsGxsTrans->getStatistics(transinfo) ;
// clear // clear
treeWidget->clear(); treeWidget->clear();
@ -247,27 +248,52 @@ void GxsTransportStatistics::updateContent()
for(std::map<RsGxsGroupId,RsGxsTransGroupStatistics>::const_iterator it(mGroupStats.begin());it!=mGroupStats.end();++it) for(std::map<RsGxsGroupId,RsGxsTransGroupStatistics>::const_iterator it(mGroupStats.begin());it!=mGroupStats.end();++it)
{ {
const RsGxsTransGroupStatistics& stat(it->second) ; const RsGxsTransGroupStatistics& stat(it->second) ;
QTreeWidgetItem *item ;
{
QString unique_id = QString::fromStdString(stat.mGrpId.toStdString());
QList<QTreeWidgetItem*> iteml = groupTreeWidget->findItems(unique_id,Qt::MatchExactly,COL_GROUP_UNIQUE_ID) ;
if(iteml.empty())
item = new QTreeWidgetItem;
else
item = *iteml.begin();
}
QTreeWidgetItem *item = new QTreeWidgetItem();
groupTreeWidget->addTopLevelItem(item); groupTreeWidget->addTopLevelItem(item);
groupTreeWidget->setItemExpanded(item,openned_groups.find(it->first) != openned_groups.end()); groupTreeWidget->setItemExpanded(item,openned_groups.find(it->first) != openned_groups.end());
item->setData(COL_GROUP_GRP_ID, Qt::DisplayRole, QString::fromStdString(stat.mGrpId.toStdString())) ; QString msg_time_string = (stat.last_publish_TS>0)?QString(" (Last msg: %1)").arg(QDateTime::fromTime_t(stat.last_publish_TS).toString()):"" ;
item->setData(COL_GROUP_NUM_MSGS, Qt::DisplayRole, QString::number(stat.mNumMsgs)) ;
item->setData(COL_GROUP_NUM_MSGS, Qt::DisplayRole, QString::number(stat.mNumMsgs) + msg_time_string) ;
item->setData(COL_GROUP_GRP_ID, Qt::DisplayRole, QString::fromStdString(it->first.toStdString())) ;
item->setData(COL_GROUP_SIZE_MSGS, Qt::DisplayRole, QString::number(stat.mTotalSizeOfMsgs)) ; item->setData(COL_GROUP_SIZE_MSGS, Qt::DisplayRole, QString::number(stat.mTotalSizeOfMsgs)) ;
item->setData(COL_GROUP_SUBSCRIBED,Qt::DisplayRole, stat.subscribed?tr("Yes"):tr("No")) ; item->setData(COL_GROUP_SUBSCRIBED,Qt::DisplayRole, stat.subscribed?tr("Yes"):tr("No")) ;
item->setData(COL_GROUP_POPULARITY,Qt::DisplayRole, QString::number(stat.popularity)) ; item->setData(COL_GROUP_POPULARITY,Qt::DisplayRole, QString::number(stat.popularity)) ;
item->setData(COL_GROUP_UNIQUE_ID, Qt::DisplayRole, QString::fromStdString(it->first.toStdString())) ;
for(uint32_t i=0;i<it->second.messages_metas.size();++i) for(std::map<RsGxsMessageId,RsMsgMetaData>::const_iterator msgIt(stat.messages_metas.begin());msgIt!=stat.messages_metas.end();++msgIt)
{ {
QTreeWidgetItem *sitem = new QTreeWidgetItem(item) ; const RsMsgMetaData& meta(msgIt->second);
const RsMsgMetaData& meta(it->second.messages_metas[i]) ; QTreeWidgetItem *sitem ;
{
QString unique_id = QString::fromStdString(meta.mMsgId.toStdString());
QList<QTreeWidgetItem*> iteml = groupTreeWidget->findItems(unique_id,Qt::MatchExactly,COL_GROUP_UNIQUE_ID) ;
if(iteml.empty())
sitem = new QTreeWidgetItem(item) ;
else
sitem = *iteml.begin();
}
GxsIdLabel *label = new GxsIdLabel(); GxsIdLabel *label = new GxsIdLabel();
label->setId(meta.mAuthorId) ; label->setId(meta.mAuthorId) ;
groupTreeWidget->setItemWidget(sitem,COL_GROUP_GRP_ID,label) ; groupTreeWidget->setItemWidget(sitem,COL_GROUP_GRP_ID,label) ;
sitem->setData(COL_GROUP_UNIQUE_ID, Qt::DisplayRole,QString::fromStdString(meta.mMsgId.toStdString()));
sitem->setData(COL_GROUP_NUM_MSGS,Qt::DisplayRole, QDateTime::fromTime_t(meta.mPublishTs).toString()); sitem->setData(COL_GROUP_NUM_MSGS,Qt::DisplayRole, QDateTime::fromTime_t(meta.mPublishTs).toString());
} }
} }
@ -365,7 +391,9 @@ void GxsTransportStatistics::loadGroupStat(const uint32_t &token)
GxsGroupStatistic stats; GxsGroupStatistic stats;
rsGxsTrans->getGroupStatistic(token, stats); rsGxsTrans->getGroupStatistic(token, stats);
#ifdef DEBUG_GXSTRANS_STATS
std::cerr << "Loading group stats: " << stats.mGrpId << ", num msgs=" << stats.mNumMsgs << ", total size=" << stats.mTotalSizeOfMsgs << std::endl; std::cerr << "Loading group stats: " << stats.mGrpId << ", num msgs=" << stats.mNumMsgs << ", total size=" << stats.mTotalSizeOfMsgs << std::endl;
#endif
dynamic_cast<GxsGroupStatistic&>(mGroupStats[stats.mGrpId]) = stats ; dynamic_cast<GxsGroupStatistic&>(mGroupStats[stats.mGrpId]) = stats ;
} }
@ -408,6 +436,7 @@ void GxsTransportStatistics::loadGroupMeta(const uint32_t& token)
RsGxsTransGroupStatistics& s(mGroupStats[vit->mGroupId]); RsGxsTransGroupStatistics& s(mGroupStats[vit->mGroupId]);
s.popularity = vit->mPop ; s.popularity = vit->mPop ;
s.subscribed = IS_GROUP_SUBSCRIBED(vit->mSubscribeFlags) ; s.subscribed = IS_GROUP_SUBSCRIBED(vit->mSubscribeFlags) ;
s.mGrpId = vit->mGroupId ;
} }
// remove group stats for group that do not exist anymore // remove group stats for group that do not exist anymore
@ -429,6 +458,7 @@ void GxsTransportStatistics::loadMsgMeta(const uint32_t& token)
return ; return ;
for(GxsMsgMetaMap::const_iterator it(m.begin());it!=m.end();++it) for(GxsMsgMetaMap::const_iterator it(m.begin());it!=m.end();++it)
mGroupStats[it->first].messages_metas = it->second ; for(uint32_t i=0;i<it->second.size();++i)
mGroupStats[it->first].addMessageMeta(it->first,it->second[i]) ;
} }

View File

@ -38,12 +38,26 @@ class UIStateHelper;
class RsGxsTransGroupStatistics: public GxsGroupStatistic class RsGxsTransGroupStatistics: public GxsGroupStatistic
{ {
public: public:
RsGxsTransGroupStatistics() {} RsGxsTransGroupStatistics()
{
last_publish_TS = 0;
popularity = 0;
subscribed = false;
}
void addMessageMeta(const RsGxsGroupId& grp,const RsMsgMetaData& meta)
{
messages_metas[meta.mMsgId] = meta ;
last_publish_TS = std::max(last_publish_TS,meta.mPublishTs) ;
mGrpId = grp ;
}
bool subscribed ; bool subscribed ;
int popularity ; int popularity ;
std::vector<RsMsgMetaData> messages_metas ; time_t last_publish_TS;
std::map<RsGxsMessageId,RsMsgMetaData> messages_metas ;
}; };
class GxsTransportStatistics: public RsGxsUpdateBroadcastPage, public TokenResponse, public Ui::GxsTransportStatistics class GxsTransportStatistics: public RsGxsUpdateBroadcastPage, public TokenResponse, public Ui::GxsTransportStatistics

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1468</width> <width>1468</width>
<height>659</height> <height>779</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,6 +16,12 @@
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>GroupBox</string> <string>GroupBox</string>
</property> </property>
@ -101,7 +107,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Total size of messages</string> <string>Local size of data</string>
</property> </property>
</column> </column>
<column> <column>

View File

@ -460,7 +460,6 @@ HEADERS += rshare.h \
gui/settings/ChatPage.h \ gui/settings/ChatPage.h \
gui/settings/ChannelPage.h \ gui/settings/ChannelPage.h \
gui/settings/PostedPage.h \ gui/settings/PostedPage.h \
gui/settings/RelayPage.h \
gui/settings/ServicePermissionsPage.h \ gui/settings/ServicePermissionsPage.h \
gui/settings/AddFileAssociationDialog.h \ gui/settings/AddFileAssociationDialog.h \
gui/settings/GroupFrameSettingsWidget.h \ gui/settings/GroupFrameSettingsWidget.h \
@ -643,7 +642,6 @@ FORMS += gui/StartDialog.ui \
gui/settings/ChatPage.ui \ gui/settings/ChatPage.ui \
gui/settings/ChannelPage.ui \ gui/settings/ChannelPage.ui \
gui/settings/PostedPage.ui \ gui/settings/PostedPage.ui \
gui/settings/RelayPage.ui \
gui/settings/ServicePermissionsPage.ui \ gui/settings/ServicePermissionsPage.ui \
gui/settings/PluginItem.ui \ gui/settings/PluginItem.ui \
gui/settings/GroupFrameSettingsWidget.ui \ gui/settings/GroupFrameSettingsWidget.ui \
@ -870,7 +868,6 @@ SOURCES += main.cpp \
gui/settings/ChatPage.cpp \ gui/settings/ChatPage.cpp \
gui/settings/ChannelPage.cpp \ gui/settings/ChannelPage.cpp \
gui/settings/PostedPage.cpp \ gui/settings/PostedPage.cpp \
gui/settings/RelayPage.cpp \
gui/settings/ServicePermissionsPage.cpp \ gui/settings/ServicePermissionsPage.cpp \
gui/settings/AddFileAssociationDialog.cpp \ gui/settings/AddFileAssociationDialog.cpp \
gui/settings/GroupFrameSettingsWidget.cpp \ gui/settings/GroupFrameSettingsWidget.cpp \

View File

@ -50,15 +50,15 @@ Item
var radix = JSON.parse(par.response).data.cert_string var radix = JSON.parse(par.response).data.cert_string
var name = mainWindow.user_name var name = mainWindow.user_name
var encodedName = UriJs.URI.encode(name) var encodedName = UriJs.URI.encode(name)
ClipboardWrapper.postToClipBoard( var nodeUrl = (
"retroshare://certificate?" + "retroshare://certificate?" +
"name=" + encodedName + "name=" + encodedName +
"&radix=" + UriJs.URI.encode(radix) + "&radix=" + UriJs.URI.encode(radix) +
"&location=" + encodedName "&location=" + encodedName )
) ClipboardWrapper.postToClipBoard(nodeUrl)
linkCopiedPopup.itemName = name linkCopiedPopup.itemName = name
linkCopiedPopup.open() linkCopiedPopup.open()
platformGW.shareUrl(nodeUrl);
}) })
} }
} }

View File

@ -125,16 +125,18 @@ Item
function(par) function(par)
{ {
var jD = JSON.parse(par.response).data var jD = JSON.parse(par.response).data
ClipboardWrapper.postToClipBoard( var contactUrl = (
"retroshare://" + "retroshare://" +
"identity?gxsid=" + "identity?gxsid=" +
cntDt.md.gxs_id + cntDt.md.gxs_id +
"&name=" + "&name=" +
UriJs.URI.encode(cntDt.md.name) + UriJs.URI.encode(cntDt.md.name) +
"&groupdata=" + "&groupdata=" +
UriJs.URI.encode(jD.radix)) UriJs.URI.encode(jD.radix) )
ClipboardWrapper.postToClipBoard(contactUrl)
linkCopiedPopup.itemName = cntDt.md.name linkCopiedPopup.itemName = cntDt.md.name
linkCopiedPopup.visible = true linkCopiedPopup.visible = true
platformGW.shareUrl(contactUrl);
} }
) )
} }

View File

@ -65,6 +65,17 @@ public class RetroShareQmlActivity extends QtActivity
if (uri != null) NativeCalls.notifyIntentUri(uri); if (uri != null) NativeCalls.notifyIntentUri(uri);
} }
@UsedByNativeCode @SuppressWarnings("unused")
public void shareUrl(String urlStr)
{
Intent shareIntent = new Intent()
.setAction(Intent.ACTION_SEND)
.putExtra(Intent.EXTRA_TEXT, urlStr)
.setType("text/plain");
startActivity(Intent.createChooser(shareIntent,"")); // TODO: Need proper title?
}
private boolean isMyServiceRunning(Class<?> serviceClass) private boolean isMyServiceRunning(Class<?> serviceClass)
{ {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

View File

@ -0,0 +1,41 @@
/*
* RetroShare Android QML App
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "androidplatforminteracions.h"
#include <QtAndroid>
#include <QtAndroidExtras/QAndroidJniObject>
AndroidPlatformInteracions::AndroidPlatformInteracions(QObject *parent) :
PlatformInteracions(parent) {}
void AndroidPlatformInteracions::shareUrl(QUrl url)
{
QString encUri = url.toString(QUrl::FullyEncoded);
QAndroidJniObject uriStr = QAndroidJniObject::fromString(encUri);
QtAndroid::runOnAndroidThread(
[uriStr]()
{
QtAndroid::androidActivity()
.callMethod<void>(
"shareUrl",
"(Ljava/lang/String;)V",
uriStr.object<jstring>());
});
}

View File

@ -0,0 +1,34 @@
#pragma once
/*
* RetroShare Android QML App
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include <QUrl>
#include "platforminteracions.h"
class AndroidPlatformInteracions : public PlatformInteracions
{
Q_OBJECT
public:
explicit AndroidPlatformInteracions(QObject *parent = nullptr);
public slots:
virtual void shareUrl(QUrl url);
};

View File

@ -0,0 +1,25 @@
/*
* RetroShare Android QML App
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "defaultplatforminteracions.h"
DefaultPlatformInteracions::DefaultPlatformInteracions(QObject *parent) :
PlatformInteracions(parent) {}
// Do nothing as the url is pasted to clipboard directly in QML
void DefaultPlatformInteracions::shareUrl(QUrl /*url*/) {}

View File

@ -0,0 +1,34 @@
#pragma once
/*
* RetroShare Android QML App
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include <QUrl>
#include "platforminteracions.h"
class DefaultPlatformInteracions : public PlatformInteracions
{
Q_OBJECT
public:
explicit DefaultPlatformInteracions(QObject *parent = nullptr);
public slots:
virtual void shareUrl(QUrl url);
};

View File

@ -30,10 +30,16 @@
# include <QtAndroid> # include <QtAndroid>
# include <QtAndroidExtras/QAndroidJniObject> # include <QtAndroidExtras/QAndroidJniObject>
# include <atomic> # include <atomic>
# include "androidplatforminteracions.h"
#else
# include "defaultplatforminteracions.h"
#endif // Q_OS_ANDROID #endif // Q_OS_ANDROID
#include "libresapilocalclient.h" #include "libresapilocalclient.h"
#include "rsqmlappengine.h" #include "rsqmlappengine.h"
#include "platforminteracions.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -60,6 +66,8 @@ int main(int argc, char *argv[])
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
rootContext.setContextProperty("Q_OS_ANDROID", QVariant(true)); rootContext.setContextProperty("Q_OS_ANDROID", QVariant(true));
AndroidPlatformInteracions platformGW(&app);
/* Add Activity Intent data to args, because onNewIntent is called only if /* Add Activity Intent data to args, because onNewIntent is called only if
* the Intet was triggered when the Activity was already created, so only in * the Intet was triggered when the Activity was already created, so only in
* case onCreate is not called. * case onCreate is not called.
@ -114,10 +122,12 @@ int main(int argc, char *argv[])
if(!uriStr.isEmpty()) mainArgs.append(uriStr); if(!uriStr.isEmpty()) mainArgs.append(uriStr);
#else #else
DefaultPlatformInteracions platformGW(&app);
rootContext.setContextProperty("Q_OS_ANDROID", QVariant(false)); rootContext.setContextProperty("Q_OS_ANDROID", QVariant(false));
#endif #endif
rootContext.setContextProperty("mainArgs", mainArgs); rootContext.setContextProperty("mainArgs", mainArgs);
rootContext.setContextProperty("platformGW", &platformGW);
#ifdef QT_DEBUG #ifdef QT_DEBUG
rootContext.setContextProperty("QT_DEBUG", QVariant(true)); rootContext.setContextProperty("QT_DEBUG", QVariant(true));

View File

@ -0,0 +1,32 @@
#pragma once
/*
* RetroShare Android QML App
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include <QUrl>
class PlatformInteracions : public QObject
{
Q_OBJECT
public:
explicit PlatformInteracions(QObject *parent = nullptr) : QObject(parent) {}
public slots:
virtual void shareUrl(QUrl url) = 0;
};

View File

@ -5,17 +5,24 @@ QT += core network qml quick svg
CONFIG += c++11 CONFIG += c++11
HEADERS += libresapilocalclient.h \ HEADERS += libresapilocalclient.h \
rsqmlappengine.h rsqmlappengine.h \
platforminteracions.h
SOURCES += main-app.cpp \ SOURCES += main-app.cpp \
libresapilocalclient.cpp \ libresapilocalclient.cpp \
rsqmlappengine.cpp rsqmlappengine.cpp
RESOURCES += qml.qrc RESOURCES += qml.qrc
# Platform interaction specific code
android-g++ { android-g++ {
QT += androidextras QT += androidextras
SOURCES += NativeCalls.cpp HEADERS += NativeCalls.h androidplatforminteracions.h
HEADERS += NativeCalls.h SOURCES += NativeCalls.cpp androidplatforminteracions.cpp
} else {
HEADERS += defaultplatforminteracions.h
SOURCES += defaultplatforminteracions.cpp
} }
# Additional import path used to resolve QML modules in Qt Creator's code model # Additional import path used to resolve QML modules in Qt Creator's code model