Merge branch 'RetroShare:master' into profile-generation-fixes-ui

This commit is contained in:
defnax 2025-12-04 21:22:07 +01:00 committed by GitHub
commit ef953f4e78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
331 changed files with 6804 additions and 5008 deletions

83
.github/workflows/ci-macOS.yml vendored Normal file
View file

@ -0,0 +1,83 @@
name: macOS Build
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: macos-14
permissions:
actions: write
defaults:
run:
shell: bash
steps:
- name: Setup XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.0.1
- name: Show current version of Xcode
run: xcodebuild -version
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@main
- name: Show OpenSSL version
run: pkg-config --cflags libcrypto
- name: Install Packages
run: brew install openssl
miniupnpc
rapidjson
sqlcipher
bzip2
zlib
botan@2
libxslt
libxml2
qt
- name: Checkout submodules
run: |
env
git submodule update --init --remote libbitdht/ libretroshare/ retroshare-webui/
git submodule update --init supportlibs/librnp supportlibs/rapidjson supportlibs/restbed openpgpsdk/
- name: CI-Build
run: |
qmake6 . -r "CONFIG+=rs_macos14.0" "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3" "CONFIG+=rs_no_rnplib" \
INCLUDEPATH+="/opt/homebrew/opt/openssl@3/include" \
INCLUDEPATH+="/opt/homebrew/opt/rapidjson/include" \
INCLUDEPATH+="/opt/homebrew/opt/sqlcipher/include" \
INCLUDEPATH+="/opt/homebrew/opt/miniupnpc/include" \
INCLUDEPATH+="/opt/homebrew/opt/libxslt/include" \
INCLUDEPATH+="/opt/homebrew/opt/libxml2/include" \
QMAKE_LIBDIR+="/opt/homebrew/opt/openssl@3/lib" \
QMAKE_LIBDIR+="/opt/homebrew/opt/rapidjson/lib" \
QMAKE_LIBDIR+="/opt/homebrew/opt/sqlcipher/lib" \
QMAKE_LIBDIR+="/opt/homebrew/opt/miniupnpc/lib" \
QMAKE_LIBDIR+="/opt/homebrew/opt/libxslt/lib" \
QMAKE_LIBDIR+="/opt/homebrew/opt/libxml2/lib" \
CONFIG+=no_retroshare_service \
CONFIG+=no_retroshare_friendserver
make

71
.github/workflows/ci-mingw64-Qt6.yml vendored Normal file
View file

@ -0,0 +1,71 @@
name: MINGW64 Qt6 Build
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
permissions:
actions: write
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup MSYS2
uses: msys2/setup-msys2@40677d36a502eb2cf0fb808cc9dec31bf6152638 # v2.28.0
with:
msystem: MINGW64
update: true
install: >-
base-devel
git
wget
p7zip
gcc
perl
ruby
doxygen
cmake
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-miniupnpc
mingw-w64-x86_64-libxslt
mingw-w64-x86_64-xapian-core
mingw-w64-x86_64-sqlcipher
mingw-w64-x86_64-qt6-base
mingw-w64-x86_64-qt6-multimedia
mingw-w64-x86_64-qt6
mingw-w64-x86_64-ccmake
mingw-w64-x86_64-rapidjson
mingw-w64-x86_64-json-c
mingw-w64-x86_64-libbotan
mingw-w64-x86_64-asio
- name: Checkout submodules
run: |
env
git submodule update --init --remote libbitdht/ libretroshare/ retroshare-webui/
git submodule update --init supportlibs/librnp supportlibs/rapidjson supportlibs/restbed
- name: Build
run: |
qmake6 . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
mingw32-make -j3

70
.github/workflows/ci-mingw64.yml vendored Normal file
View file

@ -0,0 +1,70 @@
name: MINGW64 Qt5 Build
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
permissions:
actions: write
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup MSYS2
uses: msys2/setup-msys2@40677d36a502eb2cf0fb808cc9dec31bf6152638 # v2.28.0
with:
msystem: MINGW64
update: true
install: >-
base-devel
git
wget
p7zip
gcc
perl
ruby
doxygen
cmake
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-miniupnpc
mingw-w64-x86_64-libxslt
mingw-w64-x86_64-xapian-core
mingw-w64-x86_64-sqlcipher
mingw-w64-x86_64-qt5-base
mingw-w64-x86_64-qt5-multimedia
mingw-w64-x86_64-ccmake
mingw-w64-x86_64-rapidjson
mingw-w64-x86_64-json-c
mingw-w64-x86_64-libbotan
mingw-w64-x86_64-asio
- name: Checkout submodules
run: |
env
git submodule update --init --remote libbitdht/ libretroshare/ retroshare-webui/
git submodule update --init supportlibs/librnp supportlibs/rapidjson supportlibs/restbed
- name: CI-Build
run: |
qmake . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
mingw32-make -j3

70
.github/workflows/ci-ucrt64.yml vendored Normal file
View file

@ -0,0 +1,70 @@
name: UCRT64 Qt5 Build
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
permissions:
actions: write
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup MSYS2
uses: msys2/setup-msys2@40677d36a502eb2cf0fb808cc9dec31bf6152638 # v2.28.0
with:
msystem: UCRT64
update: true
install: >-
base-devel
git
wget
p7zip
gcc
perl
ruby
doxygen
cmake
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-miniupnpc
mingw-w64-ucrt-x86_64-libxslt
mingw-w64-ucrt-x86_64-xapian-core
mingw-w64-ucrt-x86_64-sqlcipher
mingw-w64-ucrt-x86_64-qt5-base
mingw-w64-ucrt-x86_64-qt5-multimedia
mingw-w64-ucrt-x86_64-ccmake
mingw-w64-ucrt-x86_64-rapidjson
mingw-w64-ucrt-x86_64-json-c
mingw-w64-ucrt-x86_64-libbotan
mingw-w64-ucrt-x86_64-asio
- name: Checkout submodules
run: |
env
git submodule update --init --remote libbitdht/ libretroshare/ retroshare-webui/
git submodule update --init supportlibs/librnp supportlibs/rapidjson supportlibs/restbed
- name: CI-Build
run: |
qmake . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
mingw32-make -j3

40
.github/workflows/ubuntu-qt5_c-cpp.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Ubuntu Qt 5 C/C++ CI
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: git init
run: git submodule update --init --remote libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ && git --no-pager log --max-count 1
- name: git submodule supportlibs
run: git submodule update --init supportlibs/librnp supportlibs/restbed #supportlibs/rapidjson
- name: run apt update
run: sudo apt-get update
- name: apt install
run: sudo apt-get install g++ cmake qt5-qmake qtmultimedia5-dev libqt5x11extras5-dev libasio-dev libbz2-dev libjson-c-dev libssl-dev libsqlcipher-dev libupnp-dev libxss-dev rapidjson-dev libbotan-2-dev doxygen libsecret-1-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev
- name: print working directory
run: pwd && ls -la
- name: qmake
run: |
qmake CONFIG+=debug \
CONFIG+=rs_autologin \
CONFIG+=rs_webui \
CONFIG+=rs_jsonapi \
CONFIG+=wikipoos \
CONFIG+=gxsthewire \
CONFIG+=retroshare_plugins
- name: make
run: make
- name: make check
run: make check

40
.github/workflows/ubuntu-qt6_c-cpp.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Ubuntu Qt 6 C/C++ CI
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: git init
run: git submodule update --init --remote libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ && git --no-pager log --max-count 1
- name: git submodule supportlibs
run: git submodule update --init supportlibs/librnp supportlibs/restbed #supportlibs/rapidjson
- name: run apt update
run: sudo apt-get update
- name: apt install
run: sudo apt-get install g++ cmake qt6-base-dev qt6-multimedia-dev libasio-dev libbz2-dev libjson-c-dev libssl-dev libsqlcipher-dev libupnp-dev libxss-dev rapidjson-dev libbotan-2-dev doxygen qt6-5compat-dev libqt6core5compat6-dev libsecret-1-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev
- name: print working directory
run: pwd && ls -la
- name: qmake
run: |
qmake6 CONFIG+=debug \
CONFIG+=rs_autologin \
CONFIG+=rs_webui \
CONFIG+=rs_jsonapi \
CONFIG+=wikipoos \
CONFIG+=gxsthewire \
CONFIG+=retroshare_plugins
- name: make
run: make
- name: make check
run: make check

View file

@ -1,70 +0,0 @@
// SPDX-FileCopyrightText: Retroshare Team <contact@retroshare.cc>
// SPDX-License-Identifier: CC-BY-SA-4.0
= RetroShare
RetroShare is a decentralized, private, secure, cross-platform, communication
toolkit.
RetroShare provides file sharing, chat, messages, forums, channels and more.
|===============================================================================
| Developer Documentation | image:https://deepwiki.com/badge.svg[link="https://deepwiki.com/RetroShare/RetroShare",title="Ask DeepWiki"]
|===============================================================================
.Build Status
|===============================================================================
|GNU/Linux (via Gitlab CI) | image:https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/RetroShare/-/commits/master",title="pipeline status"]
|Windows (via AppVeyor) | image:https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true[link="https://ci.appveyor.com/project/RetroShare58622/retroshare"]
|macOS, (via Travis CI) | image:https://app.travis-ci.com/RetroShare/RetroShare.svg?branch=master[link="https://app.travis-ci.com/github/RetroShare/RetroShare"]
|libretroshare GNU/Linux, Android (via Gitlab CI) | image:https://gitlab.com/RetroShare/libretroshare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/libretroshare/-/commits/master",title="pipeline status"]
|===============================================================================
== Get the source
Clone this repository, enter the directory and then get the submodules with the
following command
[source,bash]
--------
git submodule update --init --remote --force libbitdht/ libretroshare/ openpgpsdk/
--------
== Compilation
Short of comprehensive and updated documentation on how to build RetroShare
(for the many supported platforms it runs on), scripts and recipes are provided
in the aim of creating packages for the supported platforms (and more)
in the `build_scripts` directory of this repository.
Those packaging receipts together with the continuous integration files
`.travis.yml` and `appveyor.yml` are a good source of knowledge on how to
compile RetroShare on different platforms.
== Using RetroShare on a headless computer with web UI
WARNING: This section is outdated need to be adapted to the new web UI
The web UI needs to be enabled as a parameter option to the retroshare-service:
[source,bash]
--------
./retroshare-nogui --webinterface 9090 --docroot /usr/share/retroshare/webui/
--------
The web UI is only accessible on localhost:9090. It is advised to keep it that way so that your RS
cannot be controlled using an untrusted connection.
To access your web UI from a distance, just open a SSH tunnel to it:
[source,bash]
--------
distant_machine:~/ > ssh rs_host -L 9090:localhost:9090 -N
--------
"rs_host" is the machine running `retroshare-nogui`. Then on the distant machine, access your web UI on
http://localhost:9090
(This can also be done from the RetroShare GUI.)

55
README.md Normal file
View file

@ -0,0 +1,55 @@
## RetroShare
RetroShare is a decentralized, private, secure, cross-platform, communication
toolkit.
RetroShare provides file sharing, chat, messages, forums, channels, boards and more.
[![GitHub release](https://img.shields.io/github/release/retroshare/retroshare.svg?label=latest%20release)](https://github.com/retroshare/retroshare/releases/latest)
[![Downloads](https://img.shields.io/github/downloads/retroshare/retroshare/total)](https://github.com/retroshare/retroshare/releases/latest)
[![MINGW64 Qt5 Build](https://github.com/RetroShare/RetroShare/actions/workflows/ci-mingw64.yml/badge.svg)](https://github.com/RetroShare/RetroShare/actions/workflows/ci-mingw64.yml)
[![UCRT64 Qt5 Build](https://github.com/RetroShare/RetroShare/actions/workflows/ci-ucrt64.yml/badge.svg)](https://github.com/RetroShare/RetroShare/actions/workflows/ci-ucrt64.yml)
[![MINGW64 Qt6 Build](https://github.com/RetroShare/RetroShare/actions/workflows/ci-mingw64-Qt6.yml/badge.svg)](https://github.com/RetroShare/RetroShare/actions/workflows/ci-mingw64-Qt6.yml)
[![GNU/Linux (via Gitlab CI)](https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg)](https://gitlab.com/RetroShare/RetroShare/-/commits/master)
[![libretroshare GNU/Linux, Android (via Gitlab CI)](https://gitlab.com/RetroShare/libretroshare/badges/master/pipeline.svg)](https://gitlab.com/RetroShare/libretroshare/-/commits/master)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/RetroShare/RetroShare)
## Get the source
Clone this repository, enter the directory and then get the submodules with the
following command
git submodule update --init --remote --force libbitdht/ libretroshare/ openpgpsdk/
## Compilation
Short of comprehensive and updated documentation on how to build RetroShare
(for the many supported platforms it runs on), scripts and recipes are provided
in the aim of creating packages for the supported platforms (and more)
in the [build_scripts](https://github.com/RetroShare/RetroShare/tree/master/build_scripts) directory of this repository.
## Compilation on Windows
Follow this file : [WindowsMSys2_InstallGuide](https://github.com/RetroShare/RetroShare/blob/master/build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md)
With QtCreator : [Windows-QtCreator-InstallGuide](https://github.com/RetroShare/RetroShare/blob/master/build_scripts/Windows/Windows-QtCreator-InstallGuide.md)
## Compilation on MacOSX
Follow this file : [MacOS_X_InstallGuide](https://github.com/RetroShare/RetroShare/blob/master/build_scripts/OSX/MacOS_X_InstallGuide.md)
## Compilation on Linux
Follow this file : [Linux_InstallGuide](https://github.com/RetroShare/RetroShare/blob/master/build_scripts/Debian+Ubuntu/Linux_InstallGuide.md)
## Releases
Latest release [here](https://github.com/RetroShare/RetroShare/releases)
Other Builds [RetroShare Downloads](https://retroshare.cc/downloads.html)
## Documentation
- [RetroShare Docs](https://retrosharedocs.readthedocs.io/en/latest/)

View file

@ -1,312 +0,0 @@
# SPDX-FileCopyrightText: (C) 2004-2019 Retroshare Team <contact@retroshare.cc>
# SPDX-License-Identifier: CC0-1.0
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
# from example:
# https://github.com/Phonations/Joker/blob/master/appveyor.yml
# https://github.com/unicorn-engine/autobuild/blob/master/.appveyor.yml
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: RetroShare-git-{branch}-{build}
image: Visual Studio 2019
# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}
# branches to build
branches:
# whitelist
#only:
# - master
# blacklist
except:
- /^skipthisbranch$/
# Do not build on tags (GitHub only)
skip_tags: true
# Skipping commits with particular message or from user
skip_commits:
message: /Created.*\.(png|jpg|jpeg|bmp|gif)/ # Regex for matching commit message
#author: Anonymous # Commit author's username, name, email or regexp maching one of these.
#---------------------------------#
# environment configuration #
#---------------------------------#
# Operating system (build VM template)
#os: Windows Server 2012
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
#To get RDP while compiling
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
on_finish:
#To get RDP running after compiling
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# clone directory
clone_folder: C:\projects\RetroShare
# fetch repository as zip archive
#shallow_clone: true # default is "false"
# set clone depth
clone_depth: 2000 # clone entire repository history if not defined
environment:
global:
## Qt: https://www.appveyor.com/docs/installed-software#qt
# QTDIR: C:\Qt\5.10.1\mingw53_32
MSYS2_ARCH: i686
TARGET: i686_32-pc-msys
MINGW_PREFIX: C:\msys64\mingw32
RS_DEPLOY: RetroShare_deploy
# build cache to preserve files/folders between builds
#cache:
# Disabled because it's bigger then supported by appveyor free plan
# - C:\msys64\var\cache\pacman\pkg
# scripts that run after cloning repository
#install:
# # by default, all script lines are interpreted as batch
# - echo This is batch
# # to run script as a PowerShell command prepend it with ps:
# - ps: Write-Host 'This is PowerShell'
# # batch commands start from cmd:
# - cmd: echo This is batch again
# - cmd: set MY_VAR=12345
install:
# We cannot get OBS submodule as it use illegal folder name for windows.
#- git submodule update --init
# Configuring MSys2
- set PATH=C:\msys64\usr\bin;%PATH%
- set PATH=C:\msys64\mingw32\bin;%PATH%
- >
pacman --noconfirm -Sy
mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-rapidjson
mingw-w64-i686-sqlcipher mingw-w64-i686-xapian-core mingw-w64-i686-cmark
#- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH%
# Configuring Qt
# - set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw491_32\bin;%PATH%
# Hack for new MSys2
- copy C:\msys64\mingw32\i686-w64-mingw32\bin\ar.exe C:\msys64\mingw32\bin\i686-w64-mingw32-ar.exe
- copy C:\msys64\mingw32\i686-w64-mingw32\bin\ranlib.exe C:\msys64\mingw32\bin\i686-w64-mingw32-ranlib.exe
- copy C:\msys64\mingw32\bin\windres.exe C:\msys64\mingw32\bin\i686-w64-mingw32-windres.exe
- copy C:\msys64\mingw64\x86_64-w64-mingw32\bin\ar.exe C:\msys64\mingw64\bin\x86_64-w64-mingw32-ar.exe
- copy C:\msys64\mingw64\x86_64-w64-mingw32\bin\ranlib.exe C:\msys64\mingw64\bin\x86_64-w64-mingw32-ranlib.exe
- copy C:\msys64\mingw64\bin\windres.exe C:\msys64\mingw64\bin\x86_64-w64-mingw32-windres.exe
# Work-around linker looking for Qt dll in wrong place
- copy C:\msys64\mingw32\bin\Qt5PrintSupport.dll C:\msys64\mingw32\lib\Qt5PrintSupport.dll
- copy C:\msys64\mingw32\bin\Qt5Widgets.dll C:\msys64\mingw32\lib\Qt5Widgets.dll
- copy C:\msys64\mingw32\bin\Qt5Multimedia.dll C:\msys64\mingw32\lib\Qt5Multimedia.dll
- copy C:\msys64\mingw32\bin\Qt5Gui.dll C:\msys64\mingw32\lib\Qt5Gui.dll
- copy C:\msys64\mingw32\bin\Qt5Network.dll C:\msys64\mingw32\lib\Qt5Network.dll
- copy C:\msys64\mingw32\bin\Qt5Xml.dll C:\msys64\mingw32\lib\Qt5Xml.dll
- copy C:\msys64\mingw32\bin\Qt5Core.dll C:\msys64\mingw32\lib\Qt5Core.dll
#---------------------------------#
# build configuration #
#---------------------------------#
# build platform, i.e. x86, x64, Any CPU. This setting is optional.
platform: x86
# to add several platforms to build matrix:
#platform:
# - x86
# - Any CPU
# build Configuration, i.e. Debug, Release, etc.
configuration: Release
# to add several configurations to build matrix:
#configuration:
# - Debug
# - Release
# scripts to run before build
before_build:
- cd C:\projects\RetroShare
- git submodule update --init
- cd C:\projects\
- mkdir RetroShare-build
- cd RetroShare-build
# - find C:\ > filelist.txt
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
before_package:
# to run your custom scripts instead of automatic MSBuild
build_script:
- env
- qmake ../RetroShare -spec win32-g++ "CONFIG+=debug"
- mingw32-make -j3
# scripts to run after build
after_build:
- find .
- mkdir %RS_DEPLOY%
- copy retroshare-gui\src\debug\retroshare.exe %RS_DEPLOY%\
- copy retroshare-service\src\debug\retroshare-service.exe %RS_DEPLOY%\
# - copy retroshare-service\src\retroshare-service.exe %RS_DEPLOY%\
# - copy retroshare-gui\src\retroshare.exe %RS_DEPLOY%\
## In Debug build winedeplyqt forget the non debug Qt libs
- copy C:\msys64\mingw32\bin\Qt5Svg.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5Core.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5Multimedia.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5Widgets.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5Xml.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5PrintSupport.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5Gui.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\Qt5Network.dll %RS_DEPLOY%\
- mkdir %RS_DEPLOY%\playlistformats\
- copy C:\msys64\mingw32\share\qt5\plugins\playlistformats\qtmultimedia_m3u.dll %RS_DEPLOY%\playlistformats
- mkdir %RS_DEPLOY%\printsupport\
- copy C:\msys64\mingw32\share\qt5\plugins\printsupport\windowsprintersupport.dll %RS_DEPLOY%\printsupport\
- mkdir %RS_DEPLOY%\iconengines\
- copy C:\msys64\mingw32\share\qt5\plugins\iconengines\qsvgicon.dll %RS_DEPLOY%\iconengines\
- mkdir %RS_DEPLOY%\bearer\
- copy C:\msys64\mingw32\share\qt5\plugins\bearer\qgenericbearer.dll %RS_DEPLOY%\bearer\
- mkdir %RS_DEPLOY%\mediaservice\
- copy C:\msys64\mingw32\share\qt5\plugins\mediaservice\qtmedia_audioengine.dll %RS_DEPLOY%\mediaservice\
- copy C:\msys64\mingw32\share\qt5\plugins\mediaservice\dsengine.dll %RS_DEPLOY%\mediaservice\
- mkdir %RS_DEPLOY%\styles\
- copy C:\msys64\mingw32\share\qt5\plugins\styles\qwindowsvistastyle.dll %RS_DEPLOY%\styles\
- mkdir %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qwebp.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qicns.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qjpeg.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qtiff.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qtga.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qjp2.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qico.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qwbmp.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qicns.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qgif.dll %RS_DEPLOY%\imageformats\
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qsvg.dll %RS_DEPLOY%\imageformats\
- mkdir %RS_DEPLOY%\platforms\
- copy C:\msys64\mingw32\share\qt5\plugins\platforms\qwindows.dll %RS_DEPLOY%\platforms\
- mkdir %RS_DEPLOY%\audio\
- copy C:\msys64\mingw32\share\qt5\plugins\audio\qtaudio_windows.dll %RS_DEPLOY%\audio\
- windeployqt %RS_DEPLOY%\retroshare.exe
- copy C:\msys64\mingw32\bin\libbz2*.dll %RS_DEPLOY%\
#- copy C:\msys64\mingw32\bin\libeay32.dll %RS_DEPLOY%\
- copy C:\OpenSSL-Win32\libeay32.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libminiupnpc.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libsqlcipher*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libsqlite3*.dll %RS_DEPLOY%\
#- copy C:\msys64\mingw32\bin\ssleay32.dll %RS_DEPLOY%\
- copy C:\OpenSSL-Win32\ssleay32.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\zlib*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libgcc_s_dw2*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libstdc*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libwinpthread*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libicu*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libpcre*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libharfbuzz*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libpng*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libfreetype*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libglib*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libgraphite2.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libintl*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libiconv*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libjasper*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libjpeg*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libtiff*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libwebp*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libwebpdemux*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\liblzma*.dll %RS_DEPLOY%\
## Needed for cmark
- copy C:\msys64\mingw32\bin\libcmark*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libdouble-conversion*.dll %RS_DEPLOY%\
# to disable automatic builds
#build: off
#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
- path: '**\*.exe'
- path: filelist.txt
- path: $(RS_DEPLOY)
#
# # pushing a single file
# - path: test.zip
#
# # pushing a single file with environment variable in path and "Deployment name" specified
# - path: MyProject\bin\$(configuration)
# name: myapp
#
# # pushing entire folder as a zip archive
# - path: logs
#---------------------------------#
# deployment configuration #
#---------------------------------#
#No deployment under unknown computer!!!
#---------------------------------#
# global handlers #
#---------------------------------#
# on successful build
#on_success:
# - do something
# on build failure
#on_failure:
# - do something
# after build failure or success
#on_finish:
# - do something
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
# Email
- provider: Email
to:
- retrosharephenom@gmail.com
subject: 'Build {{status}}' # optional
message: "{{message}}, {{commitId}}, ..." # optional
on_build_status_changed: true

View file

@ -0,0 +1,170 @@
## Compilation on Linux
### Install package dependencies:
#### Debian / Ubuntu / Linux Mint
```bash
sudo apt-get install git g++ cmake libbz2-dev libjson-c-dev libssl-dev libsqlcipher-dev \
libupnp-dev doxygen libxss-dev rapidjson-dev libbotan-2-dev libasio-dev
```
To compile with Qt5:
```bash
sudo apt-get install qt5-qmake qtmultimedia5-dev libqt5x11extras5-dev
```
To compile with Qt6:
```bash
sudo apt-get install qt6-base-dev qt6-multimedia-dev qt6-5compat-dev
```
Additional dependencies for Feedreader plugin:
```bash
sudo apt-get install libxml2-dev libxslt1-dev libcurl4-openssl-dev
```
Additional dependencies for Voip plugin:
```bash
sudo apt-get install libavcodec-dev libcurl4-openssl-dev \
libqt5multimedia5-plugins libspeexdsp-dev
```
Autologin:
```bash
sudo apt install libsecret-1-dev
```
#### openSUSE
```bash
sudo zypper install git gcc-c++ cmake libqt5-qtbase-devel \
libqt5-qtmultimedia-devel libqt5-qtx11extras-devel libbz2-devel \
libopenssl-devel libupnp-devel libXss-devel sqlcipher-devel rapidjson-devel \
json-c botan bzip2
```
Additional packages to compile with Qt6:
```bash
sudo zypper install qt6-base-devel qt6-multimedia-devel qt6-qt5compat-devel
```
Additional dependencies for plugins:
```bash
sudo zypper install ffmpeg-4-libavcodec-devel libcurl-devel libxml2-devel \
libxslt-devel speex-devel speexdsp-devel
```
#### Arch Linux / Manjaro / EndeavourOS
```bash
sudo pacman -S base-devel libgnome-keyring cmake qt5-tools qt5-multimedia qt5-x11extras \
rapidjson doxygen libupnp libxslt libxss sqlcipher botan2 bzip2 json-c
```
To compile with Qt6:
```bash
sudo pacman -S qt6-base qt6-multimedia qt6-5compat
```
### Checkout the source code
```bash
cd ~
git clone https://github.com/RetroShare/RetroShare.git retroshare
```
### Checkout the submodules
```bash
cd retroshare
git submodule update --init --remote libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/
git submodule update --init --remote supportlibs/librnp supportlibs/restbed supportlibs/rapidjson
```
### Compile
```bash
qmake CONFIG+=release CONFIG+=rs_jsonapi CONFIG+=rs_webui
make
```
The executable produced will be:
```bash
./retroshare-gui/src/retroshare
```
### Install
```bash
sudo make install
```
The executable produced will be:
```bash
~/usr/bin/RetroShare
```
### For packagers
Packagers can use PREFIX and LIB\_DIR to customize the installation paths:
```bash
qmake PREFIX=/usr LIB_DIR=/usr/lib64 "CONFIG-=debug" "CONFIG+=release"
make
make INSTALL_ROOT=${PKGDIR} install
```
### libsqlcipher
If libsqlcipher is not available as a package
You need to place sqlcipher so that the hierarchy is:
~Home
|
+--- retroshare
|
+--- lib
|
+---- sqlcipher
```bash
mkdir lib
cd lib
git clone https://github.com/sqlcipher/sqlcipher.git --depth=1 --branch v3.4.1
cd sqlcipher
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
make
cd ..
```
### Build infos
Note: If you installed Qt6 you need to use `qmake6` on the command line.
For the `FeedReader` it is required to append the config option `CONFIG+=retroshare_plugins`.
Make sure `plugins/plugins.pro` contains `FeedReader` in the list of plugins to compile.
Do not mix plugins compiled with Qt5 with those compiled with Qt6. They work only if they are compiled
with the same Qt version as RetroShare.
Voip is outdated and is not compileable on the latest Debian.
For `Autologin` it is required to append the config option `CONFIG+=rs_autologin`.
### Build options
* Mandatory
* release or debug: normally you would like to use the release option
* Extra features (optional)
* rs_autologin: enable autologin
* retroshare_plugins: build plugins
* rs_webui: enable Web interface
* rs_jsonapi: enable json api interface, required by rs_webui
* gxsthewire: enable Wire service (experimental)
* wikipoos: enable Wiki service (experimental)
* rs_use_native_dialogs: enable native dialogs (may cause crashes with some versions of Gtk)
* rs_deep_channels_index: build with deep channel indexing support
* rs_deep_files_index: build with deep file indexing support
* "CONFIG+=..." enable other extra compile time features, you can find the almost complete list in file *&lt;sourcefolder&gt;\retroshare.pri*
### Examples:
```batch
qmake CONFIG+=debug CONFIG+=release CONFIG+=rs_use_native_dialog CONFIG+=rs_gui_cmark
qmake CONFIG+=rs_jsonapi CONFIG+=rs_webui CONFIG+=rs_autologin
```

@ -1 +1 @@
Subproject commit 0a3997cc1355b2c848161dca015b7e2df039707b Subproject commit 9dd9d7f94a600e8c8478887a4f7784fdc3294034

View file

@ -0,0 +1,129 @@
## Compilation on Red Hat-based Linux
### Install package dependencies:
#### RedHat/Fedora
```bash
sudo dnf install mesa-libGL-devel gcc cmake rapidjson-devel \
libupnp openssl sqlcipher sqlcipher-devel \
botan2 botan2-devel json-c-devel bzip2-devel asio-devel libsecret libXScrnSaver-devel
```
To compile with Qt5:
```bash
sudo dnf install qt5-qtbase-devel qt5-qtmultimedia qt5-qtx11extras
```
To compile with Qt6:
```bash
sudo dnf install qt6-qtbase-devel qt6-qtmultimedia-devel qt6-qt5compat-devel
```
Additional dependencies for Feedreader plugin:
```bash
sudo dnf install libxml2-devel libxslt-devel libcurl-devel
```
### Checkout the source code
```bash
cd ~
git clone https://github.com/RetroShare/RetroShare.git retroshare
```
### Checkout the submodules
```bash
cd retroshare
git submodule update --init --remote libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/
git submodule update --init --remote supportlibs/librnp supportlibs/restbed supportlibs/rapidjson
```
### Compile
```bash
qmake CONFIG+=release CONFIG+=rs_jsonapi CONFIG+=rs_webui
make
```
The executable produced will be:
```bash
./retroshare-gui/src/retroshare
```
### Install
```bash
sudo make install
```
The executable produced will be:
```bash
~/usr/bin/RetroShare
```
### For packagers
Packagers can use PREFIX and LIB\_DIR to customize the installation paths:
```bash
qmake PREFIX=/usr LIB_DIR=/usr/lib64 "CONFIG-=debug" "CONFIG+=release"
make
make INSTALL_ROOT=${PKGDIR} install
```
### SQLCipher
If libsqlcipher is not available as a package
You need to place sqlcipher so that the hierarchy is:
~Home
|
+--- retroshare
|
+--- lib
|
+---- sqlcipher
```bash
mkdir lib
cd lib
git clone https://github.com/sqlcipher/sqlcipher.git --depth=1 --branch v3.4.1
cd sqlcipher
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
make
cd ..
```
### Build infos
Note: If you installed Qt6 you need to use `qmake6` on the command line.
For the `FeedReader` it is required to append the config option `CONFIG+=retroshare_plugins`.
Make sure `plugins/plugins.pro` contains `FeedReader` in the list of plugins to compile.
Do not mix plugins compiled with Qt5 with those compiled with Qt6. They work only if they are compiled
with the same Qt version as RetroShare.
Voip is outdated and is not compileable on the latest Debian.
For `Autologin` it is required to append the config option `CONFIG+=rs_autologin`.
### Build options
* Mandatory
* release or debug: normally you would like to use the release option
* Extra features (optional)
* rs_autologin: enable autologin
* retroshare_plugins: build plugins
* rs_webui: enable Web interface
* rs_jsonapi: enable json api interface, required by rs_webui
* gxsthewire: enable Wire service (experimental)
* wikipoos: enable Wiki service (experimental)
* rs_use_native_dialogs: enable native dialogs (may cause crashes with some versions of Gtk)
* rs_deep_channels_index: build with deep channel indexing support
* rs_deep_files_index: build with deep file indexing support
* "CONFIG+=..." enable other extra compile time features, you can find the almost complete list in file *&lt;sourcefolder&gt;\retroshare.pri*
Example:
```batch
qmake CONFIG+=debug CONFIG+=release CONFIG+=rs_use_native_dialog CONFIG+=rs_gui_cmark
qmake CONFIG+=rs_jsonapi CONFIG+=rs_webui CONFIG+=rs_autologin
```

View file

@ -4,7 +4,7 @@ Version=1.0
Name=RetroShare Name=RetroShare
Comment=Securely communicate with your friends Comment=Securely communicate with your friends
Exec=/usr/bin/retroshare %U Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm Icon=retroshare.xpm
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P

View file

@ -8,7 +8,7 @@ Requirements: about 12 GB of free space
The resulting binary is a 32-bit build of Retroshare which will also work The resulting binary is a 32-bit build of Retroshare which will also work
fine on a 64-bit system. fine on a 64-bit system.
**If you want to make complet solution without debugging it, prefer to use \build_scripts\Windows-msys2\build.bat** **If you want to make complete solution without debugging it, prefer to use \build_scripts\Windows-msys2\build.bat**
This batch will install and build all for you. This batch will install and build all for you.

View file

@ -43,7 +43,9 @@ set NSIS_PARAM=%NSIS_PARAM% /DDEPLOYDIR="%RsDeployPath%"
set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%" set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%"
set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%" set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%"
set NSIS_PARAM=%NSIS_PARAM% /DARCHITECTURE="%RsArchitecture%" set NSIS_PARAM=%NSIS_PARAM% /DARCHITECTURE="%RsArchitecture%"
set NSIS_PARAM=%NSIS_PARAM% /DTOOLCHAIN="%RsToolchain%"
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra% set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra%
set NSIS_PARAM=%NSIS_PARAM% /DQTVERSION=%QtVersion%
set QtMainVersion=%QtVersion:~0,1% set QtMainVersion=%QtVersion:~0,1%
@ -53,7 +55,10 @@ rem makensis %NSIS_PARAM% "%SourcePath%\build_scripts\Windows-msys2\installer\re
rem pushd "%SourcePath%\build_scripts\Windows-msys2\installer" rem pushd "%SourcePath%\build_scripts\Windows-msys2\installer"
rem %EnvMSYS2Cmd% "makensis $0 retroshare-Qt%QtMainVersion%.nsi" "%NSIS_PARAM%" rem %EnvMSYS2Cmd% "makensis $0 retroshare-Qt%QtMainVersion%.nsi" "%NSIS_PARAM%"
rem popd rem popd
"%RsMinGWPath%\bin\makensis" %NSIS_PARAM% "%SourcePath%\build_scripts\Windows-msys2\installer\retroshare-Qt%QtMainVersion%.nsi"
rem Currently no need for separate nsi files
rem "%RsMinGWPath%\bin\makensis" %NSIS_PARAM% "%SourcePath%\build_scripts\Windows-msys2\installer\retroshare-Qt%QtMainVersion%.nsi"
"%RsMinGWPath%\bin\makensis" %NSIS_PARAM% "%SourcePath%\build_scripts\Windows-msys2\installer\retroshare.nsi"
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%

View file

@ -15,9 +15,11 @@ call "%~dp0env-base.bat" %*
if errorlevel 2 exit /B 2 if errorlevel 2 exit /B 2
if errorlevel 1 goto error_env if errorlevel 1 goto error_env
title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion% %RsToolchain% [Prerequisites]
if not "%ParamNoupdate%"=="1" ( if not "%ParamNoupdate%"=="1" (
:: Install needed things :: Install needed things
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt%ParamQtVersion% mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson"
:: rnp :: rnp
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-json-c mingw-w64-%RsMSYS2Architecture%-libbotan" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-json-c mingw-w64-%RsMSYS2Architecture%-libbotan"
@ -28,7 +30,7 @@ if not "%ParamNoupdate%"=="1" (
if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg" if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg"
:: Clang :: Clang
if "%ParamClang%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-clang" if "%ClangCompiler%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-clang"
:: Indexing :: Indexing
if "%ParamIndexing%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-libvorbis mingw-w64-%RsMSYS2Architecture%-flac mingw-w64-%RsMSYS2Architecture%-taglib" if "%ParamIndexing%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-libvorbis mingw-w64-%RsMSYS2Architecture%-flac mingw-w64-%RsMSYS2Architecture%-taglib"
@ -53,7 +55,7 @@ echo.
echo === Version echo === Version
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [Version] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion% %RsToolchain% [Version]
pushd "%SourcePath%\retroshare-gui\src\gui\images" pushd "%SourcePath%\retroshare-gui\src\gui\images"
:: Touch resource file :: Touch resource file
@ -67,7 +69,7 @@ echo.
echo === qmake echo === qmake
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [qmake] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion% %RsToolchain% [qmake]
set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=%RsBuildConfig%" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=%RsBuildConfig%"
if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin" if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin"
@ -79,14 +81,13 @@ echo %RsBuildConfig% >> buildinfo.txt
echo %RsArchitecture% >> buildinfo.txt echo %RsArchitecture% >> buildinfo.txt
echo Qt %QtVersion% >> buildinfo.txt echo Qt %QtVersion% >> buildinfo.txt
echo %RsToolchain% >> buildinfo.txt echo %RsToolchain% >> buildinfo.txt
echo %RsCompiler% >> buildinfo.txt
call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath
call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path
if "%ParamClang%"=="1" ( if "%ClangCompiler%"=="1" (
%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-clang-g++ %RS_QMAKE_CONFIG%" %EnvMSYS2Cmd% "%QMakeCmd% "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-clang-g++ %RS_QMAKE_CONFIG%"
) else ( ) else (
%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%" %EnvMSYS2Cmd% "%QMakeCmd% "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%"
) )
if errorlevel 1 goto error if errorlevel 1 goto error
@ -94,7 +95,7 @@ echo.
echo === make echo === make
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [make] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion% %RsToolchain% [make]
%EnvMSYS2Cmd% "make -j %CoreCount%" %EnvMSYS2Cmd% "make -j %CoreCount%"
if errorlevel 1 goto error if errorlevel 1 goto error

View file

@ -5,14 +5,16 @@ set ParamAutologin=0
set ParamPlugins=0 set ParamPlugins=0
set ParamTor=0 set ParamTor=0
set ParamWebui=0 set ParamWebui=0
set ParamClang=0 set ClangCompiler=0
set ParamIndexing=0 set ParamIndexing=0
set ParamFriendserver=0 set ParamFriendserver=0
set ParamNoupdate=0 set ParamNoupdate=0
set CoreCount=%NUMBER_OF_PROCESSORS% set CoreCount=%NUMBER_OF_PROCESSORS%
set RS_QMAKE_CONFIG= set RS_QMAKE_CONFIG=
set RsToolchain= set RsToolchain=
set ParamQtVersion=5
set tcc=0 set tcc=0
set QtVersionCount=0
:parameter_loop :parameter_loop
if "%~1" NEQ "" ( if "%~1" NEQ "" (
@ -43,6 +45,12 @@ if "%~1" NEQ "" (
set /A tcc=tcc+1 set /A tcc=tcc+1
) else if "%%~a"=="release" ( ) else if "%%~a"=="release" (
set ParamRelease=1 set ParamRelease=1
) else if "%%~a"=="qt5" (
set ParamQtVersion=5
set /A QtVersionCount+=1
) else if "%%~a"=="qt6" (
set ParamQtVersion=6
set /A QtVersionCount+=1
) else if "%%~a"=="debug" ( ) else if "%%~a"=="debug" (
set ParamDebug=1 set ParamDebug=1
) else if "%%~a"=="autologin" ( ) else if "%%~a"=="autologin" (
@ -55,8 +63,6 @@ if "%~1" NEQ "" (
set ParamWebui=1 set ParamWebui=1
) else if "%%~a"=="singlethread" ( ) else if "%%~a"=="singlethread" (
set CoreCount=1 set CoreCount=1
) else if "%%~a"=="clang" (
set ParamClang=1
) else if "%%~a"=="indexing" ( ) else if "%%~a"=="indexing" (
set ParamIndexing=1 set ParamIndexing=1
) else if "%%~a"=="friendserver" ( ) else if "%%~a"=="friendserver" (
@ -80,6 +86,16 @@ if %tcc% NEQ 1 (
goto :usage goto :usage
) )
if %QtVersionCount% GTR 1 (
echo Multiple Qt versions specified
goto :usage
)
if "%ParamQtVersion%" NEQ "5" if "%ParamQtVersion%" NEQ "6" (
echo Wrong Qt version specified
goto :usage
)
if "%RsToolchain%"=="mingw32" ( if "%RsToolchain%"=="mingw32" (
set RsArchitecture=x86 set RsArchitecture=x86
set RsMSYS2Architecture=i686 set RsMSYS2Architecture=i686
@ -96,24 +112,18 @@ if "%RsToolchain%"=="mingw32" (
set RsArchitecture=x64 set RsArchitecture=x64
set RsMSYS2Architecture=clang-x86_64 set RsMSYS2Architecture=clang-x86_64
set MSYSTEM=CLANG64 set MSYSTEM=CLANG64
set ParamClang=1 set ClangCompiler=1
) else if "%RsToolchain%"=="clang32" ( ) else if "%RsToolchain%"=="clang32" (
set RsArchitecture=x86 set RsArchitecture=x86
set RsMSYS2Architecture=clang-i686 set RsMSYS2Architecture=clang-i686
set MSYSTEM=CLANG32 set MSYSTEM=CLANG32
set ParamClang=1 set ClangCompiler=1
) else if "%RsToolchain%"=="clangarm64" ( ) else if "%RsToolchain%"=="clangarm64" (
set RsArchitecture=arm64 set RsArchitecture=arm64
set RsMSYS2Architecture=clang-aarch64 set RsMSYS2Architecture=clang-aarch64
set MSYSTEM=CLANGARM64 set MSYSTEM=CLANGARM64
) )
if "%ParamClang%"=="1" (
set RsCompiler=Clang
) else (
set RsCompiler=GCC
)
if "%ParamRelease%"=="1" ( if "%ParamRelease%"=="1" (
if "%ParamDebug%"=="1" ( if "%ParamDebug%"=="1" (
echo. echo.
@ -148,7 +158,7 @@ exit /B 0
:usage :usage
echo. echo.
echo Usage: 32^|64^|other release^|debug [autologin plugins webui singlethread clang indexing friendserver noupdate] ["CONFIG+=..."] echo Usage: 32^|64^|other release^|debug qt5^|qt6 [autologin plugins webui singlethread clang indexing friendserver noupdate] ["CONFIG+=..."]
echo. echo.
echo Mandatory parameter echo Mandatory parameter
echo 32^|64 32-bit or 64-bit version (same as mingw32 or mingw64) echo 32^|64 32-bit or 64-bit version (same as mingw32 or mingw64)
@ -156,13 +166,13 @@ echo Or you can specify any other toolchain supported by msys
echo mingw32^|mingw64^|clang32^|clang64^|ucrt64^|clangarm64 echo mingw32^|mingw64^|clang32^|clang64^|ucrt64^|clangarm64
echo More info: https://www.msys2.org/docs/environments echo More info: https://www.msys2.org/docs/environments
echo release^|debug Build release or debug version echo release^|debug Build release or debug version
echo qt5^|qt6 Build with Qt 5 (default) or Qt 6
echo. echo.
echo Optional parameter (need clean when changed) echo Optional parameter (need clean when changed)
echo autologin Build with autologin echo autologin Build with autologin
echo plugins Build plugins echo plugins Build plugins
echo webui Enable JsonAPI and pack webui files echo webui Enable JsonAPI and pack webui files
echo singlethread Use only 1 thread for building echo singlethread Use only 1 thread for building
echo clang Use clang compiler instead of GCC
echo indexing Build with deep channel and file indexing support echo indexing Build with deep channel and file indexing support
echo friendserver Enable friendserver support echo friendserver Enable friendserver support
echo noupdate Skip updating the libraries echo noupdate Skip updating the libraries

View file

@ -1,6 +1,6 @@
call "%~dp0env-base.bat" %* call "%~dp0env-base.bat" %*
if errorlevel 2 exit /B 2 if errorlevel 2 exit /B 2
if errorlevel 1 goto error_env if errorlevel 1 exit /B 1
set BuildPath=%EnvRootPath%\builds set BuildPath=%EnvRootPath%\builds
set DeployPath=%EnvRootPath%\deploy set DeployPath=%EnvRootPath%\deploy
@ -8,14 +8,20 @@ set DeployPath=%EnvRootPath%\deploy
if not exist "%BuildPath%" mkdir "%BuildPath%" if not exist "%BuildPath%" mkdir "%BuildPath%"
if not exist "%DeployPath%" mkdir "%DeployPath%" if not exist "%DeployPath%" mkdir "%DeployPath%"
set QMakeCmd=
if "%ParamQtVersion%"=="5" set QMakeCmd=qmake
if "%ParamQtVersion%"=="6" set QMakeCmd=qmake6
if "%QMakeCmd%"=="" %cecho% error "Unknown Qt version %ParamQtVersion%." & exit /B 1
:: Get Qt version :: Get Qt version
call "%ToolsPath%\get-qt-version.bat" QtVersion call "%ToolsPath%\get-qt-version.bat" QtVersion %QMakeCmd%
if errorlevel 1 %cecho% error "Cannot get Qt version." & exit /B 1
if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1 if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
set RsMinGWPath=%EnvMSYS2BasePath%\%RsToolchain% set RsMinGWPath=%EnvMSYS2BasePath%\%RsToolchain%
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsToolchain%-%RsCompiler%-%RsBuildConfig% set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsToolchain%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsToolchain%-%RsCompiler%-%RsBuildConfig% set RsDeployPath=%DeployPath%\Qt-%QtVersion%-%RsToolchain%%RsType%-%RsBuildConfig%
set RsPackPath=%DeployPath% set RsPackPath=%DeployPath%
set RsArchiveAdd= set RsArchiveAdd=
set RsWebuiBuildPath=%RsBuildPath%\retroshare-webui\webui set RsWebuiBuildPath=%RsBuildPath%\retroshare-webui\webui

View file

@ -55,25 +55,28 @@ set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
:: Check WMIC is available :: Check WMIC is available
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
:: Use WMIC to retrieve date in format YYYYMMDD :: Get date
set RsDate= call "%ToolsPath%\get-rs-date.bat" "%SourcePath%" RsDate
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I if errorlevel 1 %cecho% error "Could not get date."& goto error
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
if "%RsDate%"=="" %cecho% error "Could not get date."& goto error
set QtMainVersion=%QtVersion:~0,1% set QtMainVersion=%QtVersion:~0,1%
set QtSharePath=%RsMinGWPath%\share\qt%QtMainVersion%\ set QtSharePath=%RsMinGWPath%\share\qt%QtMainVersion%\
rem Qt 4 = QtSvg4.dll rem Qt 4 = QtSvg4.dll
rem Qt 5 = Qt5Svg.dll rem Qt 5 = Qt5Svg.dll
rem Qt 6 = Qt6Svg.dll
set QtMainVersion1= set QtMainVersion1=
set QtMainVersion2= set QtMainVersion2=
if "%QtMainVersion%"=="4" set QtMainVersion2=4 if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5 if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%QtMainVersion%"=="6" set QtMainVersion1=6
if "%RsBuildConfig%" NEQ "release" ( if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-%RsArchitecture%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-%RsToolchain%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
) else ( ) else (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-%RsArchitecture%-msys2%RsType%%RsArchiveAdd%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-%RsToolchain%-msys2%RsType%%RsArchiveAdd%.7z
) )
if exist "%Archive%" del /Q "%Archive%" if exist "%Archive%" del /Q "%Archive%"
@ -81,7 +84,7 @@ if exist "%Archive%" del /Q "%Archive%"
:: Create deploy path :: Create deploy path
mkdir "%RsDeployPath%" mkdir "%RsDeployPath%"
title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files] title Pack - %SourceName%%RsType%-%RsBuildConfig% Qt-%QtVersion% %RsToolchain% [copy files]
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
set Extensions= set Extensions=
@ -118,18 +121,24 @@ for /D %%D in ("%RsBuildPath%\plugins\*") do (
echo copy Qt DLL's echo copy Qt DLL's
copy "%RsMinGWPath%\bin\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite% copy "%RsMinGWPath%\bin\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite%
if "%QtMainVersion%"=="5" ( if %QtMainVersion% GEQ 5 (
mkdir "%RsDeployPath%\platforms" mkdir "%RsDeployPath%\platforms"
copy "%QtSharePath%\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite% copy "%QtSharePath%\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite%
)
if "%QtMainVersion%"=="5" (
mkdir "%RsDeployPath%\audio" mkdir "%RsDeployPath%\audio"
copy "%QtSharePath%\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite% copy "%QtSharePath%\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
) )
if exist "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" ( echo copy styles
echo copy styles mkdir "%RsDeployPath%\styles" %Quite%
mkdir "%RsDeployPath%\styles" %Quite% if "%QtMainVersion%"=="5" (
copy "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite% copy "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite%
) )
if "%QtMainVersion%"=="6" (
copy "%QtSharePath%\plugins\styles\qmodernwindowsstyle.dll" "%RsDeployPath%\styles" %Quite%
)
copy "%QtSharePath%\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite% copy "%QtSharePath%\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite%
del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite% del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite%
@ -170,11 +179,13 @@ xcopy /S "%SourcePath%\retroshare-gui\src\license" "%RsDeployPath%\license" %Qui
echo copy translation echo copy translation
copy "%SourcePath%\retroshare-gui\src\translations\qt_tr.qm" "%RsDeployPath%\translations" %Quite% copy "%SourcePath%\retroshare-gui\src\translations\qt_tr.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtSharePath%\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtSharePath%\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite%
if "%QtMainVersion%"=="5" ( if "%QtMainVersion%"=="6" (
copy "%QtSharePath%\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtSharePath%\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtSharePath%\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtSharePath%\translations\qtquick1_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtSharePath%\translations\qtquick1_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtSharePath%\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtSharePath%\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite%
)
if "%QtMainVersion%"=="5" (
copy "%QtSharePath%\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtSharePath%\translations\qtxmlpatterns_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtSharePath%\translations\qtxmlpatterns_*.qm" "%RsDeployPath%\translations" %Quite%
) )
@ -199,7 +210,7 @@ if "%ParamWebui%"=="1" (
) )
rem pack files rem pack files
title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files] title Pack - %SourceName%%RsType%-%RsBuildConfig% Qt-%QtVersion% %RsToolchain% [pack files]
"%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*" "%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*"

View file

@ -16,7 +16,7 @@ if "%~1"=="clean" (
goto exit goto exit
) )
set MSYS2Version=20241208 set MSYS2Version=20250622
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%

View file

@ -9,6 +9,7 @@
;!define REVISION "" ;!define REVISION ""
;!define DEPLOYDIR "" ;!define DEPLOYDIR ""
;!define ARCHITECTURE "" ;!define ARCHITECTURE ""
;!define TOOLCHAIN ""
# Optional defines # Optional defines
;!define OUTDIR "" ;!define OUTDIR ""
@ -21,6 +22,9 @@
!ifndef ARCHITECTURE !ifndef ARCHITECTURE
!error "ARCHITECTURE is not defined" !error "ARCHITECTURE is not defined"
!endif !endif
!ifndef TOOLCHAIN
!error "TOOLCHAIN is not defined"
!endif
# Check optional defines # Check optional defines
!ifdef OUTDIR !ifdef OUTDIR
@ -72,7 +76,7 @@ ${!defineifexist} TOR_EXISTS "${DEPLOYDIR}\tor.exe"
# Main Install settings # Main Install settings
Name "${APPNAMEANDVERSION}" Name "${APPNAMEANDVERSION}"
InstallDirRegKey HKLM "Software\${APPNAME}" "" InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-${ARCHITECTURE}${RSTYPE}${INSTALLERADD}-setup.exe" OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-Qt-${QTVERSION}-${TOOLCHAIN}-msys2${RSTYPE}${INSTALLERADD}-setup.exe"
BrandingText "${APPNAMEANDVERSION}" BrandingText "${APPNAMEANDVERSION}"
RequestExecutionlevel highest RequestExecutionlevel highest
# Use compression # Use compression

View file

@ -44,8 +44,9 @@ Run the scripts in this order:
**Always delete the build artifacts folder if you enable or disable extra features after the build command: &lt;sourcefolder&gt;-msys2\deploy\builds** **Always delete the build artifacts folder if you enable or disable extra features after the build command: &lt;sourcefolder&gt;-msys2\deploy\builds**
* Mandatory * Mandatory
* 32 or 64: 32 or 64 bit version * 32, 64, mingw32, mingw64, ucrt64, clang32, clang64 or clangarm64: It sets the msys2 build environment to the selected value. 32 is a shortcut for mingw32, 64 is a shortcut for mingw64. Default in build.bat and buil-tor.bat is 64.
* release or debug: normally you would like to use the release option * release or debug: normally you would like to use the release option
* qt5 or qt6: build with Qt 5 (default) or Qt 6
* Extra features (optional) * Extra features (optional)
* autologin: enable autologin * autologin: enable autologin
* plugins: build plugins * plugins: build plugins
@ -55,7 +56,6 @@ Run the scripts in this order:
* "CONFIG+=..." enable other extra compile time features, you can find the almost complete list in file *&lt;sourcefolder&gt;\retroshare.pri* * "CONFIG+=..." enable other extra compile time features, you can find the almost complete list in file *&lt;sourcefolder&gt;\retroshare.pri*
* For fixing compile problems (optional) * For fixing compile problems (optional)
* singlethread: use only 1 thread for building, slow but useful if you don't find the error message in the console * singlethread: use only 1 thread for building, slow but useful if you don't find the error message in the console
* clang: use clang compiler instead of GCC
* noupdate: skip the msys2 update step, sometimes some msys2 packages are broken, you can manually switch back to the older package, and this option will prevent updating to the broken version again * noupdate: skip the msys2 update step, sometimes some msys2 packages are broken, you can manually switch back to the older package, and this option will prevent updating to the broken version again
Example: Example:

View file

@ -1,5 +1,5 @@
:: Usage: :: Usage:
:: call get-qt-version.bat variable :: call get-qt-version.bat variable qmake
setlocal setlocal
@ -10,9 +10,16 @@ if "%Var%"=="" (
exit /B 1 exit /B 1
) )
set QMakeCmd=%~2
if "%QMakeCmd%"=="" (
echo.
echo Parameter error.
exit /B 1
)
set QtVersion= set QtVersion=
%EnvMSYS2Cmd% "qmake -version" >"%~dp0qtversion.tmp" %EnvMSYS2Cmd% "%QMakeCmd% -version" >"%~dp0qtversion.tmp"
for /F "tokens=1,2,3,4" %%A in (%~sdp0qtversion.tmp) do ( for /F "tokens=1,2,3,4" %%A in (%~sdp0qtversion.tmp) do (
if "%%A"=="Using" ( if "%%A"=="Using" (
set QtVersion=%%D set QtVersion=%%D

View file

@ -0,0 +1,32 @@
REM Usage:
REM call get-rs-date.bat SourcePath Variable
setlocal
set SourcePath=%~1
set Variable=%~2
if "%Variable%"=="" (
echo.
echo Parameter error
exit /B 1
)
:: Check git executable
set GitPath=
call "%~dp0find-in-path.bat" GitPath git.exe
if "%GitPath%"=="" (
echo.
echo Git executable not found in PATH.
exit /B 1
)
set Date=
pushd "%SourcePath%"
rem This doesn't work: git log -1 --date=format:"%Y%m%d" --format="%ad"
for /F "tokens=1,2,3* delims=-" %%A in ('git log -1 --date^=short --format^="%%ad"') do set Date=%%A%%B%%C
popd
:exit
endlocal & set %Variable%=%Date%
exit /B 0

View file

@ -0,0 +1,35 @@
## Build Retroshare with QtCreator & Qt 6.9 on Windows
### Qt 6.9 Installation
Download Qt 6.9 from: https://www.qt.io/download-dev
Run the installer and install Qt 6.9
Add GCC.exe to Path
C:\Qt\Tools\mingw1310_64\bin
Compile the external libs start build-libs.bat:
Open Qt Command Prompt:
cd C:\Users\User\Documents\GitHub\RetroShare\build_scripts\Windows\build-libs
Type (this will take some time to build all libs):
build-libs.bat
Open Qt Creator
Open project -> RetroShare.pro
After Project loaded, go to:
Projects->Build->Build Steps->Additional arguments:
Add EXTERNAL_LIB_DIR:
"EXTERNAL_LIB_DIR=%{sourceDir}\..\RetroShare-env\build-libs\gcc-13.1.0\x64\libs"
After done, Build Project

View file

@ -2,17 +2,18 @@ ZLIB_VERSION=1.2.11
BZIP2_VERSION=1.0.8 BZIP2_VERSION=1.0.8
MINIUPNPC_VERSION=2.2.3 MINIUPNPC_VERSION=2.2.3
OPENSSL_VERSION=1.1.1w OPENSSL_VERSION=1.1.1w
SPEEX_VERSION=1.2.0 SPEEX_VERSION=1.2.1
SPEEXDSP_VERSION=1.2.0 SPEEXDSP_VERSION=1.2.1
LIBXML2_VERSION=2.9.12 LIBXML2_MAIN_VERSION=2.14
LIBXSLT_VERSION=1.1.34 LIBXML2_VERSION=$(LIBXML2_MAIN_VERSION).5
CURL_VERSION=7.81.0 LIBXSLT_MAIN_VERSION=1.1
LIBXSLT_VERSION=$(LIBXSLT_MAIN_VERSION).43
CURL_VERSION=8.9.1
TCL_VERSION=8.6.10 TCL_VERSION=8.6.10
SQLCIPHER_VERSION=4.5.0 SQLCIPHER_VERSION=4.5.0
LIBMICROHTTPD_VERSION=0.9.75 FFMPEG_VERSION=4.4.6
FFMPEG_VERSION=4.4
RAPIDJSON_VERSION=1.1.0 RAPIDJSON_VERSION=1.1.0
XAPIAN_VERSION=1.4.19 XAPIAN_VERSION=1.4.29
ASIO_VERSION=1-34-2 ASIO_VERSION=1-34-2
#RNP_VERSION=0.17.1 #RNP_VERSION=0.17.1
@ -24,7 +25,7 @@ DOWNLOAD_PATH?=download
BUILD_PATH=build BUILD_PATH=build
LIBS_PATH?=libs LIBS_PATH?=libs
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian jsonc botan asio copylibs all: dirs zlib bzip2 miniupnpc openssl speex speexdsp libxml curl sqlcipher ffmpeg rapidjson xapian jsonc botan asio copylibs
#rnp #rnp
download: \ download: \
@ -34,13 +35,12 @@ download: \
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz \ $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz \ $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz \ $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz \ $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz \
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz \ $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz \
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz \ $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \ $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \ $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \ $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz \
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz \
$(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz \ $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz \
$(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz
@ -63,8 +63,7 @@ $(BUILD_PATH)/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
rm -r -f $(BUILD_PATH)/zlib-* rm -r -f $(BUILD_PATH)/zlib-*
tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# build # build
cd zlib-$(ZLIB_VERSION) && make -f win32/Makefile.gcc libz.a cd zlib-$(ZLIB_VERSION) && make -j -f win32/Makefile.gcc libz.a
cd zlib-$(ZLIB_VERSION) && make
# copy files # copy files
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include
cp zlib-$(ZLIB_VERSION)/zlib.h $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include/ cp zlib-$(ZLIB_VERSION)/zlib.h $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include/
@ -86,7 +85,7 @@ $(BUILD_PATH)/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).ta
tar xvf $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# build # build
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../$(BUILD_PATH)" #cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../$(BUILD_PATH)"
cd bzip2-$(BZIP2_VERSION) && make cd bzip2-$(BZIP2_VERSION) && make -j
# copy files # copy files
mkdir -p $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include mkdir -p $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include
cp bzip2-$(BZIP2_VERSION)/bzlib.h $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include/ cp bzip2-$(BZIP2_VERSION)/bzlib.h $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include/
@ -106,7 +105,7 @@ $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIU
rm -r -f $(BUILD_PATH)/miniupnpc-* rm -r -f $(BUILD_PATH)/miniupnpc-*
tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# build # build
cd miniupnpc-$(MINIUPNPC_VERSION) && export CC=gcc && export PATH=.:$$PATH && make -f Makefile.mingw libminiupnpc.a miniupnpc.dll cd miniupnpc-$(MINIUPNPC_VERSION) && export CC=gcc && export PATH=.:$$PATH && make -j -f Makefile.mingw libminiupnpc.a miniupnpc.dll
# copy files # copy files
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc
cp miniupnpc-$(MINIUPNPC_VERSION)/include/*.h $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/ cp miniupnpc-$(MINIUPNPC_VERSION)/include/*.h $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
@ -131,7 +130,7 @@ $(BUILD_PATH)/openssl-$(OPENSSL_VERSION): $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VER
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../$(BUILD_PATH)" #cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../$(BUILD_PATH)"
#cd openssl-$(OPENSSL_VERSION) && make install #cd openssl-$(OPENSSL_VERSION) && make install
cd openssl-$(OPENSSL_VERSION) && ./config shared cd openssl-$(OPENSSL_VERSION) && ./config shared
cd openssl-$(OPENSSL_VERSION) && make cd openssl-$(OPENSSL_VERSION) && make -j
# copy files # copy files
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl
cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl/ cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl/
@ -160,7 +159,7 @@ $(BUILD_PATH)/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).ta
# build # build
cd speex-$(SPEEX_VERSION) && ./configure cd speex-$(SPEEX_VERSION) && ./configure
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)" #cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd speex-$(SPEEX_VERSION) && make cd speex-$(SPEEX_VERSION) && make -j
# copy files # copy files
mkdir -p $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex mkdir -p $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex
cp speex-$(SPEEX_VERSION)/include/speex/*.h $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex/ cp speex-$(SPEEX_VERSION)/include/speex/*.h $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex/
@ -181,7 +180,7 @@ $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP
tar xvf $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
# build # build
cd speexdsp-$(SPEEXDSP_VERSION) && ./configure cd speexdsp-$(SPEEXDSP_VERSION) && ./configure
cd speexdsp-$(SPEEXDSP_VERSION) && make cd speexdsp-$(SPEEXDSP_VERSION) && make -j
# copy files # copy files
mkdir -p $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex mkdir -p $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex
cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex/ cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex/
@ -191,50 +190,52 @@ $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP
rm -r -f speexdsp-$(SPEEXDSP_VERSION) rm -r -f speexdsp-$(SPEEXDSP_VERSION)
mv $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION) mv $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION)
libxml2: $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION) libxml: \
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION) \
$(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz: $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz:
wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz wget --no-check-certificate https://download.gnome.org/sources/libxml2/$(LIBXML2_MAIN_VERSION)/libxml2-$(LIBXML2_VERSION).tar.xz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz:
# prepare wget --no-check-certificate https://download.gnome.org/sources/libxslt/$(LIBXSLT_MAIN_VERSION)/libxslt-$(LIBXSLT_VERSION).tar.xz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION) $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION): \
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz \
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz
# libxml2: prepare
pacman --needed --noconfirm -S python3 pkg-config
rm -r -f $(BUILD_PATH)/libxml2-* rm -r -f $(BUILD_PATH)/libxml2-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz
# build # libxslt: prepare
rm -r -f $(BUILD_PATH)/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz
# libxml2: build
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)" #cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd libxml2-$(LIBXML2_VERSION) && make cd libxml2-$(LIBXML2_VERSION) && make -j libxml2.la
# copy files # libxslt: build
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION)/libxslt && make -j
cd libxslt-$(LIBXSLT_VERSION)/libexslt && make -j
# libxml2: copy files
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml
cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/ cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib/ cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib/
# cleanup # libxslt: copy files
#rm -r -f libxml2-$(LIBXML2_VERSION) # see libxslt
mv $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
libxslt: $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
$(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# build
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt
cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/ cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/ cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/ cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
# cleanup # libxml2: cleanup
rm -r -f libxml2-$(LIBXML2_VERSION) rm -r -f libxml2-$(LIBXML2_VERSION)
# libxslt: cleanup
rm -r -f libxslt-$(LIBXSLT_VERSION) rm -r -f libxslt-$(LIBXSLT_VERSION)
# finish
mv $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
mv $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION) mv $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
curl: $(BUILD_PATH)/curl-$(CURL_VERSION) curl: $(BUILD_PATH)/curl-$(CURL_VERSION)
@ -249,7 +250,7 @@ $(BUILD_PATH)/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# build # build
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)" cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)"
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)" #cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd curl-$(CURL_VERSION) && make cd curl-$(CURL_VERSION)/lib && make -j
# copy files # copy files
mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl
cp curl-$(CURL_VERSION)/include/curl/*.h $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl/ cp curl-$(CURL_VERSION)/include/curl/*.h $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl/
@ -274,14 +275,14 @@ $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)
tar xvf $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz tar xvf $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
mkdir -p tcl$(TCL_VERSION)/build mkdir -p tcl$(TCL_VERSION)/build
cd tcl$(TCL_VERSION)/build && ../win/configure cd tcl$(TCL_VERSION)/build && ../win/configure
cd tcl$(TCL_VERSION)/build && make cd tcl$(TCL_VERSION)/build && make -j
#sqlcipher #sqlcipher
tar xvf $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh
mkdir -p tcl$(TCL_VERSION)/lib mkdir -p tcl$(TCL_VERSION)/lib
ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6 ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6
# build # build
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && export LIBS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lgdi32 $$LIBS" && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install" cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && export LIBS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lgdi32 $$LIBS" && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make -j install prefix="`pwd`/install"
# copy files # copy files
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include/ cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include/
@ -294,34 +295,18 @@ $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)
rm -r -f tcl$(TCL_VERSION) rm -r -f tcl$(TCL_VERSION)
mv $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION) mv $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION)
libmicrohttpd: $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
$(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION): $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/libmicrohttpd-*
tar xvf $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
# build
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp"
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install
# cleanup
rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION)
mv $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
ffmpeg: $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION) ffmpeg: $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz: $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz:
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.xz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz
$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz
# prepare # prepare
rm -r -f $(BUILD_PATH)/ffmpeg-* rm -r -f $(BUILD_PATH)/ffmpeg-*
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz
# build # build
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp" cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp"
cd ffmpeg-$(FFMPEG_VERSION) && make install cd ffmpeg-$(FFMPEG_VERSION) && make -j install
# cleanup # cleanup
rm -r -f ffmpeg-$(FFMPEG_VERSION) rm -r -f ffmpeg-$(FFMPEG_VERSION)
mv $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION) mv $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
@ -359,7 +344,7 @@ $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION): $(DOWNLOAD_PATH)/xapian-core-$(XAPI
#cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp" #cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp"
#cd xapian-core-$(XAPIAN_VERSION) && make install #cd xapian-core-$(XAPIAN_VERSION) && make install
cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static
cd xapian-core-$(XAPIAN_VERSION) && make cd xapian-core-$(XAPIAN_VERSION) && make -j
# copy files # copy files
mkdir -p $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include mkdir -p $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include
cp -r xapian-core-$(XAPIAN_VERSION)/include/* $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include/ cp -r xapian-core-$(XAPIAN_VERSION)/include/* $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include/
@ -379,7 +364,7 @@ $(BUILD_PATH)/json-c-$(JSON_C_VERSION):
# build # build
mkdir -p json-c-$(JSON_C_VERSION)/build mkdir -p json-c-$(JSON_C_VERSION)/build
cd json-c-$(JSON_C_VERSION)/build && cmake .. -G"MSYS Makefiles" -Wno-dev -DCMAKE_BUILD_TYPE="release" -DBUILD_SHARED_LIBS=off -DBUILD_STATIC_LIBS=on -DBUILD_TESTING=off -DCMAKE_CXX_FLAGS="-D__MINGW_USE_VC2005_COMPAT" -DCMAKE_INSTALL_PREFIX="`pwd`/install" -DCMAKE_INSTALL_PREFIX="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp" cd json-c-$(JSON_C_VERSION)/build && cmake .. -G"MSYS Makefiles" -Wno-dev -DCMAKE_BUILD_TYPE="release" -DBUILD_SHARED_LIBS=off -DBUILD_STATIC_LIBS=on -DBUILD_TESTING=off -DCMAKE_CXX_FLAGS="-D__MINGW_USE_VC2005_COMPAT" -DCMAKE_INSTALL_PREFIX="`pwd`/install" -DCMAKE_INSTALL_PREFIX="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp"
cd json-c-$(JSON_C_VERSION)/build && make install cd json-c-$(JSON_C_VERSION)/build && make -j install
# cleanup # cleanup
rm -r -f json-c-$(JSON_C_VERSION) rm -r -f json-c-$(JSON_C_VERSION)
mv $(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp $(BUILD_PATH)/json-c-$(JSON_C_VERSION) mv $(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp $(BUILD_PATH)/json-c-$(JSON_C_VERSION)
@ -394,7 +379,7 @@ $(BUILD_PATH)/botan-$(BOTAN_VERSION):
# build # build
if [ $(MSYSTEM) = "MINGW32" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_32 --disable-shared-library --enable-static-library --extra-cxxflags="-D__MINGW_USE_VC2005_COMPAT" --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi if [ $(MSYSTEM) = "MINGW32" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_32 --disable-shared-library --enable-static-library --extra-cxxflags="-D__MINGW_USE_VC2005_COMPAT" --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi
if [ $(MSYSTEM) = "MINGW64" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_64 --disable-shared-library --enable-static-library --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi if [ $(MSYSTEM) = "MINGW64" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_64 --disable-shared-library --enable-static-library --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi
cd botan-$(BOTAN_VERSION) && make install cd botan-$(BOTAN_VERSION) && make -j install
# cleanup # cleanup
rm -r -f botan-$(BOTAN_VERSION) rm -r -f botan-$(BOTAN_VERSION)
mv $(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp $(BUILD_PATH)/botan-$(BOTAN_VERSION) mv $(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp $(BUILD_PATH)/botan-$(BOTAN_VERSION)
@ -438,5 +423,5 @@ $(BUILD_PATH)/rnp-$(RNP_VERSION):
copylibs: copylibs:
rm -r -f $(LIBS_PATH) ; \ rm -r -f $(LIBS_PATH) ; \
mkdir -p $(LIBS_PATH) ; \ mkdir -p $(LIBS_PATH) ; \
cp $(BUILD_PATH)/gcc-version $(LIBS_PATH) ; \ cp -p $(BUILD_PATH)/gcc-version $(LIBS_PATH) ; \
find $(BUILD_PATH) -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r {}/. $(LIBS_PATH) \; ; \ find $(BUILD_PATH) -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r -p {}/. $(LIBS_PATH) \; ; \

View file

@ -33,7 +33,7 @@ echo.
echo === Version echo === Version
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [Version] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion%-%GCCArchitecture% [Version]
pushd "%SourcePath%\retroshare-gui\src\gui\images" pushd "%SourcePath%\retroshare-gui\src\gui\images"
:: Touch resource file :: Touch resource file
@ -47,7 +47,7 @@ echo.
echo === qmake echo === qmake
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [qmake] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion%-%GCCArchitecture% [qmake]
set RS_QMAKE_CONFIG=%RsBuildConfig% set RS_QMAKE_CONFIG=%RsBuildConfig%
if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_autologin if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_autologin
@ -66,7 +66,7 @@ echo.
echo === make echo === make
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [make] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion%-%GCCArchitecture% [make]
mingw32-make -j %CoreCount% mingw32-make -j %CoreCount%
if errorlevel 1 goto error if errorlevel 1 goto error
@ -75,7 +75,7 @@ echo.
echo === Changelog echo === Changelog
echo. echo.
title Build - %SourceName%-%RsBuildConfig% [changelog] title Build - %SourceName%-%RsBuildConfig% Qt-%QtVersion%-%GCCArchitecture% [changelog]
call "%ToolsPath%\generate-changelog.bat" "%SourcePath%" "%RsBuildPath%\changelog.txt" call "%ToolsPath%\generate-changelog.bat" "%SourcePath%" "%RsBuildPath%\changelog.txt"
:error :error

View file

@ -59,10 +59,12 @@ set QtMainVersion=%QtVersion:~0,1%
rem Qt 4 = QtSvg4.dll rem Qt 4 = QtSvg4.dll
rem Qt 5 = Qt5Svg.dll rem Qt 5 = Qt5Svg.dll
rem Qt 6 = Qt6Svg.dll
set QtMainVersion1= set QtMainVersion1=
set QtMainVersion2= set QtMainVersion2=
if "%QtMainVersion%"=="4" set QtMainVersion2=4 if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5 if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%QtMainVersion%"=="6" set QtMainVersion1=6
if "%RsBuildConfig%" NEQ "release" ( if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-%GCCArchitecture%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-%GCCArchitecture%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
@ -75,7 +77,7 @@ if exist "%Archive%" del /Q "%Archive%"
:: Create deploy path :: Create deploy path
mkdir "%RsDeployPath%" mkdir "%RsDeployPath%"
title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files] title Pack - %SourceName%%RsType%-%RsBuildConfig% Qt-%QtVersion%-%GCCArchitecture% [copy files]
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
set Extensions= set Extensions=
@ -131,18 +133,24 @@ if exist "%RsDeployPath%\retroshare.dll" call :copy_dependencies "%RsDeployPath%
echo copy Qt DLL's echo copy Qt DLL's
copy "%QtPath%\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite% copy "%QtPath%\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite%
if "%QtMainVersion%"=="5" ( if %QtMainVersion% GEQ 5 (
mkdir "%RsDeployPath%\platforms" mkdir "%RsDeployPath%\platforms"
copy "%QtPath%\..\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite% copy "%QtPath%\..\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite%
)
if "%QtMainVersion%"=="5" (
mkdir "%RsDeployPath%\audio" mkdir "%RsDeployPath%\audio"
copy "%QtPath%\..\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite% copy "%QtPath%\..\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
) )
if exist "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" ( echo Copy styles
echo Copy styles mkdir "%RsDeployPath%\styles" %Quite%
mkdir "%RsDeployPath%\styles" %Quite% if "%QtMainVersion%"=="5" (
copy "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite% copy "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite%
) )
if "%QtMainVersion%"=="6" (
copy "%QtPath%\..\plugins\styles\qmodernwindowsstyle.dll" "%RsDeployPath%\styles" %Quite%
)
copy "%QtPath%\..\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite% copy "%QtPath%\..\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite%
del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite% del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite%
@ -169,10 +177,12 @@ xcopy /S "%SourcePath%\retroshare-gui\src\license" "%RsDeployPath%\license" %Qui
echo copy translation echo copy translation
copy "%SourcePath%\retroshare-gui\src\translations\qt_tr.qm" "%RsDeployPath%\translations" %Quite% copy "%SourcePath%\retroshare-gui\src\translations\qt_tr.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtPath%\..\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite%
if "%QtMainVersion%"=="5" ( if %QtMainVersion% GEQ 5 (
copy "%QtPath%\..\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtPath%\..\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtPath%\..\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite%
)
if "%QtMainVersion%"=="5" (
copy "%QtPath%\..\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtxmlpatterns_*.qm" "%RsDeployPath%\translations" %Quite% copy "%QtPath%\..\translations\qtxmlpatterns_*.qm" "%RsDeployPath%\translations" %Quite%
) )
@ -196,7 +206,7 @@ if "%ParamTor%"=="1" (
) )
rem pack files rem pack files
title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files] title Pack - %SourceName%%RsType%-%RsBuildConfig% Qt-%QtVersion%-%GCCArchitecture% [pack files]
"%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*" "%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*"

View file

@ -16,7 +16,7 @@ if "%~1"=="clean" (
goto exit goto exit
) )
set MSYS2Version=20241208 set MSYS2Version=20250622
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%

View file

@ -232,7 +232,7 @@ Section $(Section_Main) Section_Main
; Qt styles ; Qt styles
SetOutPath "$INSTDIR\styles" SetOutPath "$INSTDIR\styles"
File /NONFATAL "${QTDIR}\plugins\styles\qwindowsvistastyle.dll" File "${QTDIR}\plugins\styles\qwindowsvistastyle.dll"
; MinGW binaries ; MinGW binaries
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"

View file

@ -0,0 +1,622 @@
; Script generated with the Venis Install Wizard & modified by defnax
; Reworked by Thunder
!include ifexist.nsh
# Needed defines
;!define REVISION ""
;!define RELEASEDIR ""
;!define QTDIR ""
;!define MINGWDIR ""
# Optional defines
;!define OUTDIR ""
# Check needed defines
!ifndef RELEASEDIR
!error "RELEASEDIR is not defined"
!endif
!ifndef QTDIR
!error "QTDIR is not defined"
!endif
!ifndef MINGWDIR
!error "MINGWDIR is not defined"
!endif
!ifndef ARCHITECTURE
!error "Architecture is not defined"
!endif
# Check optional defines
!ifdef OUTDIR
!define OUTDIR_ "${OUTDIR}\"
!else
!define OUTDIR ""
!define OUTDIR_ ""
!endif
!ifndef INSTALLERADD
!define INSTALLERADD ""
!endif
# Source directory
!define SOURCEDIR "..\..\.."
# Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
;!define REVISION ${VERSION_4}
# Get version of Qt
!GetDllVersion "${QTDIR}\bin\Qt6Core.dll" QTVERSION_
!define QTVERSION ${QTVERSION_1}.${QTVERSION_2}.${QTVERSION_3}
# Check version
!ifndef REVISION
!error "REVISION is not defined"
!endif
# Date
!ifndef DATE
!define /date DATE "%Y%m%d"
!endif
# Service
${!defineifexist} SERVICE_EXISTS "${RELEASEDIR}\retroshare-service\src\release\retroshare-service.exe"
# Tor
!ifdef TORDIR
${!defineifexist} TOR_EXISTS "${TORDIR}\tor.exe"
!ifndef TOR_EXISTS
!error "tor.exe not found"
!endif
!endif
# WebUI
!ifdef WEBUIDIR
${!defineifexist} WEBUI_EXISTS "${WEBUIDIR}\index.html"
!ifndef WEBUI_EXISTS
!error "WebUI files not found"
!endif
!endif
# Friend Server
!ifdef TOR_EXISTS
# Add Friend Server with Tor only
#${!defineifexist} FRIENDSERVER_EXISTS "${RELEASEDIR}\retroshare-friendserver\src\release\retroshare-friendserver.exe"
!endif
# Application name and version
!define APPNAME "RetroShare"
!define APPNAMEANDVERSION "${APPNAME} ${VERSION}"
!define PUBLISHER "RetroShare Team"
# Install path
!if ${ARCHITECTURE} == "x86"
!define INSTDIR_NORMAL "$ProgramFiles32\${APPNAME}"
!endif
!if ${ARCHITECTURE} == "x64"
!define INSTDIR_NORMAL "$ProgramFiles64\${APPNAME}"
!endif
!define INSTDIR_PORTABLE "$Desktop\${APPNAME}"
!define DATADIR_NORMAL "$APPDATA\${APPNAME}"
!define DATADIR_PORTABLE "$INSTDIR\Data"
# Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "${OUTDIR_}RetroShare-${VERSION}-${DATE}-${REVISION}-Qt-${QTVERSION}-${ARCHITECTURE}${INSTALLERADD}-setup.exe"
BrandingText "${APPNAMEANDVERSION}"
RequestExecutionlevel highest
# Use compression
SetCompressor /SOLID LZMA
# Global variables
Var PortableMode
Var InstDirNormal
Var InstDirPortable
Var DataDir
Var StyleSheetDir
# Modern interface settings
!include Sections.nsh
!include nsDialogs.nsh
!include "MUI.nsh"
# Interface Settings
!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${SOURCEDIR}\build_scripts\Windows\installer\HeaderImage.bmp"
;!define MUI_WELCOMEFINISHPAGE_BITMAP "...bmp"
# MUI defines
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_LINK "Visit the RetroShare forum for the latest news and support"
!define MUI_FINISHPAGE_LINK_LOCATION "http://retroshare.sourceforge.net/forum/"
!define MUI_FINISHPAGE_RUN "$INSTDIR\retroshare.exe"
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\changelog.txt
!define MUI_FINISHPAGE_SHOWREADME_TEXT changelog.txt
;!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
;!define MUI_LANGDLL_REGISTRY_ROOT HKLM
;!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
;!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
# Defines the un-/installer logo of RetroShare
!insertmacro MUI_DEFAULT MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!insertmacro MUI_DEFAULT MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "$(myLicenseData)"
Page Custom PortableModePageCreate PortableModePageLeave
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE dir_leave
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Set languages (first is default language)
!insertmacro MUI_RESERVEFILE_LANGDLL
# Installer languages
!define MUI_LANGDLL_ALLLANGUAGES
# Translations
!macro LANG_LOAD LANGUAGE LANGCODE LANGID LICENCEFILE
!insertmacro MUI_LANGUAGE "${LANGUAGE}"
; !verbose off
!define LANG "${LANGUAGE}"
!include "lang\${LANGCODE}.nsh"
LangString LANGUAGEID "${LANG_${LANG}}" "1031"
LicenseLangString myLicenseData ${LANGCODE} ${LICENCEFILE}
; !verbose on
!undef LANG
!macroend
!macro LANG_STRING NAME VALUE
LangString "${NAME}" "${LANG_${LANG}}" "${VALUE}"
!macroend
!insertmacro LANG_LOAD "English" "en" "1033" "${SOURCEDIR}\retroshare-gui\src\license\license.txt"
!insertmacro LANG_LOAD "French" "fr" "1036" "${SOURCEDIR}\retroshare-gui\src\license\license-FR.txt"
!insertmacro LANG_LOAD "German" "de" "1031" "${SOURCEDIR}\retroshare-gui\src\license\license-GER.txt"
!insertmacro LANG_LOAD "Turkish" "tr" "1055" "${SOURCEDIR}\retroshare-gui\src\license\license-TR.txt"
!insertmacro LANG_LOAD "SimpChinese" "zh_CN" "2052" "${SOURCEDIR}\retroshare-gui\src\license\license.txt"
!insertmacro LANG_LOAD "Polish" "pl" "1045" "${SOURCEDIR}\retroshare-gui\src\license\license.txt"
!insertmacro LANG_LOAD "Spanish" "es" "1034" "${SOURCEDIR}\retroshare-gui\src\license\license.txt"
!insertmacro LANG_LOAD "Russian" "ru" "1049" "${SOURCEDIR}\retroshare-gui\src\license\license.txt"
!insertmacro LANG_LOAD "Catalan" "ca_ES" "1027" "${SOURCEDIR}\retroshare-gui\src\license\license.txt"
LicenseData $(myLicenseData)
# Main binaries
Section $(Section_Main) Section_Main
;Set Section required
SectionIn RO
; Set Section properties
SetOverwrite on
; Clears previous error logs
; Delete "$INSTDIR\*.log"
; Main binaries
SetOutPath "$INSTDIR"
File "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe"
File /nonfatal "${RELEASEDIR}\libretroshare\src\lib\retroshare.dll"
; Qt binaries
File "${QTDIR}\bin\Qt6Core.dll"
File "${QTDIR}\bin\Qt6Core5Compat.dll"
File "${QTDIR}\bin\Qt6Gui.dll"
File "${QTDIR}\bin\Qt6Multimedia.dll"
File "${QTDIR}\bin\Qt6Network.dll"
File "${QTDIR}\bin\Qt6PrintSupport.dll"
File "${QTDIR}\bin\Qt6Svg.dll"
File "${QTDIR}\bin\Qt6Widgets.dll"
File "${QTDIR}\bin\Qt6Xml.dll"
; Qt platforms
SetOutPath "$INSTDIR\platforms"
File "${QTDIR}\plugins\platforms\qwindows.dll"
; Qt styles
SetOutPath "$INSTDIR\styles"
File "${QTDIR}\plugins\styles\qmodernwindowsstyle.dll"
; MinGW binaries
SetOutPath "$INSTDIR"
File "${MINGWDIR}\bin\libstdc++-6.dll"
!if ${ARCHITECTURE} == "x86"
File "${MINGWDIR}\bin\libgcc_s_dw2-1.dll"
!endif
!if ${ARCHITECTURE} == "x64"
File "${MINGWDIR}\bin\libgcc_s_seh-1.dll"
!endif
File "${MINGWDIR}\bin\libwinpthread-1.dll"
; External binaries
File "${EXTERNAL_LIB_DIR}\bin\miniupnpc.dll"
File "${RELEASEDIR}\supportlibs\librnp\Build\src\lib\librnp.dll"
!if ${ARCHITECTURE} == "x86"
File "${EXTERNAL_LIB_DIR}\bin\libcrypto-1_1.dll"
File "${EXTERNAL_LIB_DIR}\bin\libssl-1_1.dll"
!endif
!if ${ARCHITECTURE} == "x64"
File "${EXTERNAL_LIB_DIR}\bin\libcrypto-1_1-x64.dll"
File "${EXTERNAL_LIB_DIR}\bin\libssl-1_1-x64.dll"
!endif
; Other files
File "${RELEASEDIR}\changelog.txt"
File "${SOURCEDIR}\libbitdht\src\bitdht\bdboot.txt"
; License
SetOutPath "$INSTDIR\license"
File "${SOURCEDIR}\retroshare-gui\src\license\*.*"
; Image formats
SetOutPath "$INSTDIR\imageformats"
File /r "${QTDIR}\plugins\imageformats\qgif.dll"
File /r "${QTDIR}\plugins\imageformats\qicns.dll"
File /r "${QTDIR}\plugins\imageformats\qico.dll"
File /r "${QTDIR}\plugins\imageformats\qjpeg.dll"
File /r "${QTDIR}\plugins\imageformats\qsvg.dll"
File /r "${QTDIR}\plugins\imageformats\qtga.dll"
File /r "${QTDIR}\plugins\imageformats\qtiff.dll"
File /r "${QTDIR}\plugins\imageformats\qwbmp.dll"
File /r "${QTDIR}\plugins\imageformats\qwebp.dll"
; Sounds
SetOutPath "$INSTDIR\sounds"
File /r "${SOURCEDIR}\retroshare-gui\src\sounds\*.*"
; Translations
SetOutPath "$INSTDIR\translations"
File /r "${SOURCEDIR}\retroshare-gui\src\translations\*.qm"
File /r "${QTDIR}\translations\qt_*.qm"
File /r "${QTDIR}\translations\qtbase_*.qm"
File /r "${QTDIR}\translations\qtmultimedia_*.qm"
; WebUI
; SetOutPath "$INSTDIR\webui"
; File /r "${SOURCEDIR}\libresapi\src\webui\*.*"
; License
SetOutPath "$INSTDIR\license"
File /r "${SOURCEDIR}\retroshare-gui\src\license\*.*"
SectionEnd
# Service
!ifdef SERVICE_EXISTS
Section /o $(Section_Service) Section_Service
SetOutPath "$INSTDIR"
File "${RELEASEDIR}\retroshare-service\src\release\retroshare-service.exe"
SectionEnd
!endif
# Friend Server
!ifdef FRIENDSERVER_EXISTS
Section /o $(Section_FriendServer) Section_FriendServer
SetOutPath "$INSTDIR"
File "${RELEASEDIR}\retroshare-friendserver\src\release\retroshare-friendserver.exe"
SectionEnd
!endif
# Tor
!ifdef TOR_EXISTS
Section /o $(Section_Tor) Section_Tor
SetOutPath "$INSTDIR\tor"
File "${TORDIR}\*"
SectionEnd
!endif
# WebUI
!ifdef WEBUI_EXISTS
Section /o $(Section_WebUI) Section_WebUI
SetOutPath "$INSTDIR\webui"
File /r "${WEBUIDIR}\*"
SectionEnd
!endif
# Plugins
${!defineifexist} PLUGIN_FEEDREADER_EXISTS "${RELEASEDIR}\plugins\FeedReader\lib\FeedReader.dll"
${!defineifexist} PLUGIN_VOIP_EXISTS "${RELEASEDIR}\plugins\VOIP\lib\VOIP.dll"
!ifdef PLUGIN_FEEDREADER_EXISTS
!define /ifndef PLUGIN_EXISTS
!endif
!ifdef PLUGIN_VOIP_EXISTS
!define /ifndef PLUGIN_EXISTS
!endif
!ifdef PLUGIN_EXISTS
SectionGroup $(Section_Plugins) Section_Plugins
!ifdef PLUGIN_FEEDREADER_EXISTS
Section $(Section_Plugin_FeedReader) Section_Plugin_FeedReader
SetOutPath "$DataDir\extensions6"
File "${RELEASEDIR}\plugins\FeedReader\lib\FeedReader.dll"
SectionEnd
!endif
!ifdef PLUGIN_VOIP_EXISTS
Section $(Section_Plugin_VOIP) Section_Plugin_VOIP
SetOutPath "$DataDir\extensions6"
File "${RELEASEDIR}\plugins\VOIP\lib\VOIP.dll"
SetOutPath "$INSTDIR\sounds"
File /r "${SOURCEDIR}\plugins\VOIP\gui\sounds\*.*"
SectionEnd
!endif
SectionGroupEnd
!endif
# Data (Styles)
Section $(Section_Data) Section_Data
; Set Section properties
SetOverwrite on
; Chat style
SetOutPath "$StyleSheetDir\stylesheets\Bubble"
File /r "${SOURCEDIR}\retroshare-gui\src\gui\qss\chat\Bubble\*.*"
SetOutPath "$StyleSheetDir\stylesheets\Bubble_Compact"
File /r "${SOURCEDIR}\retroshare-gui\src\gui\qss\chat\Bubble_Compact\*.*"
; Stylesheets
SetOutPath "$INSTDIR\qss"
File /nonfatal /r "${SOURCEDIR}\retroshare-gui\src\qss\*.*"
SectionEnd
;Section $(Section_Link) Section_Link
; Delete any existing keys
; Write the file association
; WriteRegStr HKCR .pqi "" retroshare
; WriteRegStr HKCR retroshare "" "PQI File"
; WriteRegBin HKCR retroshare EditFlags 00000100
; WriteRegStr HKCR "retroshare\shell" "" open
; WriteRegStr HKCR "retroshare\shell\open\command" "" `"$INSTDIR\retroshare.exe" "%1"`
;SectionEnd
# Shortcuts
SectionGroup $(Section_Shortcuts) Section_Shortcuts
Section $(Section_StartMenu) Section_StartMenu
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\$(Link_Uninstall).lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
!ifdef SERVICE_EXISTS
SectionGetFlags ${Section_Service} $0
IntOp $0 $0 & ${SF_SELECTED}
${If} $0 == ${SF_SELECTED}
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME} Service.lnk" "$INSTDIR\retroshare-service.exe" "" "$INSTDIR\retroshare-service.exe" 0
${EndIf}
!endif
!ifdef FRIENDSERVER_EXISTS
SectionGetFlags ${Section_FriendServer} $0
IntOp $0 $0 & ${SF_SELECTED}
${If} $0 == ${SF_SELECTED}
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME} Friend Server.lnk" "$INSTDIR\retroshare-friendserver.exe" "" "$INSTDIR\retroshare-friendserver.exe" 0
${EndIf}
!endif
SectionEnd
Section $(Section_Desktop) Section_Desktop
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
Section $(Section_QuickLaunch) Section_QuickLaunch
CreateShortCut "$QUICKLAUNCH\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
SectionGroupEnd
Section $(Section_AutoStart) Section_AutoStart
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "RetroShare" "$INSTDIR\retroshare.exe -m"
SectionEnd
;Section $(Section_AutoStart) Section_AutoStart
; CreateShortCut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe -m" 0
;SectionEnd
Section -FinishSection
${If} $PortableMode = 0
WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\${APPNAME}" "Version" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\retroshare.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${PUBLISHER}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
${Else}
; Create the file the application uses to detect portable mode
FileOpen $0 "$INSTDIR\portable" w
FileClose $0
${EndIf}
SectionEnd
# Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Main} $(Section_Main_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Data} $(Section_Data_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Shortcuts} $(Section_Shortcuts_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_StartMenu} $(Section_StartMenu_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Desktop} $(Section_Desktop_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_QuickLaunch} $(Section_QuickLaunch_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Plugins} $(Section_Plugins_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Plugin_FeedReader} $(Section_Plugin_FeedReader_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Plugin_VOIP} $(Section_Plugin_VOIP_Desc)
; !insertmacro MUI_DESCRIPTION_TEXT ${Section_Link} $(Section_Link_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_AutoStart} $(Section_AutoStart_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Tor} $(Section_Tor_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_WebUI} $(Section_WebUI_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_Service} $(Section_Service_Desc)
!insertmacro MUI_DESCRIPTION_TEXT ${Section_FriendServer} $(Section_FriendServer_Desc)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
# Uninstall
Section "Uninstall"
; Remove file association registry keys
; DeleteRegKey HKCR .pqi
DeleteRegKey HKCR RetroShare
; Remove program/uninstall regsitry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM SOFTWARE\${APPNAME}
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "RetroShare"
; Remove shortcuts, if any
Delete "$SMPROGRAMS\${APPNAME}\*.*"
; Remove desktop shortcut
Delete "$DESKTOP\${APPNAME}.lnk"
; Remove Quicklaunch shortcut
Delete "$QUICKLAUNCH\${APPNAME}.lnk"
; Remove Autstart
Delete "$SMSTARTUP\${APPNAME}.lnk"
; Remove directories used
RMDir "$SMPROGRAMS\${APPNAME}"
RMDir /r "$INSTDIR"
; Don't remove the directory, otherwise
; we lose the XPGP keys.
; Should make this an option though...
RMDir /r "${DATADIR_NORMAL}\extensions6"
RMDir /r "${DATADIR_NORMAL}\stylesheets"
SectionEnd
Function .onInit
StrCpy $InstDirNormal "${INSTDIR_NORMAL}"
StrCpy $InstDirPortable "${INSTDIR_PORTABLE}"
StrCpy $PortableMode 0
StrCpy $INSTDIR "$InstDirNormal"
StrCpy $DataDir "${DATADIR_NORMAL}"
InitPluginsDir
Push $R1
File /oname=$PLUGINSDIR\spltmp.bmp "${SOURCEDIR}\retroshare-gui\src\gui\images\logo\logo_splash.png"
advsplash::show 1200 1000 1000 -1 $PLUGINSDIR\spltmp
Pop $R1
Pop $R1
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
!ifdef FRIENDSERVER_EXISTS
Function .onSelChange
SectionGetFlags ${Section_FriendServer} $0
IntOp $0 $0 & ${SF_SELECTED}
${If} $0 == ${SF_SELECTED}
# Activate Tor and set readonly
SectionGetFlags ${Section_Tor} $1
IntOp $1 $1 | ${SF_SELECTED}
IntOp $1 $1 | ${SF_RO}
SectionSetFlags ${Section_Tor} $1
${Else}
# Remove readonly from Tor
SectionGetFlags ${Section_Tor} $1
IntOp $2 ${SF_RO} ~
IntOp $1 $1 & $2
SectionSetFlags ${Section_Tor} $1
${EndIf}
FunctionEnd
!endif
# Installation mode
Function RequireAdmin
UserInfo::GetAccountType
Pop $8
${If} $8 != "admin"
MessageBox MB_ICONSTOP "You need administrator rights to install ${APPNAME}"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Abort
${EndIf}
FunctionEnd
Function SetModeDestinationFromInstdir
${If} $PortableMode = 0
StrCpy $InstDirNormal $INSTDIR
${Else}
StrCpy $InstDirPortable $INSTDIR
${EndIf}
FunctionEnd
Function PortableModePageCreate
Call SetModeDestinationFromInstdir ; If the user clicks BACK on the directory page we will remember their mode specific directory
!insertmacro MUI_HEADER_TEXT $(Page_InstallMode) $(Page_InstallMode_Desc)
nsDialogs::Create 1018
Pop $0
${NSD_CreateRadioButton} 5u 25u -10u 8u $(Page_InstallMode_Standard)
Pop $1
${NSD_CreateLabel} 18u 40u -10u 24u $(Page_InstallMode_Standard_Desc)
Pop $0
${NSD_CreateRadioButton} 5u 75u -10u 8u $(Page_InstallMode_Portable)
Pop $2
${NSD_CreateLabel} 18u 90u -10u 24u $(Page_InstallMode_Portable_Desc)
Pop $0
${If} $PortableMode = 0
SendMessage $1 ${BM_SETCHECK} ${BST_CHECKED} 0
${Else}
SendMessage $2 ${BM_SETCHECK} ${BST_CHECKED} 0
${EndIf}
nsDialogs::Show
FunctionEnd
Function PortableModePageLeave
${NSD_GetState} $1 $0
${If} $0 <> ${BST_UNCHECKED}
StrCpy $PortableMode 0
StrCpy $INSTDIR $InstDirNormal
Call RequireAdmin
; Enable sections
SectionSetText ${Section_Shortcuts} $(Section_Shortcuts)
SectionSetText ${Section_StartMenu} $(Section_StartMenu)
SectionSetText ${Section_Desktop} $(Section_Desktop)
SectionSetText ${Section_QuickLaunch} $(Section_QuickLaunch)
SectionSetText ${Section_AutoStart} $(Section_AutoStart)
!insertmacro SelectSection ${Section_Shortcuts}
!insertmacro SelectSection ${Section_AutoStart}
!insertmacro SelectSection ${Section_StartMenu}
!insertmacro SelectSection ${Section_Desktop}
!insertmacro SelectSection ${Section_QuickLaunch}
${Else}
StrCpy $PortableMode 1
StrCpy $INSTDIR $InstDirPortable
; Disable sections
!insertmacro UnselectSection ${Section_Shortcuts}
!insertmacro UnselectSection ${Section_AutoStart}
!insertmacro UnselectSection ${Section_StartMenu}
!insertmacro UnselectSection ${Section_Desktop}
!insertmacro UnselectSection ${Section_QuickLaunch}
SectionSetText ${Section_Shortcuts} ""
SectionSetText ${Section_StartMenu} ""
SectionSetText ${Section_Desktop} ""
SectionSetText ${Section_QuickLaunch} ""
SectionSetText ${Section_AutoStart} ""
${EndIf}
FunctionEnd
Function dir_leave
${If} $PortableMode = 0
StrCpy $DataDir "${DATADIR_NORMAL}"
StrCpy $StyleSheetDir $DataDir
${Else}
StrCpy $DataDir "${DATADIR_PORTABLE}"
StrCpy $StyleSheetDir $INSTDIR
${EndIf}
FunctionEnd

View file

@ -4,7 +4,7 @@ Version=1.0
Name=RetroShare Name=RetroShare
Comment=Securely communicate with your friends Comment=Securely communicate with your friends
Exec=/usr/bin/retroshare %U Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm Icon=retroshare.xpm
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P

@ -1 +1 @@
Subproject commit ac83e00ea7a26cd6cf57cefef745d6dcfd07e5da Subproject commit 96e249a06d8f30c2aace38beecc8fb7271159a88

@ -1 +1 @@
Subproject commit 178aa8ebcef47e3271d5a5ca5c07e45d3b71c81d Subproject commit 634f701d44585e4648b898be99d26e288db1881e

View file

@ -28,6 +28,8 @@ greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets QT += widgets
} }
greaterThan(QT_MAJOR_VERSION,5): QT += core5compat
target.files = lib/libFeedReader.so target.files = lib/libFeedReader.so
SOURCES = FeedReaderPlugin.cpp \ SOURCES = FeedReaderPlugin.cpp \
@ -128,7 +130,7 @@ win32 {
isEmpty(QMAKE_SH) { isEmpty(QMAKE_SH) {
# MinGW # MinGW
LIBS += -lcrypt32 LIBS += -lcrypt32 -lbcrypt
} }
# Check for msys2 # Check for msys2

View file

@ -28,6 +28,7 @@
#include "FeedReaderStringDefs.h" #include "FeedReaderStringDefs.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "util/DateTime.h"
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
@ -339,8 +340,7 @@ bool AddFeedDialog::fillFeed(uint32_t feedId)
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval); ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60); ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
QDateTime dateTime; QDateTime dateTime = DateTime::DateTimeFromTime_t(feedInfo.lastUpdate);
dateTime.setTime_t(feedInfo.lastUpdate);
ui->lastUpdate->setText(dateTime.toString()); ui->lastUpdate->setText(dateTime.toString());
ui->useStandardStorageTimeCheckBox->setChecked(feedInfo.flag.standardStorageTime); ui->useStandardStorageTimeCheckBox->setChecked(feedInfo.flag.standardStorageTime);

View file

@ -36,7 +36,7 @@ class FeedReaderConfig : public ConfigPage
public: public:
/** Default Constructor */ /** Default Constructor */
FeedReaderConfig(QWidget *parent = 0, Qt::WindowFlags flags = 0); FeedReaderConfig(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
/** Default Destructor */ /** Default Destructor */
virtual ~FeedReaderConfig(); virtual ~FeedReaderConfig();

View file

@ -34,7 +34,7 @@
#include "FeedReaderStringDefs.h" #include "FeedReaderStringDefs.h"
#include "gui/common/RSTreeWidgetItem.h" #include "gui/common/RSTreeWidgetItem.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h" #include "gui/RsGUIEventManager.h"
#include "FeedReaderUserNotify.h" #include "FeedReaderUserNotify.h"
#include "gui/Posted/PostedCreatePostDialog.h" #include "gui/Posted/PostedCreatePostDialog.h"
#include "util/imageutil.h" #include "util/imageutil.h"
@ -73,7 +73,7 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *n
connect(mNotify, &FeedReaderNotify::feedChanged, this, &FeedReaderDialog::feedChanged, Qt::QueuedConnection); connect(mNotify, &FeedReaderNotify::feedChanged, this, &FeedReaderDialog::feedChanged, Qt::QueuedConnection);
connect(mNotify, &FeedReaderNotify::optimizeImage, this, &FeedReaderDialog::optimizeImage, Qt::QueuedConnection); connect(mNotify, &FeedReaderNotify::optimizeImage, this, &FeedReaderDialog::optimizeImage, Qt::QueuedConnection);
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
/* connect signals */ /* connect signals */
connect(ui->feedTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(feedTreeItemActivated(QTreeWidgetItem*))); connect(ui->feedTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(feedTreeItemActivated(QTreeWidgetItem*)));
@ -570,7 +570,7 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
} }
FeedInfo feedInfo; FeedInfo feedInfo;
if (type != NOTIFY_TYPE_DEL) { if (type != FeedReaderNotify::NOTIFY_TYPE_DEL) {
if (!mFeedReader->getFeedInfo(feedId, feedInfo)) { if (!mFeedReader->getFeedInfo(feedId, feedInfo)) {
return; return;
} }
@ -580,12 +580,12 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
} }
} }
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) { if (type == FeedReaderNotify::NOTIFY_TYPE_MOD || type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
QTreeWidgetItemIterator it(ui->feedTreeWidget); QTreeWidgetItemIterator it(ui->feedTreeWidget);
QTreeWidgetItem *item; QTreeWidgetItem *item;
while ((item = *it) != NULL) { while ((item = *it) != NULL) {
if (item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toUInt() == feedId) { if (item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toUInt() == feedId) {
if (type == NOTIFY_TYPE_MOD) { if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
updateFeedItem(item, feedInfo); updateFeedItem(item, feedInfo);
} else { } else {
delete(item); delete(item);
@ -596,7 +596,7 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
} }
} }
if (type == NOTIFY_TYPE_ADD) { if (type == FeedReaderNotify::NOTIFY_TYPE_ADD) {
QTreeWidgetItemIterator it(ui->feedTreeWidget); QTreeWidgetItemIterator it(ui->feedTreeWidget);
QTreeWidgetItem *itemParent; QTreeWidgetItem *itemParent;
while ((itemParent = *it) != NULL) { while ((itemParent = *it) != NULL) {

View file

@ -40,15 +40,15 @@ class FeedReaderDialog : public MainPage
Q_OBJECT Q_OBJECT
public: public:
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0); FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
~FeedReaderDialog(); ~FeedReaderDialog();
static QIcon iconFromFeed(const FeedInfo &feedInfo); static QIcon iconFromFeed(const FeedInfo &feedInfo);
protected: protected:
virtual UserNotify *createUserNotify(QObject *parent) override; virtual UserNotify *createUserNotify(QObject *parent) override;
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event) override;
bool eventFilter(QObject *obj, QEvent *ev); bool eventFilter(QObject *obj, QEvent *ev) override;
private slots: private slots:
void settingsChanged(); void settingsChanged();

View file

@ -27,6 +27,7 @@
#include "FeedReaderFeedItem.h" #include "FeedReaderFeedItem.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "util/DateTime.h"
FeedReaderFeedNotify::FeedReaderFeedNotify(RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent) : FeedReaderFeedNotify::FeedReaderFeedNotify(RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent) :
FeedNotify(parent), mFeedReader(feedReader), mNotify(notify) FeedNotify(parent), mFeedReader(feedReader), mNotify(notify)
@ -71,7 +72,7 @@ void FeedReaderFeedNotify::msgChanged(uint32_t feedId, const QString &msgId, int
return; return;
} }
if (type != NOTIFY_TYPE_ADD) { if (type != FeedReaderNotify::NOTIFY_TYPE_ADD) {
return; return;
} }
@ -135,7 +136,7 @@ FeedItem *FeedReaderFeedNotify::testFeedItem(FeedHolder */*parent*/)
FeedMsgInfo msgInfo; FeedMsgInfo msgInfo;
msgInfo.title = tr("Test message").toUtf8().constData(); msgInfo.title = tr("Test message").toUtf8().constData();
msgInfo.description = tr("This is a test message.").toUtf8().constData(); msgInfo.description = tr("This is a test message.").toUtf8().constData();
msgInfo.pubDate = QDateTime::currentDateTime().toTime_t(); msgInfo.pubDate = DateTime::DateTimeToTime_t(QDateTime::currentDateTime());
//TODO: parent? //TODO: parent?
return new FeedReaderFeedItem(mFeedReader, mNotify, feedInfo, msgInfo); return new FeedReaderFeedItem(mFeedReader, mNotify, feedInfo, msgInfo);

View file

@ -36,11 +36,12 @@
#include "gui/common/RSTreeWidgetItem.h" #include "gui/common/RSTreeWidgetItem.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include "gui/Posted/PostedCreatePostDialog.h" #include "gui/Posted/PostedCreatePostDialog.h"
#include "gui/gxsforums/CreateGxsForumMsg.h" #include "gui/gxsforums/CreateGxsForumMsg.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "util/imageutil.h" #include "util/imageutil.h"
#include "util/DateTime.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "retroshare/rsgxsforums.h" #include "retroshare/rsgxsforums.h"
@ -476,8 +477,7 @@ void FeedReaderMessageWidget::calculateMsgIconsAndFonts(QTreeWidgetItem *item)
void FeedReaderMessageWidget::updateMsgItem(QTreeWidgetItem *item, FeedMsgInfo &info) void FeedReaderMessageWidget::updateMsgItem(QTreeWidgetItem *item, FeedMsgInfo &info)
{ {
QString title = QString::fromUtf8(info.title.c_str()); QString title = QString::fromUtf8(info.title.c_str());
QDateTime qdatetime; QDateTime qdatetime = DateTime::DateTimeFromTime_t(info.pubDate);
qdatetime.setTime_t(info.pubDate);
/* add string to all data */ /* add string to all data */
QString sort = QString("%1_%2_%3").arg(title, qdatetime.toString("yyyyMMdd_hhmmss")).arg(info.feedId); QString sort = QString("%1_%2_%3").arg(title, qdatetime.toString("yyyyMMdd_hhmmss")).arg(info.feedId);
@ -515,12 +515,12 @@ void FeedReaderMessageWidget::feedChanged(uint32_t feedId, int type)
return; return;
} }
if (type == NOTIFY_TYPE_DEL) { if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
setFeedId(0); setFeedId(0);
return; return;
} }
if (type == NOTIFY_TYPE_MOD) { if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
if (!mFeedReader->getFeedInfo(mFeedId, mFeedInfo)) { if (!mFeedReader->getFeedInfo(mFeedId, mFeedInfo)) {
setFeedId(0); setFeedId(0);
return; return;
@ -555,18 +555,18 @@ void FeedReaderMessageWidget::msgChanged(uint32_t feedId, const QString &msgId,
} }
FeedMsgInfo msgInfo; FeedMsgInfo msgInfo;
if (type != NOTIFY_TYPE_DEL) { if (type != FeedReaderNotify::NOTIFY_TYPE_DEL) {
if (!mFeedReader->getMsgInfo(feedId, msgId.toStdString(), msgInfo)) { if (!mFeedReader->getMsgInfo(feedId, msgId.toStdString(), msgInfo)) {
return; return;
} }
} }
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) { if (type == FeedReaderNotify::NOTIFY_TYPE_MOD || type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
QTreeWidgetItemIterator it(ui->msgTreeWidget); QTreeWidgetItemIterator it(ui->msgTreeWidget);
QTreeWidgetItem *item; QTreeWidgetItem *item;
while ((item = *it) != NULL) { while ((item = *it) != NULL) {
if (item->data(COLUMN_MSG_DATA, ROLE_MSG_ID).toString() == msgId) { if (item->data(COLUMN_MSG_DATA, ROLE_MSG_ID).toString() == msgId) {
if (type == NOTIFY_TYPE_MOD) { if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
updateMsgItem(item, msgInfo); updateMsgItem(item, msgInfo);
filterItem(item); filterItem(item);
} else { } else {
@ -578,13 +578,13 @@ void FeedReaderMessageWidget::msgChanged(uint32_t feedId, const QString &msgId,
} }
} }
if (type == NOTIFY_TYPE_MOD) { if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
if (msgId.toStdString() == currentMsgId()) { if (msgId.toStdString() == currentMsgId()) {
updateCurrentMessage(); updateCurrentMessage();
} }
} }
if (type == NOTIFY_TYPE_ADD) { if (type == FeedReaderNotify::NOTIFY_TYPE_ADD) {
QTreeWidgetItem *item = new RSTreeWidgetItem(mMsgCompareRole); QTreeWidgetItem *item = new RSTreeWidgetItem(mMsgCompareRole);
updateMsgItem(item, msgInfo); updateMsgItem(item, msgInfo);
ui->msgTreeWidget->addTopLevelItem(item); ui->msgTreeWidget->addTopLevelItem(item);

View file

@ -29,6 +29,13 @@ class FeedReaderNotify : public QObject, public RsFeedReaderNotify
Q_OBJECT Q_OBJECT
public: public:
// These replace the variables from the old notify system. It's simpler than switching the entire
// feedreader plugin to the new rsEvents system
static const int NOTIFY_TYPE_ADD = 0x01;
static const int NOTIFY_TYPE_DEL = 0x02;
static const int NOTIFY_TYPE_MOD = 0x03;
FeedReaderNotify(); FeedReaderNotify();
/* RsFeedReaderNotify */ /* RsFeedReaderNotify */

View file

@ -67,7 +67,7 @@ void FeedReaderUserNotify::iconClicked()
void FeedReaderUserNotify::feedChanged(uint32_t /*feedId*/, int type) void FeedReaderUserNotify::feedChanged(uint32_t /*feedId*/, int type)
{ {
if (type == NOTIFY_TYPE_DEL) { if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
updateIcon(); updateIcon();
} }
} }

View file

@ -294,13 +294,13 @@ void PreviewFeedDialog::feedChanged(uint32_t feedId, int type)
return; return;
} }
if (type == NOTIFY_TYPE_DEL) { if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
/* feed deleted */ /* feed deleted */
mFeedId = 0; mFeedId = 0;
return; return;
} }
if (type == NOTIFY_TYPE_ADD || type == NOTIFY_TYPE_MOD) { if (type == FeedReaderNotify::NOTIFY_TYPE_ADD || type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
FeedInfo feedInfo; FeedInfo feedInfo;
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) { if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
return; return;
@ -320,18 +320,18 @@ void PreviewFeedDialog::msgChanged(uint32_t feedId, const QString &msgId, int ty
} }
switch (type) { switch (type) {
case NOTIFY_TYPE_ADD: case FeedReaderNotify::NOTIFY_TYPE_ADD:
if (mMsgId.empty()) { if (mMsgId.empty()) {
mMsgId = msgId.toStdString(); mMsgId = msgId.toStdString();
updateMsg(); updateMsg();
} }
break; break;
case NOTIFY_TYPE_MOD: case FeedReaderNotify::NOTIFY_TYPE_MOD:
if (mMsgId == msgId.toStdString()) { if (mMsgId == msgId.toStdString()) {
updateMsg(); updateMsg();
} }
break; break;
case NOTIFY_TYPE_DEL: case FeedReaderNotify::NOTIFY_TYPE_DEL:
if (mMsgId == msgId.toStdString()) { if (mMsgId == msgId.toStdString()) {
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId); std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
if (it != mMsgIds.end()) { if (it != mMsgIds.end()) {

View file

@ -20,6 +20,7 @@
#include "rsFeedReaderItems.h" #include "rsFeedReaderItems.h"
#include "p3FeedReader.h" #include "p3FeedReader.h"
#include "gui/FeedReaderNotify.h"
#include "p3FeedReaderThread.h" #include "p3FeedReaderThread.h"
#include "rsitems/rsconfigitems.h" #include "rsitems/rsconfigitems.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
@ -415,7 +416,7 @@ RsFeedResult p3FeedReader::addFolder(uint32_t parentId, const std::string &name,
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
} }
return RS_FEED_RESULT_SUCCESS; return RS_FEED_RESULT_SUCCESS;
@ -455,7 +456,7 @@ RsFeedResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name)
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
return RS_FEED_RESULT_SUCCESS; return RS_FEED_RESULT_SUCCESS;
@ -502,7 +503,7 @@ RsFeedResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId)
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
} }
return RS_FEED_RESULT_SUCCESS; return RS_FEED_RESULT_SUCCESS;
@ -587,7 +588,7 @@ RsFeedResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
if (!forumId.empty()) { if (!forumId.empty()) {
@ -658,7 +659,7 @@ RsFeedResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
@ -756,7 +757,7 @@ bool p3FeedReader::removeFeed(uint32_t feedId)
/* only notify remove of feed */ /* only notify remove of feed */
std::list<uint32_t>::iterator it; std::list<uint32_t>::iterator it;
for (it = removedFeedIds.begin(); it != removedFeedIds.end(); ++it) { for (it = removedFeedIds.begin(); it != removedFeedIds.end(); ++it) {
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_DEL); mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_DEL);
} }
} }
@ -803,7 +804,7 @@ bool p3FeedReader::addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId)
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
} }
{ {
@ -925,8 +926,8 @@ bool p3FeedReader::removeMsg(uint32_t feedId, const std::string &msgId)
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_DEL); mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_DEL);
} }
return true; return true;
@ -977,11 +978,11 @@ bool p3FeedReader::removeMsgs(uint32_t feedId, const std::list<std::string> &msg
} }
if (mNotify && !removedMsgs.empty()) { if (mNotify && !removedMsgs.empty()) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
for (it = removedMsgs.begin(); it != removedMsgs.end(); ++it) { for (it = removedMsgs.begin(); it != removedMsgs.end(); ++it) {
mNotify->notifyMsgChanged(feedId, *it, NOTIFY_TYPE_DEL); mNotify->notifyMsgChanged(feedId, *it, FeedReaderNotify::NOTIFY_TYPE_DEL);
} }
} }
@ -1224,7 +1225,7 @@ bool p3FeedReader::processFeed(uint32_t feedId)
if (mNotify) { if (mNotify) {
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) { for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
@ -1273,8 +1274,8 @@ bool p3FeedReader::setMessageRead(uint32_t feedId, const std::string &msgId, boo
if (changed) { if (changed) {
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_OFTEN); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_OFTEN);
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_MOD); mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
@ -1328,10 +1329,10 @@ bool p3FeedReader::retransformMsg(uint32_t feedId, const std::string &msgId)
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW); IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
if (mNotify) { if (mNotify) {
if (feedChanged) { if (feedChanged) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
if (msgChanged) { if (msgChanged) {
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_MOD); mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
} }
@ -1466,7 +1467,7 @@ int p3FeedReader::tick()
if (mNotify) { if (mNotify) {
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) { for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
if (imageToOptimze) { if (imageToOptimze) {
mNotify->notifyOptimizeImage(); mNotify->notifyOptimizeImage();
@ -1526,7 +1527,7 @@ void p3FeedReader::cleanFeeds()
if (mNotify) { if (mNotify) {
std::list<std::pair<uint32_t, std::string> >::iterator it; std::list<std::pair<uint32_t, std::string> >::iterator it;
for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) { for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) {
mNotify->notifyMsgChanged(it->first, it->second, NOTIFY_TYPE_DEL); mNotify->notifyMsgChanged(it->first, it->second, FeedReaderNotify::NOTIFY_TYPE_DEL);
} }
} }
} }
@ -1801,7 +1802,7 @@ bool p3FeedReader::getFeedToDownload(RsFeedReaderFeed &feed, uint32_t neededFeed
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
return true; return true;
@ -1852,7 +1853,7 @@ void p3FeedReader::onDownloadSuccess(uint32_t feedId, const std::string &content
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
@ -1889,7 +1890,7 @@ void p3FeedReader::onDownloadError(uint32_t feedId, RsFeedReaderErrorState resul
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
@ -1944,7 +1945,7 @@ bool p3FeedReader::getFeedToProcess(RsFeedReaderFeed &feed, uint32_t neededFeedI
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
return true; return true;
@ -2323,11 +2324,11 @@ void p3FeedReader::onProcessSuccess_addMsgs(uint32_t feedId, std::list<RsFeedRea
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
for (it = addedMsgs.begin(); it != addedMsgs.end(); ++it) { for (it = addedMsgs.begin(); it != addedMsgs.end(); ++it) {
mNotify->notifyMsgChanged(feedId, *it, NOTIFY_TYPE_ADD); mNotify->notifyMsgChanged(feedId, *it, FeedReaderNotify::NOTIFY_TYPE_ADD);
} }
} }
} }
@ -2365,7 +2366,7 @@ void p3FeedReader::onProcessError(uint32_t feedId, RsFeedReaderErrorState result
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }
@ -2433,7 +2434,7 @@ void p3FeedReader::setFeedInfo(uint32_t feedId, const std::string &name, const s
} }
if (mNotify) { if (mNotify) {
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD); mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
} }
} }

View file

@ -32,9 +32,9 @@ class RsFeedReaderMsg;
class p3FeedReaderThread; class p3FeedReaderThread;
class RsGxsForums; class RsGxsForums;
struct RsGxsForumGroup; class RsGxsForumGroup;
class RsPosted; class RsPosted;
struct RsPostedGroup; class RsPostedGroup;
class RsGxsIfaceHelper; class RsGxsIfaceHelper;
class p3FeedReader : public RsPQIService, public RsFeedReader class p3FeedReader : public RsPQIService, public RsFeedReader

View file

@ -37,6 +37,7 @@ QVideoInputDevice::QVideoInputDevice(QWidget *parent)
_capture_device = NULL ; _capture_device = NULL ;
_video_processor = NULL ; _video_processor = NULL ;
_echo_output_device = NULL ; _echo_output_device = NULL ;
_image_capture = NULL;
} }
QVideoInputDevice::~QVideoInputDevice() QVideoInputDevice::~QVideoInputDevice()

View file

@ -27,7 +27,7 @@
/*Retroshare-Gui*/ /*Retroshare-Gui*/
#include "gui/chat/ChatDialog.h" #include "gui/chat/ChatDialog.h"
#include "gui/notifyqt.h" #include "gui/RsGUIEventManager.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, const voipToasterItem_Type type) VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, const voipToasterItem_Type type)

View file

@ -18,6 +18,10 @@
TEMPLATE = subdirs TEMPLATE = subdirs
win32-g++:isEmpty(QMAKE_SH):lessThan(QT_MAJOR_VERSION,6) {
# Qt 5 Windows native build
SUBDIRS += \ SUBDIRS += \
VOIP \ VOIP \
}
SUBDIRS += \
FeedReader FeedReader

View file

@ -77,14 +77,24 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
find_package( Qt5 COMPONENTS Core REQUIRED) find_package( Qt6 COMPONENTS Core REQUIRED)
find_package( Qt5 COMPONENTS Widgets REQUIRED) find_package( Qt6 COMPONENTS Widgets REQUIRED)
find_package( Qt5 COMPONENTS Xml REQUIRED) find_package( Qt6 COMPONENTS Xml REQUIRED)
find_package( Qt5 COMPONENTS Network REQUIRED) find_package( Qt6 COMPONENTS Network REQUIRED)
find_package( Qt5 COMPONENTS Multimedia REQUIRED) find_package( Qt6 COMPONENTS Multimedia REQUIRED)
find_package( Qt5 COMPONENTS PrintSupport REQUIRED) find_package( Qt6 COMPONENTS PrintSupport REQUIRED)
list( APPEND RS_LINK_LIBRARIES Qt5::Multimedia Qt5::Widgets Qt5::Xml Qt5::Network Qt5::PrintSupport) list( APPEND RS_LINK_LIBRARIES Qt6::Multimedia Qt6::Widgets Qt6::Xml Qt6::Network Qt6::PrintSupport)
if (NOT Qt6_FOUND)
find_package( Qt5 COMPONENTS Core REQUIRED)
find_package( Qt5 COMPONENTS Widgets REQUIRED)
find_package( Qt5 COMPONENTS Xml REQUIRED)
find_package( Qt5 COMPONENTS Network REQUIRED)
find_package( Qt5 COMPONENTS Multimedia REQUIRED)
find_package( Qt5 COMPONENTS PrintSupport REQUIRED)
list( APPEND RS_LINK_LIBRARIES Qt5::Multimedia Qt5::Widgets Qt5::Xml Qt5::Network Qt5::PrintSupport)
endif()
################################################################################ ################################################################################
@ -104,7 +114,10 @@ endif(RS_DEVELOPMENT_BUILD)
include(src/CMakeLists.txt) include(src/CMakeLists.txt)
qt5_wrap_ui(RS_UI_HEADERS ${RS_GUI_FORMS}) qt_wrap_ui(RS_UI_HEADERS ${RS_GUI_FORMS})
if (NOT Qt6_FOUND)
qt5_wrap_ui(RS_UI_HEADERS ${RS_GUI_FORMS})
endif()
add_executable(${PROJECT_NAME} ${RS_GUI_SOURCES} ${RS_UI_HEADERS} ${RS_GUI_QTRESOURCES}) add_executable(${PROJECT_NAME} ${RS_GUI_SOURCES} ${RS_UI_HEADERS} ${RS_GUI_QTRESOURCES})
install(TARGETS ${PROJECT_NAME} DESTINATION ${RS_BIN_INSTALL_DIR}) install(TARGETS ${PROJECT_NAME} DESTINATION ${RS_BIN_INSTALL_DIR})

View file

@ -512,7 +512,7 @@ list(
src/util/misc.h src/util/misc.h
src/util/HandleRichText.h src/util/HandleRichText.h
src/util/ObjectPainter.h src/util/ObjectPainter.h
src/util/QtVersion.h src/util/RsQtVersion.h
src/util/RsFile.h src/util/RsFile.h
src/util/qtthreadsutils.h src/util/qtthreadsutils.h
src/util/ClickableLabel.h src/util/ClickableLabel.h

View file

@ -33,6 +33,7 @@
#include <retroshare/rsdisc.h> #include <retroshare/rsdisc.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "util/RsQtVersion.h"
#include <QClipboard> #include <QClipboard>
#include <QSysInfo> #include <QSysInfo>
@ -42,6 +43,9 @@
#include <QMessageBox> #include <QMessageBox>
#include <QStyle> #include <QStyle>
#include <assert.h> #include <assert.h>
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
#include <QRandomGenerator>
#endif
AboutWidget::AboutWidget(QWidget* parent) AboutWidget::AboutWidget(QWidget* parent)
: QWidget(parent) : QWidget(parent)
@ -49,7 +53,7 @@ AboutWidget::AboutWidget(QWidget* parent)
setupUi(this); setupUi(this);
QHBoxLayout* l = new QHBoxLayout(); QHBoxLayout* l = new QHBoxLayout();
l->setMargin(0); l->setContentsMargins(0, 0, 0, 0);
l->addStretch(1); l->addStretch(1);
l->addStretch(1); l->addStretch(1);
specialFrame->setContentsMargins(0, 0, 0, 0); specialFrame->setContentsMargins(0, 0, 0, 0);
@ -211,7 +215,7 @@ void AWidget::initImages()
if(height() == 0) return ; if(height() == 0) return ;
image1 = QImage(width(),height(),QImage::Format_ARGB32); image1 = QImage(width(),height(),QImage::Format_ARGB32);
image1.fill(palette().color(QPalette::Background)); image1.fill(palette().color(QPalette::Window));
//QImage image(":/images/logo/logo_info.png"); //QImage image(":/images/logo/logo_info.png");
QPixmap image(":/images/logo/logo_splash.png"); QPixmap image(":/images/logo/logo_splash.png");
@ -267,7 +271,7 @@ void AWidget::initGoL()
void AWidget::drawBitField() void AWidget::drawBitField()
{ {
image2.fill(palette().color(QPalette::Background)); image2.fill(palette().color(QPalette::Window));
QPainter p(&image2) ; QPainter p(&image2) ;
p.setPen(QColor(200,200,200)); p.setPen(QColor(200,200,200));
@ -306,7 +310,7 @@ void AWidget::drawBitField()
AWidget::AWidget() AWidget::AWidget()
: page(0), density(5) : page(0), density(5)
, mImagesReady(false), mState(0), mTimerId(0) , mImagesReady(false), mState(0), mTimerId(0)
, mStep(1.0f), mMaxStep(QFontMetricsF(font()).width(' ')) , mStep(1.0f), mMaxStep(QFontMetrics_horizontalAdvance(QFontMetricsF(font()), ' '))
{ {
setMouseTracking(true); setMouseTracking(true);
//startTimer(15); //startTimer(15);
@ -774,7 +778,7 @@ void TBoard::showNextPiece() {
QPixmap pixmap(dx * squareWidth(), dy * squareHeight()); QPixmap pixmap(dx * squareWidth(), dy * squareHeight());
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.fillRect(pixmap.rect(), nextPieceLabel->palette().background()); painter.fillRect(pixmap.rect(), nextPieceLabel->palette().window());
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
int x = nextPiece.x(i) - nextPiece.minX(); int x = nextPiece.x(i) - nextPiece.minX();
@ -809,18 +813,23 @@ void TBoard::drawSquare(QPainter &painter, int x, int y, TPiece::Shape shape) {
QColor color = colorTable[int(shape)]; QColor color = colorTable[int(shape)];
painter.fillRect(x + 1, y + 1, squareWidth() - 2, squareHeight() - 2, color); painter.fillRect(x + 1, y + 1, squareWidth() - 2, squareHeight() - 2, color);
painter.setPen(color.light()); painter.setPen(color.lighter());
painter.drawLine(x, y + squareHeight() - 1, x, y); painter.drawLine(x, y + squareHeight() - 1, x, y);
painter.drawLine(x, y, x + squareWidth() - 1, y); painter.drawLine(x, y, x + squareWidth() - 1, y);
painter.setPen(color.dark()); painter.setPen(color.darker());
painter.drawLine(x + 1, y + squareHeight() - 1, x + squareWidth() - 1, y + squareHeight() - 1); painter.drawLine(x + 1, y + squareHeight() - 1, x + squareWidth() - 1, y + squareHeight() - 1);
painter.drawLine(x + squareWidth() - 1, y + squareHeight() - 1, x + squareWidth() - 1, y + 1); painter.drawLine(x + squareWidth() - 1, y + squareHeight() - 1, x + squareWidth() - 1, y + 1);
} }
void TPiece::setRandomShape() { void TPiece::setRandomShape() {
setShape(TPiece::Shape(qrand() % 7 + 1)); #if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
int rand = QRandomGenerator::global()->generate();
#else
int rand = qrand();
#endif
setShape(TPiece::Shape(rand % 7 + 1));
} }
@ -905,7 +914,7 @@ TPiece TPiece::rotatedRight() const {
NextPieceLabel::NextPieceLabel( QWidget* parent /* = 0*/ ) : QLabel(parent) NextPieceLabel::NextPieceLabel( QWidget* parent /* = 0*/ ) : QLabel(parent)
{ {
QPalette p = palette(); QPalette p = palette();
p.setColor(QPalette::Background, Qt::white); p.setColor(QPalette::Window, Qt::white);
setPalette(p); setPalette(p);
setFrameShape(QFrame::Box); setFrameShape(QFrame::Box);
setAlignment(Qt::AlignCenter); setAlignment(Qt::AlignCenter);

View file

@ -21,7 +21,6 @@
#include "ChatLobbyWidget.h" #include "ChatLobbyWidget.h"
#include "notifyqt.h"
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "chat/ChatLobbyDialog.h" #include "chat/ChatLobbyDialog.h"
#include "chat/ChatLobbyUserNotify.h" #include "chat/ChatLobbyUserNotify.h"
@ -35,11 +34,11 @@
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/QtVersion.h" #include "util/qtthreadsutils.h"
#include "util/RsQtVersion.h"
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "retroshare/rsnotify.h"
#include "retroshare/rsidentity.h" #include "retroshare/rsidentity.h"
#include <QGridLayout> #include <QGridLayout>
@ -105,9 +104,39 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
myInviteYesButton = NULL; myInviteYesButton = NULL;
myInviteIdChooser = NULL; myInviteIdChooser = NULL;
QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged())); mEventHandlerId = 0;
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,RsGxsId,QString)), this, SLOT(displayChatLobbyEvent(qulonglong,int,RsGxsId,QString)));
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites())); rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{
RsQThreadUtils::postToObject([=](){
auto ev = dynamic_cast<const RsChatLobbyEvent *>(event.get());
if(!ev) return;
switch(ev->mEventCode)
{
case RsChatLobbyEventCode::CHAT_LOBBY_INVITE_RECEIVED:
readChatLobbyInvites();
break;
case RsChatLobbyEventCode::CHAT_LOBBY_LIST_CHANGED:
lobbyChanged();
break;
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_LEFT:
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_STATUS:
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_JOINED:
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_KEEP_ALIVE:
handleChatLobbyEvent(ev->mLobbyId,ev->mEventCode,ev->mGxsId,QString::fromUtf8(ev->mStr.c_str()));
break;
default:
break;
}
}, this );
}, mEventHandlerId, RsEventType::CHAT_SERVICE );
QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint))); QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint)));
QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int))); QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
@ -236,6 +265,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
ChatLobbyWidget::~ChatLobbyWidget() ChatLobbyWidget::~ChatLobbyWidget()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
// save settings // save settings
processSettings(false); processSettings(false);
@ -650,7 +680,7 @@ void ChatLobbyWidget::updateDisplay()
if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end()) if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
{ {
ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RS_CHAT_OPEN); ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RsChatFlags::RS_CHAT_OPEN);
addChatPage(dynamic_cast<ChatLobbyDialog*>(cd)); addChatPage(dynamic_cast<ChatLobbyDialog*>(cd));
} }
@ -753,7 +783,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
showBlankPage(id) ; showBlankPage(id) ;
else else
{ {
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS); _lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
if (_lobby_infos[id].dialog->isWindowed()) if (_lobby_infos[id].dialog->isWindowed())
showBlankPage(id, true); showBlankPage(id, true);
} }
@ -816,7 +846,7 @@ bool ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
if(_lobby_infos.find(id) == _lobby_infos.end()) { if(_lobby_infos.find(id) == _lobby_infos.end()) {
showBlankPage(id) ; showBlankPage(id) ;
} else { } else {
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS); _lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
if (_lobby_infos[id].dialog->isWindowed()) if (_lobby_infos[id].dialog->isWindowed())
showBlankPage(id, true); showBlankPage(id, true);
@ -1158,10 +1188,10 @@ void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
subscribeChatLobbyAtItem(item); subscribeChatLobbyAtItem(item);
} }
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId &gxs_id, const QString& str) void ChatLobbyWidget::handleChatLobbyEvent(uint64_t lobby_id, RsChatLobbyEventCode event_type, const RsGxsId &gxs_id, const QString& str)
{ {
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(ChatId(lobby_id)))) { if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(ChatId(lobby_id)))) {
cld->displayLobbyEvent(event_type, gxs_id, str); cld->handleLobbyEvent(event_type, gxs_id, str);
} }
} }

View file

@ -89,8 +89,8 @@ protected slots:
void unsubscribeItem(); void unsubscribeItem();
void itemDoubleClicked(QTreeWidgetItem *item, int column); void itemDoubleClicked(QTreeWidgetItem *item, int column);
void updateCurrentLobby() ; void updateCurrentLobby() ;
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId& gxs_id, const QString& str); void handleChatLobbyEvent(uint64_t lobby_id, RsChatLobbyEventCode event_type, const RsGxsId &gxs_id, const QString& str);
void readChatLobbyInvites(); void readChatLobbyInvites();
void showLobby(QTreeWidgetItem *lobby_item) ; void showLobby(QTreeWidgetItem *lobby_item) ;
void showBlankPage(ChatLobbyId id, bool subscribed = false) ; void showBlankPage(ChatLobbyId id, bool subscribed = false) ;
void unsubscribeChatLobby(ChatLobbyId id) ; void unsubscribeChatLobby(ChatLobbyId id) ;
@ -151,5 +151,7 @@ private:
/* UI - from Designer */ /* UI - from Designer */
Ui::ChatLobbyWidget ui; Ui::ChatLobbyWidget ui;
RsEventsHandlerId_t mEventHandlerId;
}; };

View file

@ -38,6 +38,7 @@
#include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdDetails.h"
#include "gui/Identity/IdDialog.h" #include "gui/Identity/IdDialog.h"
#include "gui/Identity/IdEditDialog.h" #include "gui/Identity/IdEditDialog.h"
#include "util/RsQtVersion.h"
//#define DEBUG_CREATE_CIRCLE_DIALOG 1 //#define DEBUG_CREATE_CIRCLE_DIALOG 1
@ -74,7 +75,7 @@ CreateCircleDialog::CreateCircleDialog()
ui.IdFilter->addFilter(QIcon(), headerText, RSCIRCLEID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText)); ui.IdFilter->addFilter(QIcon(), headerText, RSCIRCLEID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText));
/* Set initial column width */ /* Set initial column width */
int fontWidth = QFontMetricsF(ui.treeWidget_IdList->font()).width("W"); int fontWidth = QFontMetrics_horizontalAdvance(QFontMetricsF(ui.treeWidget_IdList->font()), "W");
ui.treeWidget_IdList->setColumnWidth(RSCIRCLEID_COL_NICKNAME, 17 * fontWidth); ui.treeWidget_IdList->setColumnWidth(RSCIRCLEID_COL_NICKNAME, 17 * fontWidth);
ui.treeWidget_membership->setColumnWidth(RSCIRCLEID_COL_NICKNAME, 17 * fontWidth); ui.treeWidget_membership->setColumnWidth(RSCIRCLEID_COL_NICKNAME, 17 * fontWidth);

View file

@ -24,6 +24,7 @@
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "BannedFilesDialog.h" #include "BannedFilesDialog.h"
#include "util/DateTime.h"
#define COLUMN_FILE_NAME 0 #define COLUMN_FILE_NAME 0
#define COLUMN_FILE_HASH 1 #define COLUMN_FILE_HASH 1
@ -80,7 +81,7 @@ void BannedFilesDialog::fillFilesList()
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_NAME, new QTableWidgetItem(QIcon(),QString::fromUtf8(it->second.mFilename.c_str()),0)); ui.bannedFiles_TW->setItem(row, COLUMN_FILE_NAME, new QTableWidgetItem(QIcon(),QString::fromUtf8(it->second.mFilename.c_str()),0));
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_HASH, new QTableWidgetItem(QIcon(),QString::fromStdString(it->first.toStdString()),0)); ui.bannedFiles_TW->setItem(row, COLUMN_FILE_HASH, new QTableWidgetItem(QIcon(),QString::fromStdString(it->first.toStdString()),0));
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_SIZE, new QTableWidgetItem(QIcon(),QString::number(it->second.mSize),0)); ui.bannedFiles_TW->setItem(row, COLUMN_FILE_SIZE, new QTableWidgetItem(QIcon(),QString::number(it->second.mSize),0));
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_TIME, new QTableWidgetItem(QIcon(),QDateTime::fromTime_t(it->second.mBanTimeStamp).toString(),0)); ui.bannedFiles_TW->setItem(row, COLUMN_FILE_TIME, new QTableWidgetItem(QIcon(),DateTime::DateTimeFromTime_t(it->second.mBanTimeStamp).toString(),0));
ui.bannedFiles_TW->item(row, COLUMN_FILE_HASH)->setData(Qt::UserRole, QString::fromStdString(it->first.toStdString())); ui.bannedFiles_TW->item(row, COLUMN_FILE_HASH)->setData(Qt::UserRole, QString::fromStdString(it->first.toStdString()));

View file

@ -21,7 +21,7 @@
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
#include <QModelIndex> #include <QModelIndex>
#include <QPainter> #include <QPainter>
#include <QStyleOptionProgressBarV2> #include <QStyleOptionProgressBar>
#include <QProgressBar> #include <QProgressBar>
#include <QApplication> #include <QApplication>
#include <QDateTime> #include <QDateTime>
@ -29,6 +29,8 @@
#include <math.h> #include <math.h>
#include "DLListDelegate.h" #include "DLListDelegate.h"
#include "util/DateTime.h"
#include "util/RsQtVersion.h"
Q_DECLARE_METATYPE(FileProgressInfo) Q_DECLARE_METATYPE(FileProgressInfo)
@ -42,7 +44,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
{ {
QString byteUnits[4] = {tr("B"), tr("KB"), tr("MB"), tr("GB")}; QString byteUnits[4] = {tr("B"), tr("KB"), tr("MB"), tr("GB")};
QStyleOptionViewItem opt = option; QStyleOptionViewItem opt = option;
QStyleOptionProgressBarV2 newopt; QStyleOptionProgressBar newopt;
QRect pixmapRect; QRect pixmapRect;
QPixmap pixmap; QPixmap pixmap;
qlonglong fileSize; qlonglong fileSize;
@ -59,7 +61,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
painter->setClipRect(opt.rect); painter->setClipRect(opt.rect);
//set text color //set text color
QVariant value = index.data(Qt::TextColorRole); QVariant value = index.data(Qt::ForegroundRole);
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) { if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value)); opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
} }
@ -94,7 +96,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
for(int i = 0; i < 4; ++i) { for(int i = 0; i < 4; ++i) {
if (fileSize < 1024) { if (fileSize < 1024) {
fileSize = index.data().toLongLong(); fileSize = index.data().toLongLong();
temp.sprintf("%.2f ", fileSize / multi); temp = QString::asprintf("%.2f ", fileSize / multi);
temp += byteUnits[i]; temp += byteUnits[i];
break; break;
} }
@ -113,7 +115,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
for(int i = 0; i < 4; ++i) { for(int i = 0; i < 4; ++i) {
if (remaining < 1024) { if (remaining < 1024) {
remaining = index.data().toLongLong(); remaining = index.data().toLongLong();
temp.sprintf("%.2f ", remaining / multi); temp = QString::asprintf("%.2f ", remaining / multi);
temp += byteUnits[i]; temp += byteUnits[i];
break; break;
} }
@ -132,7 +134,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
for(int i = 0; i < 4; ++i) { for(int i = 0; i < 4; ++i) {
if (completed < 1024) { if (completed < 1024) {
completed = index.data().toLongLong(); completed = index.data().toLongLong();
temp.sprintf("%.2f ", completed / multi); temp = QString::asprintf("%.2f ", completed / multi);
temp += byteUnits[i]; temp += byteUnits[i];
break; break;
} }
@ -148,7 +150,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = ""; temp = "";
} else { } else {
temp.clear(); temp.clear();
temp.sprintf("%.2f", dlspeed/1024.); temp = QString::asprintf("%.2f", dlspeed/1024.);
temp += " KB/s"; temp += " KB/s";
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
@ -261,7 +263,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
break; break;
qi64Value = index.data().value<qint64>(); qi64Value = index.data().value<qint64>();
if (qi64Value < std::numeric_limits<qint64>::max()){ if (qi64Value < std::numeric_limits<qint64>::max()){
QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value); QDateTime qdtLastDL = DateTime::DateTimeFromTime_t(qi64Value);
painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss")); painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss"));
} else { } else {
painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen")); painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen"));
@ -277,7 +279,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
{ {
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString()); float w = QFontMetrics_horizontalAdvance(QFontMetricsF(option.font), index.data(Qt::DisplayRole).toString());
int S = QFontMetricsF(option.font).height()*1.5 ; int S = QFontMetricsF(option.font).height()*1.5 ;
return QSize(w,S); return QSize(w,S);

View file

@ -29,6 +29,7 @@
#include "FileTransferInfoWidget.h" #include "FileTransferInfoWidget.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/settings/rsharesettings.h"
// Variables to decide of display behaviour. All variables are expressed as a factor of font height // Variables to decide of display behaviour. All variables are expressed as a factor of font height
// //
@ -84,7 +85,7 @@ void FileTransferInfoWidget::updateDisplay()
setFixedHeight(maxHeight); setFixedHeight(maxHeight);
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.initFrom(this); painter.begin(this);
float S = QFontMetricsF(font()).height(); float S = QFontMetricsF(font()).height();
int chunk_square_size = S*chunk_square_size_factor; int chunk_square_size = S*chunk_square_size_factor;
@ -132,7 +133,13 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
int ch_num_size = ch_num_size_factor*S ; int ch_num_size = ch_num_size_factor*S ;
int tab_size = tab_size_factor*S ; int tab_size = tab_size_factor*S ;
painter->setPen(QColor::fromRgb(0,0,0)) ; if (Settings->getSheetName() == ":Standard_Dark"){
penColor = Qt::gray ;
} else {
penColor = Qt::black ;
}
painter->setPen(penColor) ;
y += text_height ; y += text_height ;
painter->drawText(0,y,tr("Chunk map") + ":") ; painter->drawText(0,y,tr("Chunk map") + ":") ;
y += block_sep ; y += block_sep ;
@ -176,13 +183,13 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
uint32_t sizeY = 1*S ; uint32_t sizeY = 1*S ;
y += block_sep ; y += block_sep ;
y += text_height ; y += text_height ;
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
painter->drawText(0,y,tr("Active chunks") + ":") ; painter->drawText(0,y,tr("Active chunks") + ":") ;
y += block_sep ; y += block_sep ;
for(uint i=0;i<info.active_chunks.size();++i) for(uint i=0;i<info.active_chunks.size();++i)
{ {
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
painter->drawText(0.5*S,y+text_height*0.9,QString::number(info.active_chunks[i].first)) ; painter->drawText(0.5*S,y+text_height*0.9,QString::number(info.active_chunks[i].first)) ;
int size_of_this_chunk = ( info.active_chunks[i].first == info.chunks.size()-1 && ((info.file_size % blockSize)>0) )?(info.file_size % blockSize):blockSize ; int size_of_this_chunk = ( info.active_chunks[i].first == info.chunks.size()-1 && ((info.file_size % blockSize)>0) )?(info.file_size % blockSize):blockSize ;
@ -212,7 +219,7 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
} }
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
float percent = (size_of_this_chunk - info.active_chunks[i].second)*100.0/size_of_this_chunk ; float percent = (size_of_this_chunk - info.active_chunks[i].second)*100.0/size_of_this_chunk ;
painter->drawText(sizeX+5.5*S,y+text_height*0.9,QString::number(percent,'f',2) + " %") ; painter->drawText(sizeX+5.5*S,y+text_height*0.9,QString::number(percent,'f',2) + " %") ;
@ -227,7 +234,7 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
y += block_sep ; y += block_sep ;
y += text_height ; y += text_height ;
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
painter->drawText(0,y,(info.compressed_peer_availability_maps.size() == 1 ? tr("Availability map (%1 active source)") : tr("Availability map (%1 active sources)")).arg(info.compressed_peer_availability_maps.size())) ; painter->drawText(0,y,(info.compressed_peer_availability_maps.size() == 1 ? tr("Availability map (%1 active source)") : tr("Availability map (%1 active sources)")).arg(info.compressed_peer_availability_maps.size())) ;
y += block_sep ; y += block_sep ;
@ -254,7 +261,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
// various info: // various info:
// //
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
y += text_height ; painter->drawText(0,y,tr("File info") + ":") ; y += text_height ; painter->drawText(0,y,tr("File info") + ":") ;
y += block_sep ; y += block_sep ;
y += text_height ; painter->drawText(2*S,y,tr("File name") + ":") ; painter->drawText(tab_size,y,QString::fromUtf8(nfo.fname.c_str())) ; y += text_height ; painter->drawText(2*S,y,tr("File name") + ":") ; painter->drawText(tab_size,y,QString::fromUtf8(nfo.fname.c_str())) ;

View file

@ -24,6 +24,7 @@
#include <QWidget> #include <QWidget>
#include <QPainter> #include <QPainter>
#include <QBitmap> #include <QBitmap>
#include <QColor>
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
@ -36,7 +37,7 @@ class FileTransferInfoWidget : public RsAutoUpdatePage
Q_OBJECT Q_OBJECT
public: public:
FileTransferInfoWidget(QWidget * parent = 0, Qt::WindowFlags f = 0 ); FileTransferInfoWidget(QWidget * parent = 0, Qt::WindowFlags f = Qt::WindowFlags() );
void setFileHash(const RsFileHash& hash) { _file_hash = hash ; } void setFileHash(const RsFileHash& hash) { _file_hash = hash ; }
@ -58,6 +59,7 @@ private:
QPixmap downloadingPixmap; QPixmap downloadingPixmap;
QPixmap notDownloadPixmap; QPixmap notDownloadPixmap;
QPixmap checkingPixmap; QPixmap checkingPixmap;
QColor penColor;
RsFileHash _file_hash ; RsFileHash _file_hash ;
}; };

View file

@ -36,7 +36,7 @@
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/advsearch/advancedsearchdialog.h" #include "gui/advsearch/advancedsearchdialog.h"
#include "gui/common/RSTreeWidgetItem.h" #include "gui/common/RSTreeWidgetItem.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "util/misc.h" #include "util/misc.h"
@ -898,7 +898,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
if (keywords.length() < 3) if (keywords.length() < 3)
return ; return ;
QStringList qWords = keywords.split(" ", QString::SkipEmptyParts); QStringList qWords = keywords.split(" ", QtSkipEmptyParts);
std::list<std::string> words; std::list<std::string> words;
QStringListIterator qWordsIter(qWords); QStringListIterator qWordsIter(qWords);
while (qWordsIter.hasNext()) while (qWordsIter.hasNext())
@ -1236,7 +1236,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
int friendSource = 0; int friendSource = 0;
int anonymousSource = 0; int anonymousSource = 0;
QString resultCount = it->text(SR_SOURCES_COL); QString resultCount = it->text(SR_SOURCES_COL);
QStringList modifiedResultCount = resultCount.split("/", QString::SkipEmptyParts); QStringList modifiedResultCount = resultCount.split("/", QtSkipEmptyParts);
if(searchType == FRIEND_SEARCH) if(searchType == FRIEND_SEARCH)
{ {
friendSource = modifiedResultCount.at(0).toInt() + 1; friendSource = modifiedResultCount.at(0).toInt() + 1;

View file

@ -22,7 +22,6 @@
#include "rshare.h" #include "rshare.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/notifyqt.h"
#include "gui/RemoteDirModel.h" #include "gui/RemoteDirModel.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/ShareManager.h" #include "gui/ShareManager.h"
@ -33,8 +32,9 @@
#include "gui/gxsforums/GxsForumsDialog.h" #include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/settings/AddFileAssociationDialog.h" #include "gui/settings/AddFileAssociationDialog.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include "util/RsAction.h" #include "util/RsAction.h"
#include "util/qtthreadsutils.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/rstime.h" #include "util/rstime.h"
#include "util/rsdir.h" #include "util/rsdir.h"
@ -145,7 +145,7 @@ public:
{ {
Q_ASSERT(index.isValid()); Q_ASSERT(index.isValid());
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
// disable default icon // disable default icon
opt.icon = QIcon(); opt.icon = QIcon();
@ -166,6 +166,7 @@ public:
SharedFilesDialog::~SharedFilesDialog() SharedFilesDialog::~SharedFilesDialog()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete tree_model; delete tree_model;
delete flat_model; delete flat_model;
delete tree_proxyModel; delete tree_proxyModel;
@ -177,9 +178,36 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
NotifyQt *notify = NotifyQt::getInstance(); //connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool)));
connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool))); //connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
mEventHandlerId = 0;
rsEvents->registerEventsHandler([this](std::shared_ptr<const RsEvent> event)
{
RsQThreadUtils::postToObject([=](){
auto e = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
switch(e->mEventCode)
{
case RsSharedDirectoriesEventCode::OWN_DIR_LIST_PROCESSING:
preModDirectories(true);
break;
case RsSharedDirectoriesEventCode::OWN_DIR_LIST_UPDATED:
postModDirectories(true);
break;
case RsSharedDirectoriesEventCode::FRIEND_DIR_LIST_UPDATED:
preModDirectories(false);
postModDirectories(false);
break;
default:
break;
};}, this);
}, mEventHandlerId,RsEventType::SHARED_DIRECTORIES);
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int))); connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) ); connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
@ -199,7 +227,7 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
tree_proxyModel->setSortRole(RetroshareDirModel::SortRole); tree_proxyModel->setSortRole(RetroshareDirModel::SortRole);
tree_proxyModel->sort(SHARED_FILES_DIALOG_COLUMN_NAME); tree_proxyModel->sort(SHARED_FILES_DIALOG_COLUMN_NAME);
tree_proxyModel->setFilterRole(RetroshareDirModel::FilterRole); tree_proxyModel->setFilterRole(RetroshareDirModel::FilterRole);
tree_proxyModel->setFilterRegExp(QRegExp(QString(SHARED_FILES_DIALOG_FILTER_STRING))) ; QSortFilterProxyModel_setFilterRegularExpression(tree_proxyModel, QString(SHARED_FILES_DIALOG_FILTER_STRING)) ;
flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this); flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this);
flat_proxyModel->setSourceModel(flat_model); flat_proxyModel->setSourceModel(flat_model);
@ -207,7 +235,7 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole); flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
flat_proxyModel->sort(SHARED_FILES_DIALOG_COLUMN_NAME); flat_proxyModel->sort(SHARED_FILES_DIALOG_COLUMN_NAME);
flat_proxyModel->setFilterRole(RetroshareDirModel::FilterRole); flat_proxyModel->setFilterRole(RetroshareDirModel::FilterRole);
flat_proxyModel->setFilterRegExp(QRegExp(QString(SHARED_FILES_DIALOG_FILTER_STRING))) ; QSortFilterProxyModel_setFilterRegularExpression(flat_proxyModel, QString(SHARED_FILES_DIALOG_FILTER_STRING)) ;
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter())); connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter())); connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter()));
@ -739,7 +767,6 @@ void SharedFilesDialog::collCreate()
model->getDirDetailsFromSelect(lst, dirVec); model->getDirDetailsFromSelect(lst, dirVec);
auto RemoteMode = isRemote(); auto RemoteMode = isRemote();
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
QString dir_name; QString dir_name;
@ -1018,7 +1045,7 @@ void SharedFilesDialog::recursExpandAll(const QModelIndex& index)
for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row) for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row)
{ {
QModelIndex idx(index.child(row,0)) ; QModelIndex idx(ui.dirTreeView->model()->index(row,0,index)) ;
if(ui.dirTreeView->model()->rowCount(idx) > 0) if(ui.dirTreeView->model()->rowCount(idx) > 0)
recursExpandAll(idx) ; recursExpandAll(idx) ;
@ -1131,7 +1158,10 @@ void SharedFilesDialog::postModDirectories(bool local)
#ifdef DEBUG_SHARED_FILES_DIALOG #ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "****** updated directories! Re-enabling sorting ******" << std::endl; std::cerr << "****** updated directories! Re-enabling sorting ******" << std::endl;
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
QCoreApplication::flush(); QCoreApplication::flush();
#endif
} }
class ChannelCompare class ChannelCompare
@ -1619,7 +1649,7 @@ void SharedFilesDialog::FilterItems()
return ; return ;
//FileSearchFlags flags = isRemote()?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL; //FileSearchFlags flags = isRemote()?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
QStringList lst = text.split(" ",QString::SkipEmptyParts) ; QStringList lst = text.split(" ",QtSkipEmptyParts) ;
std::list<std::string> keywords ; std::list<std::string> keywords ;
for(auto it(lst.begin());it!=lst.end();++it) for(auto it(lst.begin());it!=lst.end();++it)

View file

@ -21,6 +21,7 @@
#ifndef _SHAREDFILESDIALOG_H #ifndef _SHAREDFILESDIALOG_H
#define _SHAREDFILESDIALOG_H #define _SHAREDFILESDIALOG_H
#include <retroshare/rsevents.h>
#include "ui_SharedFilesDialog.h" #include "ui_SharedFilesDialog.h"
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
@ -145,6 +146,8 @@ protected:
QString lastFilterString; QString lastFilterString;
QString mLastFilterText ; QString mLastFilterText ;
RsProtectedTimer* mFilterTimer; RsProtectedTimer* mFilterTimer;
RsEventsHandlerId_t mEventHandlerId ;
}; };
class LocalSharedFilesDialog : public SharedFilesDialog class LocalSharedFilesDialog : public SharedFilesDialog

View file

@ -20,7 +20,6 @@
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "TransferUserNotify.h" #include "TransferUserNotify.h"
#include "gui/notifyqt.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
TransferUserNotify::TransferUserNotify(QObject *parent) : TransferUserNotify::TransferUserNotify(QObject *parent) :

View file

@ -20,7 +20,6 @@
#include "TransfersDialog.h" #include "TransfersDialog.h"
#include "gui/notifyqt.h"
#include "gui/SoundManager.h" #include "gui/SoundManager.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
@ -37,9 +36,10 @@
#include "gui/FileTransfer/xprogressbar.h" #include "gui/FileTransfer/xprogressbar.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include "util/RsFile.h" #include "util/RsFile.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "util/DateTime.h"
#include "retroshare/rsdisc.h" #include "retroshare/rsdisc.h"
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
@ -286,7 +286,7 @@ public:
{ {
case Qt::SizeHintRole: return sizeHintRole(index.column()) ; case Qt::SizeHintRole: return sizeHintRole(index.column()) ;
case Qt::TextAlignmentRole: case Qt::TextAlignmentRole:
case Qt::TextColorRole: case Qt::ForegroundRole:
case Qt::WhatsThisRole: case Qt::WhatsThisRole:
case Qt::EditRole: case Qt::EditRole:
case Qt::ToolTipRole: case Qt::ToolTipRole:
@ -434,7 +434,7 @@ public:
//Get Last Access on File //Get Last Access on File
if (file.exists()) if (file.exists())
qi64LastDL = file.lastModified().toTime_t(); qi64LastDL = DateTime::DateTimeToTime_t(file.lastModified());
} }
return QVariant(qi64LastDL) ; return QVariant(qi64LastDL) ;
} }
@ -1009,7 +1009,6 @@ TransfersDialog::TransfersDialog(QWidget *parent)
connect(collViewAct,SIGNAL(triggered()),this,SLOT(collView())); connect(collViewAct,SIGNAL(triggered()),this,SLOT(collView()));
collOpenAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this ); collOpenAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this );
connect(collOpenAct, SIGNAL(triggered()), this, SLOT(collOpen())); connect(collOpenAct, SIGNAL(triggered()), this, SLOT(collOpen()));
connect(NotifyQt::getInstance(), SIGNAL(downloadComplete(QString)), this, SLOT(collAutoOpen(QString)));
/** Setup the actions for the download header context menu */ /** Setup the actions for the download header context menu */
showDLSizeAct= new QAction(tr("Size"),this); showDLSizeAct= new QAction(tr("Size"),this);
@ -1114,14 +1113,8 @@ void TransfersDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
switch (fe->mFileTransferEventCode) switch (fe->mFileTransferEventCode)
{ {
case RsFileTransferEventCode::DOWNLOAD_COMPLETE: case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
{ collAutoOpen(fe->mHash);
FileInfo nfo ;
if(!rsFiles->FileDetails(fe->mHash, RS_FILE_HINTS_DOWNLOAD, nfo))
break;
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
NotifyQt::getInstance()->addToaster(RS_POPUP_DOWNLOAD, fe->mHash.toStdString(), nfo.fname.c_str(),"");
}
[[fallthrough]]; [[fallthrough]];
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED: case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
@ -2577,11 +2570,10 @@ void TransfersDialog::collOpen()
QMessageBox::information(nullptr,tr("Error openning collection file"),RsCollection::errorString(code)); QMessageBox::information(nullptr,tr("Error openning collection file"),RsCollection::errorString(code));
} }
void TransfersDialog::collAutoOpen(const QString &fileHash) void TransfersDialog::collAutoOpen(const RsFileHash& hash)
{ {
if (Settings->valueFromGroup("Transfer","AutoDLColl").toBool()) if (Settings->valueFromGroup("Transfer","AutoDLColl").toBool())
{ {
RsFileHash hash = RsFileHash(fileHash.toStdString());
FileInfo info; FileInfo info;
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) { if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
@ -2646,5 +2638,5 @@ void TransfersDialog::filterChanged(const QString& /*text*/)
int filterColumn = ui.filterLineEdit->currentFilter(); int filterColumn = ui.filterLineEdit->currentFilter();
QString text = ui.filterLineEdit->text(); QString text = ui.filterLineEdit->text();
DLLFilterModel->setFilterKeyColumn(filterColumn); DLLFilterModel->setFilterKeyColumn(filterColumn);
DLLFilterModel->setFilterRegExp(text); QSortFilterProxyModel_setFilterRegularExpression(DLLFilterModel, text);
} }

View file

@ -145,7 +145,7 @@ private slots:
void collModif(); void collModif();
void collView(); void collView();
void collOpen(); void collOpen();
void collAutoOpen(const QString& fileHash); void collAutoOpen(const RsFileHash &hash);
void setShowDLSizeColumn(bool show); void setShowDLSizeColumn(bool show);
void setShowDLCompleteColumn(bool show); void setShowDLCompleteColumn(bool show);

View file

@ -22,6 +22,7 @@
#include "ULListDelegate.h" #include "ULListDelegate.h"
#include "xprogressbar.h" #include "xprogressbar.h"
#include "util/RsQtVersion.h"
Q_DECLARE_METATYPE(FileProgressInfo) Q_DECLARE_METATYPE(FileProgressInfo)
@ -39,7 +40,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
{ {
QString byteUnits[4] = {tr("B"), tr("KB"), tr("MB"), tr("GB")}; QString byteUnits[4] = {tr("B"), tr("KB"), tr("MB"), tr("GB")};
QStyleOptionViewItem opt = option; QStyleOptionViewItem opt = option;
QStyleOptionProgressBarV2 newopt; QStyleOptionProgressBar newopt;
QRect pixmapRect; QRect pixmapRect;
QPixmap pixmap; QPixmap pixmap;
qlonglong fileSize; qlonglong fileSize;
@ -52,7 +53,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
painter->setClipRect(opt.rect); painter->setClipRect(opt.rect);
//set text color //set text color
QVariant value = index.data(Qt::TextColorRole); QVariant value = index.data(Qt::ForegroundRole);
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) { if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value)); opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
} }
@ -93,7 +94,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
for(int i = 0; i < 4; ++i) { for(int i = 0; i < 4; ++i) {
if (fileSize < 1024) { if (fileSize < 1024) {
fileSize = index.data().toLongLong(); fileSize = index.data().toLongLong();
temp.sprintf("%.2f ", fileSize / multi); temp = QString::asprintf("%.2f ", fileSize / multi);
temp += byteUnits[i]; temp += byteUnits[i];
break; break;
} }
@ -112,7 +113,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
for(int i = 0; i < 4; ++i) { for(int i = 0; i < 4; ++i) {
if (transferred < 1024) { if (transferred < 1024) {
transferred = index.data().toLongLong(); transferred = index.data().toLongLong();
temp.sprintf("%.2f ", transferred / multi); temp = QString::asprintf("%.2f ", transferred / multi);
temp += byteUnits[i]; temp += byteUnits[i];
break; break;
} }
@ -128,7 +129,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = ""; temp = "";
} else { } else {
temp.clear(); temp.clear();
temp.sprintf("%.2f", ulspeed/1024.); temp = QString::asprintf("%.2f", ulspeed/1024.);
temp += " KB/s"; temp += " KB/s";
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
@ -179,7 +180,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
{ {
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString()); float w = QFontMetrics_horizontalAdvance(QFontMetricsF(option.font), index.data(Qt::DisplayRole).toString());
int S = QFontMetricsF(option.font).height()*1.5 ; int S = QFontMetricsF(option.font).height()*1.5 ;
return QSize(w,S); return QSize(w,S);

View file

@ -118,7 +118,7 @@ FriendServerControl::FriendServerControl(QWidget *parent)
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{ {
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this ); RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
}, mEventHandlerId_peer, RsEventType::PEER_CONNECTION ); }, mEventHandlerId_peer, RsEventType::FRIEND_LIST );
} }
void FriendServerControl::onAutoAddFriends(bool b) void FriendServerControl::onAutoAddFriends(bool b)
@ -145,14 +145,14 @@ void FriendServerControl::handleEvent_main_thread(std::shared_ptr<const RsEvent>
} }
{ {
const RsConnectionEvent *pe = dynamic_cast<const RsConnectionEvent*>(event.get()); const RsFriendListEvent *pe = dynamic_cast<const RsFriendListEvent*>(event.get());
if(pe) if(pe)
switch(pe->mConnectionInfoCode) switch(pe->mEventCode)
{ {
case RsConnectionEventCode::PEER_ADDED: case RsFriendListEventCode::NODE_ADDED:
case RsConnectionEventCode::PEER_REMOVED: case RsFriendListEventCode::NODE_REMOVED:
case RsConnectionEventCode::PEER_CONNECTED: updateContactsStatus(); case RsFriendListEventCode::NODE_CONNECTED: updateContactsStatus();
break; break;
default: ; default: ;
@ -169,7 +169,7 @@ FriendServerControl::~FriendServerControl()
rsEvents->unregisterEventsHandler(mEventHandlerId_peer); rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
} }
void FriendServerControl::launchStatusContextMenu(QPoint p) void FriendServerControl::launchStatusContextMenu(QPoint /* p */)
{ {
RsPeerId peer_id = getCurrentPeer(); RsPeerId peer_id = getCurrentPeer();

View file

@ -34,12 +34,12 @@
#include "groups/CreateGroup.h" #include "groups/CreateGroup.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "NewsFeed.h" #include "NewsFeed.h"
#include "notifyqt.h"
#include "profile/ProfileWidget.h" #include "profile/ProfileWidget.h"
#include "profile/StatusMessage.h" #include "profile/StatusMessage.h"
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/qtthreadsutils.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "FriendsDialog.h" #include "FriendsDialog.h"
#include "NetworkView.h" #include "NetworkView.h"
@ -77,12 +77,49 @@ FriendsDialog::FriendsDialog(QWidget *parent) : MainPage(parent)
ui.chatWidget->setWelcomeMessage(msg); ui.chatWidget->setWelcomeMessage(msg);
ui.chatWidget->init(ChatId::makeBroadcastId(), tr("Broadcast")); ui.chatWidget->init(ChatId::makeBroadcastId(), tr("Broadcast"));
connect(NotifyQt::getInstance(), SIGNAL(chatMessageReceived(ChatMessage)), this, SLOT(chatMessageReceived(ChatMessage))); mEventHandlerId_chat = 0;
connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)), this, SLOT(chatStatusReceived(ChatId,QString)));
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
{
RsQThreadUtils::postToObject([=]()
{
auto fe = dynamic_cast<const RsChatServiceEvent*>(e.get()); if(!fe) return;
switch(fe->mEventCode)
{
case RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED: chatMessageReceived(fe->mMsg); break;
case RsChatServiceEventCode::CHAT_STATUS_CHANGED: chatStatusReceived(fe->mCid,QString::fromUtf8(fe->mStr.c_str())); break;
default:
break;
}
}
, this );
}, mEventHandlerId_chat, RsEventType::CHAT_SERVICE );
#else // def RS_DIRECT_CHAT #else // def RS_DIRECT_CHAT
ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.groupChatTab)); ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.groupChatTab));
#endif // def RS_DIRECT_CHAT #endif // def RS_DIRECT_CHAT
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
{
RsQThreadUtils::postToObject([=]()
{
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get()); if(!fe) return;
switch(fe->mEventCode)
{
case RsFriendListEventCode::OWN_STATUS_CHANGED: loadmypersonalstatus();
break;
default: // OWN_AVATAR_CHANGED is handled in AvatarWidget
break;
}
}
, this );
}, mEventHandlerId_friends, RsEventType::FRIEND_LIST );
mEventHandlerId_friends = 0;
connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage())); connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage()));
connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar())); connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));
@ -153,6 +190,8 @@ FriendsDialog::~FriendsDialog ()
if (this == instance) { if (this == instance) {
instance = NULL; instance = NULL;
} }
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
rsEvents->unregisterEventsHandler(mEventHandlerId_chat);
} }
void FriendsDialog::activatePage(FriendsDialog::Page page) void FriendsDialog::activatePage(FriendsDialog::Page page)
@ -200,10 +239,20 @@ void FriendsDialog::processSettings(bool bLoad)
void FriendsDialog::chatMessageReceived(const ChatMessage &msg) void FriendsDialog::chatMessageReceived(const ChatMessage &msg)
{ {
if(msg.chat_id.isBroadcast()) if(!msg.chat_id.isBroadcast())
return;
QDateTime sendTime = QDateTime::fromTime_t(msg.sendTime);
QDateTime recvTime = QDateTime::fromTime_t(msg.recvTime);
QString message = QString::fromUtf8(msg.msg.c_str());
QString name = QString::fromUtf8(rsPeers->getPeerName(msg.broadcast_peer_id).c_str());
ui.chatWidget->addChatMsg(msg.incoming, name, sendTime, recvTime, message, ChatWidget::MSGTYPE_NORMAL);
if(ui.chatWidget->isActive())
{ {
QDateTime sendTime = QDateTime::fromTime_t(msg.sendTime); QDateTime sendTime = DateTime::DateTimeFromTime_t(msg.sendTime);
QDateTime recvTime = QDateTime::fromTime_t(msg.recvTime); QDateTime recvTime = DateTime::DateTimeFromTime_t(msg.recvTime);
QString message = QString::fromUtf8(msg.msg.c_str()); QString message = QString::fromUtf8(msg.msg.c_str());
QString name = QString::fromUtf8(rsPeers->getPeerName(msg.broadcast_peer_id).c_str()); QString name = QString::fromUtf8(rsPeers->getPeerName(msg.broadcast_peer_id).c_str());
@ -220,11 +269,11 @@ void FriendsDialog::chatMessageReceived(const ChatMessage &msg)
void FriendsDialog::chatStatusReceived(const ChatId &chat_id, const QString &status_string) void FriendsDialog::chatStatusReceived(const ChatId &chat_id, const QString &status_string)
{ {
if(chat_id.isBroadcast()) if(!chat_id.isBroadcast())
{ return;
QString name = QString::fromUtf8(rsPeers->getPeerName(chat_id.broadcast_status_peer_id).c_str());
ui.chatWidget->updateStatusString(name + " %1", status_string); QString name = QString::fromUtf8(rsPeers->getPeerName(chat_id.broadcast_status_peer_id).c_str());
} ui.chatWidget->updateStatusString(name + " %1", status_string);
} }
void FriendsDialog::addFriend() void FriendsDialog::addFriend()

View file

@ -70,9 +70,6 @@ public:
IdDialog *idDialog; IdDialog *idDialog;
private slots: private slots:
void chatMessageReceived(const ChatMessage& msg);
void chatStatusReceived(const ChatId& chat_id, const QString& status_string);
void addFriend(); void addFriend();
void statusmessage(); void statusmessage();
@ -89,10 +86,17 @@ signals:
void notifyGroupChat(const QString&,const QString&) ; void notifyGroupChat(const QString&,const QString&) ;
private: private:
void chatMessageReceived(const ChatMessage& msg);
void chatStatusReceived(const ChatId& chat_id, const QString& status_string);
void processSettings(bool bLoad); void processSettings(bool bLoad);
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::FriendsDialog ui; Ui::FriendsDialog ui;
RsEventsHandlerId_t mEventHandlerId_friends ;
#ifdef RS_DIRECT_CHAT
RsEventsHandlerId_t mEventHandlerId_chat ;
#endif
}; };
#endif #endif

View file

@ -39,7 +39,6 @@
#include "retroshare/rstor.h" #include "retroshare/rstor.h"
#include "retroshare/rsidentity.h" #include "retroshare/rsidentity.h"
#include "retroshare/rsinit.h" #include "retroshare/rsinit.h"
#include "retroshare/rsnotify.h"
#include "rsserver/rsaccounts.h" #include "rsserver/rsaccounts.h"
#include "util/rsrandom.h" #include "util/rsrandom.h"
@ -633,7 +632,9 @@ void GenCertDialog::genPerson()
std::cout << "Waiting ed->processEvents()" << std::endl; std::cout << "Waiting ed->processEvents()" << std::endl;
#endif #endif
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
if (ed->hasPendingEvents()) if (ed->hasPendingEvents())
#endif
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd)); while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));
std::string email_str = "" ; std::string email_str = "" ;
@ -661,7 +662,7 @@ void GenCertDialog::genPerson()
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl; std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
// now cache the PGP password so that it's not asked again for immediately signing the key // now cache the PGP password so that it's not asked again for immediately signing the key
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ; rsLoginHelper->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err); bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
@ -674,7 +675,7 @@ void GenCertDialog::genPerson()
// Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start. // Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start.
// (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this. // (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this.
QTimer::singleShot(30000, []() { rsNotify->clearPgpPassphrase(); } ); QTimer::singleShot(30000, []() { RsLoginHelper::clearPgpPassphrase(); } );
accept(); accept();
} }
@ -682,7 +683,7 @@ void GenCertDialog::genPerson()
else else
{ {
// Now clear the cached passphrase // Now clear the cached passphrase
rsNotify->clearPgpPassphrase(); RsLoginHelper::clearPgpPassphrase();
/* Message Dialog */ /* Message Dialog */
QMessageBox::warning(this, QMessageBox::warning(this,

View file

@ -332,95 +332,8 @@ void GetStartedDialog::emailSupport()
QString text = QString("Hello") + "\n"; QString text = QString("Hello") + "\n";
text += "\n"; text += "\n";
QString sysVersion; QString sysVersion = QSysInfo::prettyProductName();
#ifdef __APPLE__
#ifdef Q_OS_MAC
switch(QSysInfo::MacintoshVersion)
{
case QSysInfo::MV_9:
sysVersion = "Mac OS 9";
break;
case QSysInfo::MV_10_0:
sysVersion = "Mac OSX 10.0";
break;
case QSysInfo::MV_10_1:
sysVersion = "Mac OSX 10.1";
break;
case QSysInfo::MV_10_2:
sysVersion = "Mac OSX 10.2";
break;
case QSysInfo::MV_10_3:
sysVersion = "Mac OSX 10.3";
break;
case QSysInfo::MV_10_4:
sysVersion = "Mac OSX 10.4";
break;
case QSysInfo::MV_10_5:
sysVersion = "Mac OSX 10.5";
break;
case QSysInfo::MV_10_6:
sysVersion = "Mac OSX 10.6";
break;
// case QSysInfo::MV_10_7:
// sysVersion = "Mac OSX 10.7";
// break;
default:
sysVersion = "Mac Unknown";
break;
}
#else
sysVersion = "OSX Unknown";
#endif
#else
#if defined(_WIN32) || defined(__MINGW32__)
// Windows
#ifdef Q_OS_WIN
switch(QSysInfo::windowsVersion())
{
case QSysInfo::WV_32s:
sysVersion = "Windows 2.1";
break;
case QSysInfo::WV_95:
sysVersion = "Windows 95";
break;
case QSysInfo::WV_98:
sysVersion = "Windows 98";
break;
case QSysInfo::WV_Me:
sysVersion = "Windows Me";
break;
case QSysInfo::WV_NT:
sysVersion = "Windows NT";
break;
case QSysInfo::WV_2000:
sysVersion = "Windows 2000";
break;
case QSysInfo::WV_XP:
sysVersion = "Windows XP";
break;
case QSysInfo::WV_2003:
sysVersion = "Windows 2003";
break;
case QSysInfo::WV_VISTA:
sysVersion = "Windows Vista";
break;
case QSysInfo::WV_WINDOWS7:
sysVersion = "Windows 7";
break;
default:
sysVersion = "Windows";
break;
}
#else
sysVersion = "Windows Unknown";
#endif
#else
// Linux
sysVersion = "Linux";
#endif
#endif
text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(RsApplication::retroshareVersion(true) text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(RsApplication::retroshareVersion(true)
, sysVersion , sysVersion
).arg(static_cast<typename std::underlying_type<RsConfigUserLvl>::type>(userLevel)) + "\n"; ).arg(static_cast<typename std::underlying_type<RsConfigUserLvl>::type>(userLevel)) + "\n";

View file

@ -26,7 +26,6 @@
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "util/misc.h" #include "util/misc.h"
#include "gui/notifyqt.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
@ -65,6 +64,9 @@ HomePage::HomePage(QWidget *parent) :
QAction *RecAction = new QAction(QIcon(),tr("Recommend friends to each others"), this); QAction *RecAction = new QAction(QIcon(),tr("Recommend friends to each others"), this);
connect(RecAction, SIGNAL(triggered()), this, SLOT(recommendFriends())); connect(RecAction, SIGNAL(triggered()), this, SLOT(recommendFriends()));
QAction *SaveAction = new QAction(QIcon(),tr("Save to File"), this);
connect(SaveAction, SIGNAL(triggered()), this, SLOT(saveCert()));
QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this); QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this);
connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient())); connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient()));
@ -75,6 +77,7 @@ HomePage::HomePage(QWidget *parent) :
menu->addAction(CopyIdAction); menu->addAction(CopyIdAction);
menu->addSeparator(); menu->addSeparator();
menu->addAction(SaveAction);
menu->addAction(SendAction); menu->addAction(SendAction);
menu->addAction(WebMailAction); menu->addAction(WebMailAction);
menu->addAction(RecAction); menu->addAction(RecAction);
@ -348,7 +351,11 @@ void HomePage::saveCert()
//Todo: move save to file to p3Peers::SaveCertificateToFile //Todo: move save to file to p3Peers::SaveCertificateToFile
QTextStream ts(&file); QTextStream ts(&file);
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
ts.setEncoding(QStringConverter::Utf8);
#else
ts.setCodec(QTextCodec::codecForName("UTF-8")); ts.setCodec(QTextCodec::codecForName("UTF-8"));
#endif
ts << ui->retroshareid->text(); ts << ui->retroshareid->text();
} }

View file

@ -28,6 +28,7 @@
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "util/DateTime.h"
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
@ -148,7 +149,7 @@ void IdDetailsDialog::loadIdentity(RsGxsIdGroup data)
ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ; ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ;
ui->banoption_label->setVisible(!data.mPgpId.isNull()) ; ui->banoption_label->setVisible(!data.mPgpId.isNull()) ;
ui->lineEdit_Created->setText(QDateTime::fromMSecsSinceEpoch(qint64(1000)*data.mMeta.mPublishTs).toString(Qt::SystemLocaleShortDate)); ui->lineEdit_Created->setText(QLocale::system().toString(DateTime::DateTimeFromTime_t(data.mMeta.mPublishTs), QLocale::ShortFormat));
time_t now = time(NULL) ; time_t now = time(NULL) ;
ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ; ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;

View file

@ -47,9 +47,10 @@
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "retroshare-gui/RsAutoUpdatePage.h" #include "retroshare-gui/RsAutoUpdatePage.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include "util/rstime.h" #include "util/rstime.h"
#include "util/rsdebug.h" #include "util/rsdebug.h"
#include "util/DateTime.h"
#include "retroshare/rsgxsflags.h" #include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
@ -230,7 +231,7 @@ IdDialog::IdDialog(QWidget *parent)
mProxyModel->setSortRole(RsIdentityListModel::SortRole); mProxyModel->setSortRole(RsIdentityListModel::SortRole);
mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
mProxyModel->setFilterRole(RsIdentityListModel::FilterRole); mProxyModel->setFilterRole(RsIdentityListModel::FilterRole);
mProxyModel->setFilterRegExp(QRegExp(RsIdentityListModel::FilterString)); QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, RsIdentityListModel::FilterString);
ui->idTreeWidget->setModel(mProxyModel); ui->idTreeWidget->setModel(mProxyModel);
//ui->idTreeWidget->setSelectionModel(new QItemSelectionModel(mProxyModel));// useless in Qt5. //ui->idTreeWidget->setSelectionModel(new QItemSelectionModel(mProxyModel));// useless in Qt5.
@ -393,7 +394,7 @@ IdDialog::IdDialog(QWidget *parent)
/* Set initial section sizes */ /* Set initial section sizes */
QHeaderView * circlesheader = ui->treeWidget_membership->header () ; QHeaderView * circlesheader = ui->treeWidget_membership->header () ;
circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, fm.width("Circle name")*1.5) ; circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QFontMetrics_horizontalAdvance(fm, "Circle name")*1.5) ;
ui->treeWidget_membership->setColumnWidth(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 270); ui->treeWidget_membership->setColumnWidth(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 270);
/* Setup tree */ /* Setup tree */
@ -1653,7 +1654,7 @@ void IdDialog::loadIdentity(RsGxsIdGroup data)
/* get GPG Details from rsPeers */ /* get GPG Details from rsPeers */
RsPgpId ownPgpId = rsPeers->getGPGOwnId(); RsPgpId ownPgpId = rsPeers->getGPGOwnId();
ui->lineEdit_PublishTS->setText(QDateTime::fromMSecsSinceEpoch(qint64(1000)*data.mMeta.mPublishTs).toString(Qt::SystemLocaleShortDate)); ui->lineEdit_PublishTS->setText(QLocale::system().toString(DateTime::DateTimeFromTime_t(data.mMeta.mPublishTs), QLocale::ShortFormat));
//ui->lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE)); //ui->lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
ui->lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString())); ui->lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString()));
//ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString())); //ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString()));
@ -2165,7 +2166,7 @@ void IdDialog::headerContextMenuRequested(QPoint)
// create menu header // create menu header
//QHBoxLayout *hbox = new QHBoxLayout(widget); //QHBoxLayout *hbox = new QHBoxLayout(widget);
//hbox->setMargin(0); //hbox->setContentsMargins(0, 0, 0, 0);
//hbox->setSpacing(6); //hbox->setSpacing(6);
auto addEntry = [&](const QString& name,RsIdentityListModel::Columns col) auto addEntry = [&](const QString& name,RsIdentityListModel::Columns col)
@ -2264,7 +2265,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
// create menu header // create menu header
QHBoxLayout *hbox = new QHBoxLayout(widget); QHBoxLayout *hbox = new QHBoxLayout(widget);
hbox->setMargin(0); hbox->setContentsMargins(0, 0, 0, 0);
hbox->setSpacing(6); hbox->setSpacing(6);
QLabel *iconLabel = new QLabel(widget); QLabel *iconLabel = new QLabel(widget);
@ -2719,7 +2720,7 @@ void IdDialog::recursSaveExpandedItems_idTreeView(const QModelIndex& proxy_index
expanded.insert(local_path) ; expanded.insert(local_path) ;
for(int row=0;row<mProxyModel->rowCount(proxy_index);++row) for(int row=0;row<mProxyModel->rowCount(proxy_index);++row)
recursSaveExpandedItems_idTreeView(proxy_index.child(row,0),local_path,expanded,selected) ; recursSaveExpandedItems_idTreeView(mProxyModel->index(row,0,proxy_index),local_path,expanded,selected) ;
} }
if(ui->idTreeWidget->selectionModel()->isSelected(proxy_index)) if(ui->idTreeWidget->selectionModel()->isSelected(proxy_index))
@ -2751,7 +2752,7 @@ void IdDialog::recursRestoreExpandedItems_idTreeView(const QModelIndex& proxy_in
ui->idTreeWidget->setExpanded(proxy_index,true) ; ui->idTreeWidget->setExpanded(proxy_index,true) ;
for(int row=0;row<mProxyModel->rowCount(proxy_index);++row) for(int row=0;row<mProxyModel->rowCount(proxy_index);++row)
recursRestoreExpandedItems_idTreeView(proxy_index.child(row,0),local_path,expanded,selected) ; recursRestoreExpandedItems_idTreeView(mProxyModel->index(row,0,proxy_index),local_path,expanded,selected) ;
} }
if(selected.find(local_path) != selected.end()) if(selected.find(local_path) != selected.end())

View file

@ -29,12 +29,13 @@
#include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdDetails.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "util/misc.h" #include "util/misc.h"
#include "gui/notifyqt.h"
#include "retroshare/rsidentity.h" #include "retroshare/rsidentity.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "retroshare/rsinit.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "util/imageutil.h" #include "util/imageutil.h"
#include "util/RsQtVersion.h"
#include <iostream> #include <iostream>
@ -595,9 +596,9 @@ void IdEditDialog::createId()
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId()); std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
bool cancelled; bool cancelled;
rsNotify->clearPgpPassphrase(); // just in case RsLoginHelper::clearPgpPassphrase(); // just in case
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(), if(!RsLoginHelper::askForPassword(tr("Profile password needed.").toStdString(),
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")", gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
false, false,
gpg_password,cancelled)) gpg_password,cancelled))
@ -669,9 +670,9 @@ void IdEditDialog::updateId()
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId()); std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
bool cancelled; bool cancelled;
rsNotify->clearPgpPassphrase(); // just in case RsLoginHelper::clearPgpPassphrase(); // just in case
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(), if(!RsLoginHelper::askForPassword(tr("Profile password needed.").toStdString(),
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")", gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
false, false,
gpg_password,cancelled)) gpg_password,cancelled))
@ -700,8 +701,8 @@ void IdEditDialog::removeAvatar()
void IdEditDialog::updateInterface() void IdEditDialog::updateInterface()
{ {
const QPixmap *pixmap = ui->avatarLabel->pixmap(); QPixmap pixmap = QLabel_pixmap(ui->avatarLabel);
if (pixmap && !pixmap->isNull()) { if (!pixmap.isNull()) {
ui->removeButton->setEnabled(true); ui->removeButton->setEnabled(true);
} else if (mEditGroup.mImage.mSize > 0) { } else if (mEditGroup.mImage.mSize > 0) {
ui->removeButton->setEnabled(true); ui->removeButton->setEnabled(true);

View file

@ -168,7 +168,7 @@ public:
/* Color definitions (for standard see default.qss) */ /* Color definitions (for standard see default.qss) */
QColor mTextColorGroup; QColor mTextColorGroup;
QColor mTextColorStatus[RS_STATUS_COUNT]; QColor mTextColorStatus[(int)RsStatusValue::RS_STATUS_COUNT];
void setIdentities(const std::list<RsGroupMetaData>& identities_meta); void setIdentities(const std::list<RsGroupMetaData>& identities_meta);

View file

@ -80,7 +80,7 @@ void LogoBar::init() {
); );
QGridLayout * layout = new QGridLayout(this); QGridLayout * layout = new QGridLayout(this);
layout->setMargin(0); layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0); layout->setSpacing(0);
layout->addWidget(FillLabel1, 0, 0); layout->addWidget(FillLabel1, 0, 0);

View file

@ -29,10 +29,13 @@
#include <QUrl> #include <QUrl>
#include <QtDebug> #include <QtDebug>
#include <QMenuBar> #include <QMenuBar>
#include <QActionGroup>
#include <retroshare/rsplugin.h> #include "retroshare/rsplugin.h"
#include <retroshare/rsconfig.h> #include "retroshare/rsconfig.h"
#include <util/argstream.h> #include "retroshare/rsevents.h"
#include "util/argstream.h"
#include "util/qtthreadsutils.h"
#if defined(Q_OS_DARWIN) #if defined(Q_OS_DARWIN)
#include "gui/common/MacDockIconHandler.h" #include "gui/common/MacDockIconHandler.h"
@ -64,7 +67,6 @@
#include "chat/ChatDialog.h" #include "chat/ChatDialog.h"
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "SoundManager.h" #include "SoundManager.h"
#include "notifyqt.h"
#include "common/UserNotify.h" #include "common/UserNotify.h"
#include "gui/ServicePermissionDialog.h" #include "gui/ServicePermissionDialog.h"
@ -98,7 +100,6 @@
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "retroshare/rsnotify.h"
#include "retroshare/rsinit.h" #include "retroshare/rsinit.h"
#include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxschannels/GxsChannelDialog.h"
@ -120,11 +121,11 @@
#include "gui/statistics/StatisticsWindow.h" #include "gui/statistics/StatisticsWindow.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "gui/RsGUIEventManager.h"
#include "gui/common/RsCollectionDialog.h" #include "gui/common/RsCollectionDialog.h"
#include "settings/rsettingswin.h" #include "settings/rsettingswin.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "common/StatusDefs.h" #include "common/StatusDefs.h"
#include "gui/notifyqt.h"
#ifdef RS_WEBUI #ifdef RS_WEBUI
# include "settings/WebuiPage.h" # include "settings/WebuiPage.h"
@ -270,7 +271,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
QWidget *widget = new QWidget(); QWidget *widget = new QWidget();
widget->setObjectName("trans_statusComboBoxFrame"); widget->setObjectName("trans_statusComboBoxFrame");
QHBoxLayout *hbox = new QHBoxLayout(); QHBoxLayout *hbox = new QHBoxLayout();
hbox->setMargin(0); hbox->setContentsMargins(0, 0, 0, 0);
hbox->setSpacing(6); hbox->setSpacing(6);
hbox->addWidget(statusComboBox); hbox->addWidget(statusComboBox);
widget->setLayout(hbox); widget->setLayout(hbox);
@ -350,10 +351,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
createNotifyIcons(); createNotifyIcons();
/* calculate friend count */ /* intialize friend count */
updateFriends(); updateFriends();
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends()));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends()));
loadOwnStatus(); loadOwnStatus();
@ -368,10 +367,28 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000); timer->start(1000);
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged(); settingsChanged();
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f); mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);
mEventHandlerId_friends = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
{
RsQThreadUtils::postToObject([=]()
{
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
if(!fe)
return;
updateFriends();
}
, this );
}, mEventHandlerId_friends, RsEventType::FRIEND_LIST );
} }
/** Destructor. */ /** Destructor. */
@ -382,6 +399,8 @@ MainWindow::~MainWindow()
Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState()); Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState());
Settings->setValueToGroup("MainWindow", "State", saveState()); Settings->setValueToGroup("MainWindow", "State", saveState());
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
delete statusComboBox; delete statusComboBox;
delete peerstatus; delete peerstatus;
delete natstatus; delete natstatus;
@ -606,28 +625,6 @@ void MainWindow::setNewPage(int page)
} }
} }
void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
{
QString locString ;
switch(loc)
{
case RS_PARTIALS_DIRECTORY: locString = "Partials" ;
break ;
case RS_CONFIG_DIRECTORY: locString = "Config" ;
break ;
case RS_DOWNLOAD_DIRECTORY: locString = "Download" ;
break ;
default:
std::cerr << "Error: " << __PRETTY_FUNCTION__ << " was called with an unknown parameter loc=" << loc << std::endl ;
return ;
}
QMessageBox::critical(NULL,tr("Low disk space warning"),
tr("The disk space in your")+" "+locString +" "+tr("directory is running low (current limit is")+" "+QString::number(size_limit_mb)+tr("MB). \n\n RetroShare will now safely suspend any disk access to this directory. \n\n Please make some free space and click Ok.")) ;
}
/** Creates a tray icon with a context menu and adds it to the system /** Creates a tray icon with a context menu and adds it to the system
* notification area. */ * notification area. */
void MainWindow::createTrayIcon() void MainWindow::createTrayIcon()
@ -967,7 +964,9 @@ void MainWindow::postModDirectories(bool /*update_local*/)
{ {
//RSettingsPage::postModDirectories(update_local); //RSettingsPage::postModDirectories(update_local);
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
QCoreApplication::flush(); QCoreApplication::flush();
#endif
} }
#ifdef WINDOWS_SYS #ifdef WINDOWS_SYS
@ -1378,11 +1377,6 @@ void MainWindow::receiveNewArgs(QStringList args)
retroshareLinkActivated(link.toUrl()); retroshareLinkActivated(link.toUrl());
} }
void MainWindow::displayErrorMessage(int /*a*/,int /*b*/,const QString& error_msg)
{
QMessageBox::critical(NULL, tr("Internal Error"),error_msg) ;
}
void MainWindow::closeEvent(QCloseEvent *e) void MainWindow::closeEvent(QCloseEvent *e)
{ {
e->ignore(); e->ignore();
@ -1480,7 +1474,7 @@ MainWindow::retranslateUi()
} }
/* set status object to status value */ /* set status object to status value */
static void setStatusObject(QObject *pObject, int nStatus) static void setStatusObject(QObject *pObject, RsStatusValue nStatus)
{ {
QMenu *pMenu = dynamic_cast<QMenu*>(pObject); QMenu *pMenu = dynamic_cast<QMenu*>(pObject);
if (pMenu) { if (pMenu) {
@ -1491,7 +1485,7 @@ static void setStatusObject(QObject *pObject, int nStatus)
continue; continue;
} }
if (pAction->data().toInt() == nStatus) { if (pAction->data().toInt() == (int)nStatus) {
pAction->setChecked(true); pAction->setChecked(true);
break; break;
} }
@ -1501,7 +1495,7 @@ static void setStatusObject(QObject *pObject, int nStatus)
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject); RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
if (pComboBox) { if (pComboBox) {
/* set index of combobox */ /* set index of combobox */
int nIndex = pComboBox->findData(nStatus, Qt::UserRole); int nIndex = pComboBox->findData((int)nStatus, Qt::UserRole);
if (nIndex != -1) { if (nIndex != -1) {
pComboBox->setCurrentIndex(nIndex); pComboBox->setCurrentIndex(nIndex);
} }
@ -1564,20 +1558,20 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
/* initialize menu */ /* initialize menu */
QActionGroup *pGroup = new QActionGroup(pMenu); QActionGroup *pGroup = new QActionGroup(pMenu);
QAction *pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_ONLINE)), StatusDefs::name(RS_STATUS_ONLINE), pMenu); QAction *pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_ONLINE)), StatusDefs::name(RsStatusValue::RS_STATUS_ONLINE), pMenu);
pAction->setData(RS_STATUS_ONLINE); pAction->setData((int)RsStatusValue::RS_STATUS_ONLINE);
pAction->setCheckable(true); pAction->setCheckable(true);
pMenu->addAction(pAction); pMenu->addAction(pAction);
pGroup->addAction(pAction); pGroup->addAction(pAction);
pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_BUSY)), StatusDefs::name(RS_STATUS_BUSY), pMenu); pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_BUSY)), StatusDefs::name(RsStatusValue::RS_STATUS_BUSY), pMenu);
pAction->setData(RS_STATUS_BUSY); pAction->setData((int)RsStatusValue::RS_STATUS_BUSY);
pAction->setCheckable(true); pAction->setCheckable(true);
pMenu->addAction(pAction); pMenu->addAction(pAction);
pGroup->addAction(pAction); pGroup->addAction(pAction);
pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_AWAY)), StatusDefs::name(RS_STATUS_AWAY), pMenu); pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_AWAY)), StatusDefs::name(RsStatusValue::RS_STATUS_AWAY), pMenu);
pAction->setData(RS_STATUS_AWAY); pAction->setData((int)RsStatusValue::RS_STATUS_AWAY);
pAction->setCheckable(true); pAction->setCheckable(true);
pMenu->addAction(pAction); pMenu->addAction(pAction);
pGroup->addAction(pAction); pGroup->addAction(pAction);
@ -1589,9 +1583,9 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
/* initialize combobox */ /* initialize combobox */
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject); RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
if (pComboBox) { if (pComboBox) {
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_ONLINE)), StatusDefs::name(RS_STATUS_ONLINE), RS_STATUS_ONLINE); pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_ONLINE)), StatusDefs::name(RsStatusValue::RS_STATUS_ONLINE), (int)RsStatusValue::RS_STATUS_ONLINE);
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_BUSY)), StatusDefs::name(RS_STATUS_BUSY), RS_STATUS_BUSY); pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_BUSY)), StatusDefs::name(RsStatusValue::RS_STATUS_BUSY), (int)RsStatusValue::RS_STATUS_BUSY);
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_AWAY)), StatusDefs::name(RS_STATUS_AWAY), RS_STATUS_AWAY); pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_AWAY)), StatusDefs::name(RsStatusValue::RS_STATUS_AWAY), (int)RsStatusValue::RS_STATUS_AWAY);
if (bConnect) { if (bConnect) {
connect(pComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int))); connect(pComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int)));
@ -1619,11 +1613,11 @@ void MainWindow::removeStatusObject(QObject *pObject)
} }
/** Save own status Online,Away,Busy **/ /** Save own status Online,Away,Busy **/
void MainWindow::setStatus(QObject *pObject, int nStatus) void MainWindow::setStatus(QObject *pObject, RsStatusValue nStatus)
{ {
if (isIdle && nStatus == (int) RS_STATUS_ONLINE) { if (isIdle && nStatus == RsStatusValue::RS_STATUS_ONLINE) {
/* set idle only when I am online */ /* set idle only when I am online */
nStatus = RS_STATUS_INACTIVE; nStatus = RsStatusValue::RS_STATUS_INACTIVE;
} }
rsStatus->sendStatus(RsPeerId(), nStatus); rsStatus->sendStatus(RsPeerId(), nStatus);
@ -1643,7 +1637,7 @@ void MainWindow::statusChangedMenu(QAction *pAction)
return; return;
} }
setStatus(pAction->parent(), pAction->data().toInt()); setStatus(pAction->parent(), RsStatusValue(pAction->data().toInt()));
} }
/* new status from combobox in statusbar */ /* new status from combobox in statusbar */
@ -1654,7 +1648,7 @@ void MainWindow::statusChangedComboBox(int index)
} }
/* no object known */ /* no object known */
setStatus(NULL, statusComboBox->itemData(index, Qt::UserRole).toInt()); setStatus(NULL, RsStatusValue(statusComboBox->itemData(index, Qt::UserRole).toInt()));
} }
/*new setting*/ /*new setting*/

View file

@ -25,6 +25,9 @@
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <set> #include <set>
#include "retroshare/rsevents.h"
#include "retroshare/rsstatus.h"
#include "gui/common/rwindow.h" #include "gui/common/rwindow.h"
#include "gui/common/RSComboBox.h" #include "gui/common/RSComboBox.h"
#include "util/FontSizeHandler.h" #include "util/FontSizeHandler.h"
@ -183,7 +186,7 @@ public:
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */ /* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
void initializeStatusObject(QObject *pObject, bool bConnect); void initializeStatusObject(QObject *pObject, bool bConnect);
void removeStatusObject(QObject *pObject); void removeStatusObject(QObject *pObject);
void setStatus(QObject *pObject, int nStatus); void setStatus(QObject *pObject, RsStatusValue nStatus);
RSComboBox *statusComboBoxInstance(); RSComboBox *statusComboBoxInstance();
PeerStatus *peerstatusInstance(); PeerStatus *peerstatusInstance();
@ -207,9 +210,7 @@ public:
public slots: public slots:
void receiveNewArgs(QStringList args); void receiveNewArgs(QStringList args);
void displayErrorMessage(int,int,const QString&) ;
void postModDirectories(bool update_local); void postModDirectories(bool update_local);
void displayDiskSpaceWarning(int loc,int size_limit_mb) ;
void checkAndSetIdle(int idleTime); void checkAndSetIdle(int idleTime);
void externalLinkActivated(const QUrl &url); void externalLinkActivated(const QUrl &url);
@ -375,6 +376,7 @@ private:
FontSizeHandler mFontSizeHandler; FontSizeHandler mFontSizeHandler;
Ui::MainWindow *ui ; Ui::MainWindow *ui ;
};
RsEventsHandlerId_t mEventHandlerId_friends;
};
#endif #endif

View file

@ -29,7 +29,6 @@
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <retroshare/rsstatus.h> #include <retroshare/rsstatus.h>
#include <retroshare/rsnotify.h>
#include "rshare.h" #include "rshare.h"
#include "MessengerWindow.h" #include "MessengerWindow.h"
@ -37,9 +36,9 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "ShareManager.h" #include "ShareManager.h"
#include "notifyqt.h"
#include "connect/ConnectFriendWizard.h" #include "connect/ConnectFriendWizard.h"
#include "util/PixmapMerging.h" #include "util/PixmapMerging.h"
#include "util/qtthreadsutils.h"
#include "LogoBar.h" #include "LogoBar.h"
#include "util/Widget.h" #include "util/Widget.h"
#include "util/misc.h" #include "util/misc.h"
@ -95,8 +94,26 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage())); connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage())); mEventHandlerId = 0;
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int))); rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
{
RsQThreadUtils::postToObject([=](){
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
if(!fe) return;
switch(fe->mEventCode)
{
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateOwnStatus(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
break;
case RsFriendListEventCode::OWN_STATUS_CHANGED: loadmystatusmessage();
break;
default:
break;
}
}, this );
},mEventHandlerId,RsEventType::FRIEND_LIST);
for (std::set<RsPgpId>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) { for (std::set<RsPgpId>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
ui.friendList->addPeerToExpand(*peerIt); ui.friendList->addPeerToExpand(*peerIt);
@ -159,6 +176,7 @@ MessengerWindow::~MessengerWindow ()
{ {
// save settings // save settings
processSettings(false); processSettings(false);
rsEvents->unregisterEventsHandler(mEventHandlerId);
MainWindow *pMainWindow = MainWindow::getInstance(); MainWindow *pMainWindow = MainWindow::getInstance();
if (pMainWindow) { if (pMainWindow) {
@ -214,7 +232,7 @@ void MessengerWindow::savestatusmessage()
rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData()); rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData());
} }
void MessengerWindow::updateOwnStatus(const QString &peer_id, int status) void MessengerWindow::updateOwnStatus(const QString &peer_id, RsStatusValue status)
{ {
// add self nick + own status // add self nick + own status
if (peer_id == QString::fromStdString(rsPeers->getOwnId().toStdString())) if (peer_id == QString::fromStdString(rsPeers->getOwnId().toStdString()))

View file

@ -39,7 +39,7 @@ public slots:
protected: protected:
/** Default Constructor */ /** Default Constructor */
MessengerWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); MessengerWindow(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
/** Default Destructor */ /** Default Destructor */
~MessengerWindow(); ~MessengerWindow();
@ -52,7 +52,7 @@ private slots:
/** Open Shared Manager **/ /** Open Shared Manager **/
void openShareManager(); void openShareManager();
void updateOwnStatus(const QString &peer_id, int status); void updateOwnStatus(const QString &peer_id, RsStatusValue status);
void savestatusmessage(); void savestatusmessage();
@ -68,6 +68,7 @@ private:
static std::set<RsPgpId> expandedPeers ; static std::set<RsPgpId> expandedPeers ;
static std::set<RsNodeGroupId> expandedGroups ; static std::set<RsNodeGroupId> expandedGroups ;
RsEventsHandlerId_t mEventHandlerId ;
}; };
#endif #endif

View file

@ -42,7 +42,7 @@
#include "connect/PGPKeyDialog.h" #include "connect/PGPKeyDialog.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include <time.h> #include <time.h>

View file

@ -44,7 +44,7 @@ pgpid_item_proxy::pgpid_item_proxy(QObject *parent) :
void pgpid_item_proxy::use_only_trusted_keys(bool val) void pgpid_item_proxy::use_only_trusted_keys(bool val)
{ {
only_trusted_keys = val; only_trusted_keys = val;
filterChanged(); invalidateFilter();
} }
bool pgpid_item_proxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const bool pgpid_item_proxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const

View file

@ -28,6 +28,7 @@
#include <algorithm> #include <algorithm>
#include "gui/elastic/elnode.h" #include "gui/elastic/elnode.h"
#include "util/qtthreadsutils.h"
/******** /********
* #define DEBUG_NETWORKVIEW * #define DEBUG_NETWORKVIEW
@ -60,12 +61,32 @@ NetworkView::NetworkView(QWidget *parent)
connect( ui.nameBox, SIGNAL(textChanged(QString)), this, SLOT(setNameSearch(QString))); connect( ui.nameBox, SIGNAL(textChanged(QString)), this, SLOT(setNameSearch(QString)));
_should_update = true ; _should_update = true ;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{
RsQThreadUtils::postToObject([=](){
auto ev = dynamic_cast<const RsGossipDiscoveryEvent *>(event.get());
if(!ev) return;
switch(ev->mGossipDiscoveryEventType)
{
case RsGossipDiscoveryEventType::DISCOVERY_INFO_RECEIVED: update();
[[fallthrough]];
default:
break;
}
}, this );
}, mEventHandlerId, RsEventType::GOSSIP_DISCOVERY );
} }
NetworkView::~NetworkView() NetworkView::~NetworkView()
{ {
if(mScene != NULL) rsEvents->unregisterEventsHandler(mEventHandlerId);
delete mScene ;
if(mScene != NULL)
delete mScene ;
} }
void NetworkView::setEdgeLength(int l) void NetworkView::setEdgeLength(int l)

View file

@ -24,6 +24,7 @@
#include <QGraphicsScene> #include <QGraphicsScene>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
#include <retroshare/rsevents.h>
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#include "ui_NetworkView.h" #include "ui_NetworkView.h"
@ -65,6 +66,7 @@ class NetworkView : public RsAutoUpdatePage
std::map<RsPgpId,GraphWidget::NodeId> _node_ids ; std::map<RsPgpId,GraphWidget::NodeId> _node_ids ;
bool _should_update ; bool _should_update ;
RsEventsHandlerId_t mEventHandlerId;
}; };
#endif #endif

View file

@ -27,7 +27,6 @@
#include <retroshare/rsgxschannels.h> #include <retroshare/rsgxschannels.h>
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <retroshare/rsnotify.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsplugin.h> #include <retroshare/rsplugin.h>
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
@ -35,6 +34,7 @@
#include "util/misc.h" #include "util/misc.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "feeds/BoardsCommentsItem.h" #include "feeds/BoardsCommentsItem.h"
#include "feeds/BoardsPostItem.h"
#include "feeds/ChatMsgItem.h" #include "feeds/ChatMsgItem.h"
#include "feeds/GxsCircleItem.h" #include "feeds/GxsCircleItem.h"
#include "feeds/ChannelsCommentsItem.h" #include "feeds/ChannelsCommentsItem.h"
@ -58,7 +58,6 @@
#include "msgs/MessageInterface.h" #include "msgs/MessageInterface.h"
#include "common/FeedNotify.h" #include "common/FeedNotify.h"
#include "notifyqt.h"
#define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE #define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE
@ -76,7 +75,7 @@ static NewsFeed* instance = nullptr;
NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed), NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed),
mEventTypes({ mEventTypes({
RsEventType::AUTHSSL_CONNECTION_AUTENTICATION, RsEventType::AUTHSSL_CONNECTION_AUTENTICATION,
RsEventType::PEER_CONNECTION , RsEventType::FRIEND_LIST ,
RsEventType::GXS_CIRCLES , RsEventType::GXS_CIRCLES ,
RsEventType::GXS_CHANNELS , RsEventType::GXS_CHANNELS ,
RsEventType::GXS_FORUMS , RsEventType::GXS_FORUMS ,
@ -192,27 +191,27 @@ void NewsFeed::handleEvent(std::shared_ptr<const RsEvent> event)
void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event) void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
{ {
uint flags = Settings->getNewsFeedFlags(); RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags();
if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (flags & RS_FEED_TYPE_SECURITY)) if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY)))
handleSecurityEvent(event); handleSecurityEvent(event);
if(event->mType == RsEventType::PEER_CONNECTION && (flags & RS_FEED_TYPE_PEER)) if(event->mType == RsEventType::FRIEND_LIST && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_PEER)))
handleConnectionEvent(event); handleConnectionEvent(event);
if(event->mType == RsEventType::GXS_CIRCLES && (flags & RS_FEED_TYPE_CIRCLE)) if(event->mType == RsEventType::GXS_CIRCLES && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE)))
handleCircleEvent(event); handleCircleEvent(event);
if(event->mType == RsEventType::GXS_CHANNELS && (flags & RS_FEED_TYPE_CHANNEL)) if(event->mType == RsEventType::GXS_CHANNELS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL)))
handleChannelEvent(event); handleChannelEvent(event);
if(event->mType == RsEventType::GXS_FORUMS && (flags & RS_FEED_TYPE_FORUM)) if(event->mType == RsEventType::GXS_FORUMS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_FORUM)))
handleForumEvent(event); handleForumEvent(event);
if(event->mType == RsEventType::GXS_POSTED && (flags & RS_FEED_TYPE_POSTED)) if(event->mType == RsEventType::GXS_POSTED && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_POSTED)))
handlePostedEvent(event); handlePostedEvent(event);
if(event->mType == RsEventType::MAIL_STATUS && (flags & RS_FEED_TYPE_MSG)) if(event->mType == RsEventType::MAIL_STATUS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_MSG)))
handleMailEvent(event); handleMailEvent(event);
} }
@ -241,11 +240,12 @@ void NewsFeed::handlePostedEvent(std::shared_ptr<const RsEvent> event)
switch(pe->mPostedEventCode) switch(pe->mPostedEventCode)
{ {
case RsPostedEventCode::UPDATED_POSTED_GROUP:
case RsPostedEventCode::NEW_POSTED_GROUP: case RsPostedEventCode::NEW_POSTED_GROUP:
addFeedItem( new PostedGroupItem(this, NEWSFEED_POSTEDNEWLIST, pe->mPostedGroupId, false, true)); addFeedItem( new PostedGroupItem(this, NEWSFEED_POSTEDNEWLIST, pe->mPostedGroupId, false, true));
break; break;
case RsPostedEventCode::NEW_MESSAGE: case RsPostedEventCode::NEW_MESSAGE:
addFeedItem( new PostedItem(this, NEWSFEED_POSTEDMSGLIST, pe->mPostedGroupId, pe->mPostedMsgId, false, true)); addFeedItem( new BoardsPostItem(this, NEWSFEED_POSTEDMSGLIST, pe->mPostedGroupId, pe->mPostedMsgId, false, true));
break; break;
case RsPostedEventCode::NEW_COMMENT: case RsPostedEventCode::NEW_COMMENT:
addFeedItem( new BoardsCommentsItem(this, NEWSFEED_POSTEDMSGLIST, pe->mPostedGroupId, pe->mPostedMsgId, false, true)); addFeedItem( new BoardsCommentsItem(this, NEWSFEED_POSTEDMSGLIST, pe->mPostedGroupId, pe->mPostedMsgId, false, true));
@ -389,25 +389,25 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
// only show membership requests if we're an admin of that circle // only show membership requests if we're an admin of that circle
if(details.isIdInInviteeList(pe->mGxsId)) if(details.isIdInInviteeList(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true);
else if(details.mAmIAdmin) else if(details.mAmIAdmin)
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ),true);
break; break;
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
if(details.isIdInInviteeList(pe->mGxsId)) if(details.isIdInInviteeList(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true);
break; break;
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
if(rsIdentity->isOwnId(pe->mGxsId)) if(rsIdentity->isOwnId(pe->mGxsId))
{ {
if(details.isIdRequestingMembership(pe->mGxsId)) if(details.isIdRequestingMembership(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true);
else else
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_REC),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC),true);
} }
break; break;
@ -415,9 +415,9 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
if(rsIdentity->isOwnId(pe->mGxsId)) if(rsIdentity->isOwnId(pe->mGxsId))
{ {
if(details.isIdRequestingMembership(pe->mGxsId)) if(details.isIdRequestingMembership(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true);
else else
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true);
} }
break; break;
@ -428,31 +428,26 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event) void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
{ {
const RsConnectionEvent *pe = dynamic_cast<const RsConnectionEvent*>(event.get()); const RsFriendListEvent *pe = dynamic_cast<const RsFriendListEvent*>(event.get());
if(!pe) return; if(!pe) return;
auto& e(*pe); auto& e(*pe);
#ifdef NEWS_DEBUG switch(e.mEventCode)
std::cerr << "NotifyQt: handling connection event from peer " << e.mSslId << std::endl;
#endif
switch(e.mConnectionInfoCode)
{ {
case RsConnectionEventCode::PEER_CONNECTED: case RsFriendListEventCode::NODE_CONNECTED:
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false), true); addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false), true);
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT, e.mSslId.toStdString().c_str(), "", "");
break; break;
case RsConnectionEventCode::PEER_DISCONNECTED: // not handled yet case RsFriendListEventCode::NODE_DISCONNECTED: // not handled yet
break; break;
case RsConnectionEventCode::PEER_TIME_SHIFT: case RsFriendListEventCode::NODE_TIME_SHIFT:
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_OFFSET, false),false); addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_OFFSET, false),false);
break; break;
case RsConnectionEventCode::PEER_REPORTS_WRONG_IP: case RsFriendListEventCode::NODE_REPORTS_WRONG_IP:
addFeedItemIfUnique(new SecurityIpItem( addFeedItemIfUnique(new SecurityIpItem(
this, e.mSslId, e.mOwnLocator.toString(), this, e.mSslId, e.mOwnLocator.toString(),
e.mReportedLocator.toString(), e.mReportedLocator.toString(),
RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED,
false ), false); false ), false);
break; break;
default: break; default: break;
@ -467,34 +462,31 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
return; return;
auto& e(*pe); auto& e(*pe);
#ifdef NEWS_DEBUG RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags();
std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl;
#endif
uint flags = Settings->getNewsFeedFlags();
if(e.mErrorCode == RsAuthSslError::PEER_REFUSED_CONNECTION && (flags & RS_FEED_TYPE_SECURITY_IP)) if(e.mErrorCode == RsAuthSslError::PEER_REFUSED_CONNECTION && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY_IP)))
{ {
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_HELLO, false), true ); addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_HELLO, false), true );
return; return;
} }
uint32_t FeedItemType=0; RsFeedTypeFlags FeedItemType(RsFeedTypeFlags::RS_FEED_TYPE_NONE);
switch(e.mErrorCode) switch(e.mErrorCode)
{ {
case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough
case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough
case RsAuthSslError::MISSING_AUTHENTICATION_INFO: case RsAuthSslError::MISSING_AUTHENTICATION_INFO:
FeedItemType = RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break;
case RsAuthSslError::PGP_SIGNATURE_VALIDATION_FAILED: case RsAuthSslError::PGP_SIGNATURE_VALIDATION_FAILED:
FeedItemType = RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
case RsAuthSslError::NOT_A_FRIEND: case RsAuthSslError::NOT_A_FRIEND:
FeedItemType = RS_FEED_ITEM_SEC_CONNECT_ATTEMPT; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_CONNECT_ATTEMPT; break;
case RsAuthSslError::IP_IS_BLACKLISTED: case RsAuthSslError::IP_IS_BLACKLISTED:
FeedItemType = RS_FEED_ITEM_SEC_IP_BLACKLISTED; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
case RsAuthSslError::MISSING_CERTIFICATE: case RsAuthSslError::MISSING_CERTIFICATE:
FeedItemType = RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
default: default:
return; // display nothing return; // display nothing
} }
@ -504,14 +496,50 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
addFeedItemIfUnique(new SecurityItem(this, NEWSFEED_SECLIST, e.mPgpId, e.mSslId, det.location, e.mLocator.toString(), FeedItemType, false), true ); addFeedItemIfUnique(new SecurityItem(this, NEWSFEED_SECLIST, e.mPgpId, e.mSslId, det.location, e.mLocator.toString(), FeedItemType, false), true );
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT) if (Settings->getMessageFlags() & RshareSettings::RS_MESSAGE_CONNECT_ATTEMPT)
MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")")); MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")"));
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT_ATTEMPT, e.mPgpId.toStdString().c_str(), det.location, e.mSslId.toStdString().c_str());
} }
void NewsFeed::testFeeds(uint /*notifyFlags*/) void NewsFeed::testFeeds(RsFeedTypeFlags /*notifyFlags*/)
{ {
RsFeedTypeFlags flags = RsFeedTypeFlags(Settings->getNewsFeedFlags());
//For test your feed add valid ID's for RsGxsGroupId & RsGxsMessageId, else test feed will be not displayed
if (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_PEER))
instance->addFeedItemIfUnique(new PeerItem(instance, NEWSFEED_PEERLIST, RsPeerId(""), PEER_TYPE_CONNECT, false), true);
if (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_MSG))
instance->addFeedItemIfUnique(new MsgItem(instance, NEWSFEED_MESSAGELIST, std::string(""), false), true);
if (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL)){
instance->addFeedItem(new GxsChannelGroupItem(instance, NEWSFEED_CHANNELNEWLIST, RsGxsGroupId(""), false, true));
instance->addFeedItem(new GxsChannelPostItem(instance, NEWSFEED_CHANNELNEWLIST, RsGxsGroupId(""), RsGxsMessageId(""), false, true));
instance->addFeedItem(new ChannelsCommentsItem(instance, NEWSFEED_CHANNELNEWLIST, RsGxsGroupId(""), RsGxsMessageId(""), RsGxsMessageId(""), false, true));
}
if(!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_FORUM)){
instance->addFeedItem(new GxsForumGroupItem(instance, NEWSFEED_NEW_FORUM, RsGxsGroupId(""), false, true));
instance->addFeedItem(new GxsForumMsgItem(instance, NEWSFEED_NEW_FORUM, RsGxsGroupId(""), RsGxsMessageId(""), false, true ));
}
if(!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_POSTED)){
instance->addFeedItem( new PostedGroupItem(instance, NEWSFEED_POSTEDNEWLIST, RsGxsGroupId(""), false, true));
instance->addFeedItem( new PostedItem(instance, NEWSFEED_POSTEDMSGLIST, RsGxsGroupId(""), RsGxsMessageId(""), false, true));
instance->addFeedItem( new BoardsCommentsItem(instance, NEWSFEED_POSTEDMSGLIST, RsGxsGroupId(""), RsGxsMessageId(""), false, true));
}
if (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE))
instance->addFeedItemIfUnique(new GxsCircleItem(instance, NEWSFEED_CIRCLELIST, RsGxsCircleId(""), RsGxsId(""), RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true);;
auto feedItem2 = new BoardsPostItem(instance,
NEWSFEED_CHANNELNEWLIST,
RsGxsGroupId ("00000000000000000000000000000000"),
RsGxsMessageId("0000000000000000000000000000000000000000")
, false, true);
instance->addFeedItem(feedItem2);
#ifdef TO_REMOVE #ifdef TO_REMOVE
if (!instance) { if (!instance) {
return; return;

View file

@ -24,6 +24,7 @@
#include <retroshare-gui/mainpage.h> #include <retroshare-gui/mainpage.h>
#include "gui/feeds/FeedHolder.h" #include "gui/feeds/FeedHolder.h"
#include "gui/feeds/FeedItem.h"
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#define IMAGE_NEWSFEED ":/icons/png/newsfeed.png" #define IMAGE_NEWSFEED ":/icons/png/newsfeed.png"
@ -67,19 +68,19 @@ public:
/** Default Destructor */ /** Default Destructor */
virtual ~NewsFeed(); virtual ~NewsFeed();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_NEWSFEED) ; } //MainPage virtual QIcon iconPixmap() const override { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
virtual QString pageName() const { return tr("Activity") ; } //MainPage virtual QString pageName() const override { return tr("Activity") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage virtual QString helpText() const override { return ""; } //MainPage
virtual UserNotify *createUserNotify(QObject *parent) override; virtual UserNotify *createUserNotify(QObject *parent) override;
/* FeedHolder Functions (for FeedItem functionality) */ /* FeedHolder Functions (for FeedItem functionality) */
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea()override ;
virtual void deleteFeedItem(FeedItem *item, uint32_t type); virtual void deleteFeedItem(FeedItem *item, uint32_t type)override ;
virtual void openChat(const RsPeerId& peerId); virtual void openChat(const RsPeerId& peerId)override ;
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title)override ;
static void testFeeds(uint notifyFlags); static void testFeeds(RsFeedTypeFlags notifyFlags);
static void testFeed(FeedNotify *feedNotify); static void testFeed(FeedNotify *feedNotify);
void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare

View file

@ -35,6 +35,7 @@
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "gui/Identity/IdDialog.h" #include "gui/Identity/IdDialog.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "util/DateTime.h"
#include "ui_BoardPostDisplayWidget_compact.h" #include "ui_BoardPostDisplayWidget_compact.h"
#include "ui_BoardPostDisplayWidget_card.h" #include "ui_BoardPostDisplayWidget_card.h"
@ -194,16 +195,14 @@ void BoardPostDisplayWidgetBase::baseSetup()
voteDownButton()->setDisabled(true); voteDownButton()->setDisabled(true);
fromLabel()->setId(mPost.mMeta.mAuthorId); fromLabel()->setId(mPost.mMeta.mAuthorId);
titleLabel()->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ; titleLabel()->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime; QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
dateLabel()->setText(timestamp); dateLabel()->setText(timestamp);
pictureLabel()->setDisabled(true); pictureLabel()->setDisabled(true);
} }
else else
{ {
QDateTime qtime; QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs) + " " + tr("ago"); QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs) + " " + tr("ago");
dateLabel()->setText(timestamp); dateLabel()->setText(timestamp);

View file

@ -31,6 +31,7 @@
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "ui_PostedCardView.h" #include "ui_PostedCardView.h"
@ -44,14 +45,14 @@
PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData &group_meta, const RsGxsMessageId &post_id, bool isHome, bool autoUpdate) PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData &group_meta, const RsGxsMessageId &post_id, bool isHome, bool autoUpdate)
: BasePostedItem(feedHolder, feedId, group_meta, post_id, isHome, autoUpdate) : BasePostedItem(feedHolder, feedId, group_meta, post_id, isHome, autoUpdate)
{ {
setup(); PostedCardView::setup();
} }
PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId& post_id, bool isHome, bool autoUpdate) PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId& post_id, bool isHome, bool autoUpdate)
: BasePostedItem(feedHolder, feedId, groupId, post_id, isHome, autoUpdate) : BasePostedItem(feedHolder, feedId, groupId, post_id, isHome, autoUpdate)
{ {
setup(); PostedCardView::setup();
loadGroup(); PostedCardView::loadGroup();
} }
void PostedCardView::setCommentsSize(int comNb) void PostedCardView::setCommentsSize(int comNb)
@ -186,8 +187,7 @@ void PostedCardView::fill()
ui->picture_frame->hide(); ui->picture_frame->hide();
ui->fromLabel->setId(mPost.mMeta.mAuthorId); ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ; ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime; QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
ui->dateLabel->setText(timestamp); ui->dateLabel->setText(timestamp);
} else { } else {
@ -198,8 +198,7 @@ void PostedCardView::fill()
//int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height()); //int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height());
//int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height(); //int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
QDateTime qtime; QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs); QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
ui->dateLabel->setText(timestamp2); ui->dateLabel->setText(timestamp2);

View file

@ -37,6 +37,7 @@
#include "PhotoView.h" #include "PhotoView.h"
#include "gui/Posted/PostedDialog.h" #include "gui/Posted/PostedDialog.h"
#include "ui_PostedItem.h" #include "ui_PostedItem.h"
#include "util/DateTime.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
@ -366,14 +367,14 @@ void BasePostedItem::showAuthorInPeople()
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData &group_meta, const RsGxsMessageId& post_id, bool isHome, bool autoUpdate) : PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData &group_meta, const RsGxsMessageId& post_id, bool isHome, bool autoUpdate) :
BasePostedItem(feedHolder, feedId, group_meta, post_id, isHome, autoUpdate) BasePostedItem(feedHolder, feedId, group_meta, post_id, isHome, autoUpdate)
{ {
setup(); PostedItem::setup();
} }
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId& post_id, bool isHome, bool autoUpdate) : PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId& post_id, bool isHome, bool autoUpdate) :
BasePostedItem(feedHolder, feedId, groupId, post_id, isHome, autoUpdate) BasePostedItem(feedHolder, feedId, groupId, post_id, isHome, autoUpdate)
{ {
setup(); PostedItem::setup();
loadGroup(); PostedItem::loadGroup();
} }
@ -498,8 +499,7 @@ void PostedItem::fill()
ui->thumbnailLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png")); ui->thumbnailLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"));
ui->fromLabel->setId(mPost.mMeta.mAuthorId); ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ; ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime; QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
ui->dateLabel->setText(timestamp); ui->dateLabel->setText(timestamp);
} else { } else {
@ -514,8 +514,7 @@ void PostedItem::fill()
ui->thumbnailLabel->setFixedSize(desired_width,desired_height); ui->thumbnailLabel->setFixedSize(desired_width,desired_height);
QDateTime qtime; QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs); QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
ui->dateLabel->setText(timestamp2); ui->dateLabel->setText(timestamp2);

View file

@ -24,7 +24,7 @@
#include <QMetaType> #include <QMetaType>
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include "gui/gxs/GxsFeedItem.h" #include "gui/feeds/GxsFeedItem.h"
namespace Ui { namespace Ui {
class PostedItem; class PostedItem;

View file

@ -37,14 +37,15 @@
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "gui/common/RSTabWidget.h" #include "gui/common/RSTabWidget.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/RsGUIEventManager.h"
#include "gui/feeds/SubFileItem.h" #include "gui/feeds/SubFileItem.h"
#include "gui/notifyqt.h"
#include "gui/Identity/IdDialog.h" #include "gui/Identity/IdDialog.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "util/RsQtVersion.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
@ -288,7 +289,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(createMsg())); connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool))); connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
connect(ui->filter_LE, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString))); connect(ui->filter_LE, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged())); connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
/* add filter actions */ /* add filter actions */
ui->postsTree->setPlaceholderText(tr("No posts available in this board")); ui->postsTree->setPlaceholderText(tr("No posts available in this board"));
@ -417,7 +418,7 @@ void PostedListWidgetWithModel::updateShowLabel()
void PostedListWidgetWithModel::filterItems(QString text) void PostedListWidgetWithModel::filterItems(QString text)
{ {
QStringList lst = text.split(" ",QString::SkipEmptyParts) ; QStringList lst = text.split(" ",QtSkipEmptyParts) ;
uint32_t count; uint32_t count;
mPostedPostsModel->setFilter(lst,count) ; mPostedPostsModel->setFilter(lst,count) ;
@ -876,13 +877,15 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
QString sync_string; QString sync_string;
switch(current_sync_time) switch(current_sync_time)
{ {
case 5: sync_string = tr("5 days"); break; case 5: sync_string = tr("5 days"); break;
case 15: sync_string = tr("2 weeks"); break; case 15: sync_string = tr("2 weeks"); break;
case 30: sync_string = tr("1 month"); break; case 30: sync_string = tr("1 month"); break;
case 90: sync_string = tr("3 months"); break; case 90: sync_string = tr("3 months"); break;
case 180: sync_string = tr("6 months"); break; case 180: sync_string = tr("6 months"); break;
case 365: sync_string = tr("1 year"); break; case 365: sync_string = tr("1 year"); break;
case 0: sync_string = tr("indefinitly"); break; case 1095: sync_string = tr("3 years"); break;
case 1825: sync_string = tr("5 years"); break;
case 0: sync_string = tr("indefinitly"); break;
default: default:
sync_string = tr("Unknown"); sync_string = tr("Unknown");
} }
@ -939,196 +942,10 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
} }
ui->infoDistribution->setText(distrib_string); ui->infoDistribution->setText(distrib_string);
#ifdef TODO
ui->infoWidget->show();
ui->feedWidget->hide();
ui->fileWidget->hide();
//ui->feedToolButton->setEnabled(false);
//ui->fileToolButton->setEnabled(false);
#endif
} }
#ifdef TODO
int PostedListWidgetWithModel::viewMode()
{
if (ui->feedToolButton->isChecked()) {
return VIEW_MODE_FEEDS;
} else if (ui->fileToolButton->isChecked()) {
return VIEW_MODE_FILES;
}
/* Default */
return VIEW_MODE_FEEDS;
}
#endif
#ifdef TODO
/*static*/ bool PostedListWidgetWithModel::filterItem(FeedItem *feedItem, const QString &text, int filter)
{
GxsChannelPostItem *item = dynamic_cast<GxsChannelPostItem*>(feedItem);
if (!item) {
return true;
}
bool bVisible = text.isEmpty();
if (!bVisible)
{
switch(filter)
{
case FILTER_TITLE:
bVisible = item->getTitleLabel().contains(text,Qt::CaseInsensitive);
break;
case FILTER_MSG:
bVisible = item->getMsgLabel().contains(text,Qt::CaseInsensitive);
break;
case FILTER_FILE_NAME:
{
std::list<SubFileItem *> fileItems = item->getFileItems();
std::list<SubFileItem *>::iterator lit;
for(lit = fileItems.begin(); lit != fileItems.end(); ++lit)
{
SubFileItem *fi = *lit;
QString fileName = QString::fromUtf8(fi->FileName().c_str());
bVisible = (bVisible || fileName.contains(text,Qt::CaseInsensitive));
}
break;
}
default:
bVisible = true;
break;
}
}
return bVisible;
}
void PostedListWidget::createPostItemFromMetaData(const RsGxsMsgMetaData& meta,bool related)
{
GxsChannelPostItem *item = NULL;
RsGxsChannelPost post;
if(!meta.mOrigMsgId.isNull())
{
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
if(item)
{
post = feedItem->post();
ui->feedWidget->removeFeedItem(item) ;
post.mOlderVersions.insert(post.mMeta.mMsgId);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
return ;
}
}
if (related)
{
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
}
if (item)
{
item->setPost(post);
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
}
else
{
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
}
#ifdef TODO
ui->fileWidget->addFiles(post, related);
#endif
}
void PostedListWidget::createPostItem(const RsGxsChannelPost& post, bool related)
{
GxsChannelPostItem *item = NULL;
const RsMsgMetaData& meta(post.mMeta);
if(!meta.mOrigMsgId.isNull())
{
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
if(item)
{
std::set<RsGxsMessageId> older_versions(item->olderVersions()); // we make a copy because the item will be deleted
ui->feedWidget->removeFeedItem(item) ;
older_versions.insert(meta.mMsgId);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, false,older_versions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
return ;
}
}
if (related)
{
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
}
if (item)
{
item->setPost(post);
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
}
else
{
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, true);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
}
ui->fileWidget->addFiles(post, related);
}
void PostedListWidget::fillThreadCreatePost(const QVariant &post, bool related, int current, int count)
{
/* show fill progress */
if (count) {
ui->progressBar->setValue(current * ui->progressBar->maximum() / count);
}
if (!post.canConvert<RsGxsChannelPost>()) {
return;
}
createPostItem(post.value<RsGxsChannelPost>(), related);
}
#endif
void PostedListWidgetWithModel::blank() void PostedListWidgetWithModel::blank()
{ {
#ifdef TODO
ui->postButton->setEnabled(false);
ui->subscribeToolButton->setEnabled(false);
ui->channelName_LB->setText(tr("No Channel Selected"));
ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channels.png"));
ui->infoPosts->setText("");
ui->infoLastPost->setText("");
ui->infoAdministrator->setText("");
ui->infoDistribution->setText("");
ui->infoCreated->setText("");
ui->infoDescription->setText("");
mChannelPostsModel->clear();
mChannelPostFilesModel->clear();
ui->postDetails_TE->clear();
ui->postLogo_LB->hide();
ui->postName_LB->hide();
ui->postTime_LB->hide();
#endif
groupNameChanged(QString()); groupNameChanged(QString());
} }

View file

@ -25,7 +25,7 @@
#include "gui/common/RSComboBox.h" #include "gui/common/RSComboBox.h"
#endif #endif
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "util/QtVersion.h" #include "util/RsQtVersion.h"
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "retroshare/rsconfig.h" #include "retroshare/rsconfig.h"

View file

@ -54,7 +54,7 @@ class RSHumanReadableDelegate: public QAbstractItemDelegate
// This part of the code is copied from DLListDelegate.cpp // This part of the code is copied from DLListDelegate.cpp
// //
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
QVariant value = index.data(Qt::TextColorRole); QVariant value = index.data(Qt::ForegroundRole);
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) if(value.isValid() && qvariant_cast<QColor>(value).isValid())
option.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value)); option.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
@ -75,7 +75,7 @@ class RSHumanReadableDelegate: public QAbstractItemDelegate
} }
else else
{ {
value = index.data(Qt::BackgroundColorRole); value = index.data(Qt::BackgroundRole);
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) if(value.isValid() && qvariant_cast<QColor>(value).isValid())
painter->fillRect(option.rect, qvariant_cast<QColor>(value)); painter->fillRect(option.rect, qvariant_cast<QColor>(value));

View file

@ -825,7 +825,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
if (role == RetroshareDirModel::FileNameRole) /* end of FileNameRole */ if (role == RetroshareDirModel::FileNameRole) /* end of FileNameRole */
return QString::fromUtf8(details.name.c_str()) ; return QString::fromUtf8(details.name.c_str()) ;
if (role == Qt::TextColorRole) if (role == Qt::ForegroundRole)
{ {
if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull()) if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull())
return QVariant(QColor(Qt::green)) ; return QVariant(QColor(Qt::green)) ;

View file

@ -41,7 +41,6 @@
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentity.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <retroshare/rsnotify.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <QApplication> #include <QApplication>
@ -1758,7 +1757,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
} }
else else
{ {
ChatDialog* chatDialog = ChatDialog::getChat(chatId, Settings->getChatFlags()); ChatDialog* chatDialog = ChatDialog::getChat(chatId, (RsChatFlags)Settings->getChatFlags());
if (chatDialog) { if (chatDialog) {
chatroomFound.append(link.name()); chatroomFound.append(link.name());
} else { } else {

View file

@ -0,0 +1,741 @@
/*******************************************************************************
* gui/RsGUIEventManager.cpp *
* *
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
* *
* 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 <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "gui/common/FilesDefs.h"
#include <retroshare/rsgxsifacehelper.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsinit.h>
#include <util/rsdir.h>
#include <util/qtthreadsutils.h>
#include <retroshare-gui/RsAutoUpdatePage.h>
#include "rshare.h"
#include "MainWindow.h"
#include "toaster/OnlineToaster.h"
#include "toaster/MessageToaster.h"
#include "toaster/DownloadToaster.h"
#include "toaster/ChatToaster.h"
#include "toaster/GroupChatToaster.h"
#include "toaster/ChatLobbyToaster.h"
#include "toaster/FriendRequestToaster.h"
#include "toaster/ToasterItem.h"
#include "common/ToasterNotify.h"
#include "RsGUIEventManager.h"
#include "chat/ChatDialog.h"
#include "chat/ChatLobbyDialog.h"
#include "chat/ChatWidget.h"
#include "FriendsDialog.h"
#include "gui/settings/rsharesettings.h"
#include "SoundManager.h"
#include "retroshare/rsplugin.h"
#include <QInputDialog>
#include <QMessageBox>
//#include <QMutexLocker>
#include <QThread>
#include <QTimer>
/*****
* #define NOTIFY_DEBUG
****/
/*static*/ RsGUIEventManager *RsGUIEventManager::_instance = nullptr;
/*static*/ bool RsGUIEventManager::_disableAllToaster = false;
/*static*/ void RsGUIEventManager::Create ()
{
if (_instance == nullptr)
_instance = new RsGUIEventManager ();
}
/*static*/ RsGUIEventManager *RsGUIEventManager::getInstance ()
{
return _instance;
}
/*static*/ bool RsGUIEventManager::isAllDisable ()
{
return _disableAllToaster;
}
void RsGUIEventManager::SetDisableAll(bool bValue)
{
if (bValue!=_disableAllToaster)
{
_disableAllToaster=bValue;
emit disableAllChanged(bValue);
}
}
RsGUIEventManager::RsGUIEventManager() : cDialog(NULL)
{
runningToasterTimer = new QTimer(this);
connect(runningToasterTimer, SIGNAL(timeout()), this, SLOT(runningTick()));
runningToasterTimer->setInterval(10); // tick 100 times a second
runningToasterTimer->setSingleShot(true);
{
QMutexLocker m(&_mutex) ;
_enabled = false ;
}
#warning TODO: do we need a timer anymore??
// Catch all events that require toasters and
mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{
if(event->mType == RsEventType::SYSTEM
&& (dynamic_cast<const RsSystemEvent*>(event.get())->mEventCode == RsSystemEventCode::PASSWORD_REQUESTED
||dynamic_cast<const RsSystemEvent*>(event.get())->mEventCode == RsSystemEventCode::NEW_PLUGIN_FOUND))
sync_handleIncomingEvent(event);
else
RsQThreadUtils::postToObject([=](){ async_handleIncomingEvent(event); }, this );
}, mEventHandlerId); // No event type means we expect to catch all possible events
}
bool RsGUIEventManager::GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad)
{
RsAutoUpdatePage::lockAllEvents() ;
QString windowTitle;
if (title == "")
windowTitle = tr("Passphrase required");
else if (title == "AuthSSLimpl::SignX509ReqWithGPG()")
windowTitle = tr("You need to sign your node's certificate.");
else if (title == "p3IdService::service_CreateGroup()")
windowTitle = tr("You need to sign your forum/chatrooms identity.");
else
windowTitle = QString::fromStdString(title);
QString labelText = ( prev_is_bad ? QString("%1<br/><br/>").arg(tr("Wrong password !")) : QString() )
+ QString("<b>%1</b><br/>Profile: <i>%2</i>\n")
.arg( tr("Please enter your Retroshare passphrase")
, QString::fromUtf8(key_details.c_str()) );
QLineEdit::EchoMode textEchoMode = QLineEdit::Password;
bool modal = true;
bool sameThread = QThread::currentThread() == qApp->thread();
Gui_InputDialogReturn ret;
qRegisterMetaType<Gui_InputDialogReturn>("Gui_InputDialogReturn");
QMetaObject::invokeMethod( MainWindow::getInstance()
, "guiInputDialog"
, sameThread ? Qt::DirectConnection : Qt::BlockingQueuedConnection
, Q_RETURN_ARG(Gui_InputDialogReturn, ret)
, Q_ARG(QString, windowTitle)
, Q_ARG(QString, labelText)
, Q_ARG(QLineEdit::EchoMode, textEchoMode)
, Q_ARG(bool, modal)
);
//cancelled = false ;
RsAutoUpdatePage::unlockAllEvents() ;
if (ret.execReturn == QDialog::Rejected) {
RsLoginHelper::clearPgpPassphrase();
//cancelled = true ;
return true ;
}
if (ret.execReturn == QDialog::Accepted) {
auto password = ret.textValue.toUtf8().constData();
RsLoginHelper::cachePgpPassphrase(password);
return true;
}
RsLoginHelper::clearPgpPassphrase();
return false;
}
bool RsGUIEventManager::GUI_askForPluginConfirmation(const std::string& plugin_file_name, const RsFileHash& plugin_file_hash, bool first_time)
{
// By default, when no information is known about plugins, just dont load them. They will be enabled from the GUI by the user.
// Note: the code below is not running in the Qt thread, which is likely to cause a crash. If needed, we should use
// the same mechanism than GUI_askForPassword. As far as testing goes, it seems that because there is no other window running
// at the time plugin confirmation is required, this is not a problem for Qt.
if(first_time)
return false ;
RsAutoUpdatePage::lockAllEvents() ;
QMessageBox dialog;
dialog.setWindowTitle(tr("Unregistered plugin/executable"));
QString text ;
text += tr( "RetroShare has detected an unregistered plugin. This happens in two cases:<UL><LI>Your RetroShare executable has changed.</LI><LI>The plugin has changed</LI></UL>Click on Yes to authorize this plugin, or No to deny it. You can change your mind later in Options -> Plugins, then restart." ) ;
text += "<UL>" ;
text += "<LI>Hash:\t" + QString::fromStdString(plugin_file_hash.toStdString()) + "</LI>" ;
text += "<LI>File:\t" + QString::fromStdString(plugin_file_name) + "</LI>";
text += "</UL>" ;
dialog.setText(text) ;
dialog.setWindowIcon(FilesDefs::getIconFromQtResourcePath(":/icons/logo_128.png"));
dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No) ;
int ret = dialog.exec();
RsAutoUpdatePage::unlockAllEvents() ;
if (ret == QMessageBox::Yes)
{
rsPlugins->enablePlugin(plugin_file_hash);
return true;
}
else
{
rsPlugins->disablePlugin(plugin_file_hash);
return false;
}
}
void RsGUIEventManager::enable()
{
QMutexLocker m(&_mutex) ;
std::cerr << "Enabling notification system" << std::endl;
_enabled = true ;
}
void RsGUIEventManager::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
auto ev6 = dynamic_cast<const RsSystemEvent*>(event.get());
if(ev6->mEventCode == RsSystemEventCode::PASSWORD_REQUESTED)
GUI_askForPassword(ev6->passwd_request_title, ev6->passwd_request_key_details, ev6->passwd_request_prev_is_bad);
else if(ev6->mEventCode == RsSystemEventCode::NEW_PLUGIN_FOUND)
GUI_askForPluginConfirmation(ev6->plugin_file_name, ev6->plugin_file_hash, ev6->plugin_first_time);
}
void RsGUIEventManager::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
/* Finally Check for PopupMessages / System Error Messages */
RsNotifyPopupFlags popupflags = (RsNotifyPopupFlags)Settings->getNotifyFlags();
auto insertToaster = [this](ToasterItem *toaster) {
/* init attributes */
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
/* add toaster to waiting list */
waitingToasterList.push_back(toaster);
};
// check for all possibly handled events
auto ev1 = dynamic_cast<const RsMailStatusEvent*>(event.get());
if(ev1)
{
if(ev1->mMailStatusEventCode == RsMailStatusEventCode::NEW_MESSAGE)
{
SoundManager::play(SOUND_MESSAGE_ARRIVED);
if((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_MSG)) && !_disableAllToaster)
{
for(auto msgid:ev1->mChangedMsgIds)
{
Rs::Msgs::MessageInfo msgInfo;
if(rsMsgs->getMessage(msgid, msgInfo))
insertToaster(new ToasterItem(new MessageToaster(msgInfo.from.toStdString(), QString::fromUtf8(msgInfo.title.c_str()), QString::fromUtf8(msgInfo.msg.c_str()))));
}
}
}
return;
}
auto ev2 = dynamic_cast<const RsFriendListEvent*>(event.get());
if(ev2)
{
if(ev2->mEventCode == RsFriendListEventCode::NODE_CONNECTED)
{
SoundManager::play(SOUND_USER_ONLINE);
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT)) && !_disableAllToaster)
insertToaster(new ToasterItem(new OnlineToaster(ev2->mSslId)));
}
return;
}
auto ev3 = dynamic_cast<const RsFileTransferEvent*>(event.get());
if(ev3)
{
if(ev3->mFileTransferEventCode == RsFileTransferEventCode::DOWNLOAD_COMPLETE)
{
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_DOWNLOAD)) && !_disableAllToaster)
insertToaster(new ToasterItem(new DownloadToaster(ev3->mHash)));
}
return;
}
auto ev4 = dynamic_cast<const RsAuthSslConnectionAutenticationEvent*>(event.get());
if(ev4)
{
if(ev4->mErrorCode == RsAuthSslError::NOT_A_FRIEND)
{
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT)) && !_disableAllToaster)
// id = gpgid
// title = ssl name
// msg = peer id
insertToaster(new ToasterItem(new FriendRequestToaster(ev4->mPgpId, ev4->mSslId)));
}
return;
}
auto ev5 = dynamic_cast<const RsChatServiceEvent*>(event.get());
if(ev5)
{
// This code below should be simplified. In particular GroupChatToaster, ChatToaster and ChatLobbyToaster should be only one class.
if(ev5->mEventCode == RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED)
{
if (ev5->mCid.isPeerId() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CHAT)) && !_disableAllToaster)
{
// TODO: fix for distant chat, look up if dstant chat uses RS_POPUP_CHAT
ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid);
ChatWidget *chatWidget;
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) // do not show when active
return;
insertToaster(new ToasterItem(new ChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str()))));
}
#ifdef RS_DIRECT_CHAT
else if (ev5->mCid.isBroadcast() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_GROUPCHAT)) && !_disableAllToaster)
{
MainWindow *mainWindow = MainWindow::getInstance();
if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized()
&& (MainWindow::getActivatePage() == MainWindow::Friends) && (FriendsDialog::isGroupChatActive()))
return;
insertToaster(new ToasterItem(new GroupChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str()))));
}
#endif
else if (ev5->mCid.isLobbyId() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CHATLOBBY)) && !_disableAllToaster)
{
ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid);
ChatWidget *chatWidget;
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive())
return;
ChatLobbyDialog *chatLobbyDialog = dynamic_cast<ChatLobbyDialog*>(chatDialog);
if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(ev5->mMsg.lobby_peer_gxs_id))
return;
insertToaster(new ToasterItem(new ChatLobbyToaster(ev5->mCid.toLobbyId(), ev5->mMsg.lobby_peer_gxs_id, QString::fromUtf8(ev5->mMsg.msg.c_str()))));
}
else
return;
}
return;
}
auto ev6 = dynamic_cast<const RsSystemEvent*>(event.get());
if(ev6)
{
switch(ev6->mEventCode)
{
case RsSystemEventCode::TIME_SHIFT_PROBLEM:
displayErrorMessage(RsNotifySysFlags::RS_SYS_WARNING,tr("System time mismatch"),tr("Time shift problem notification. Make sure your machine is on time, because it will break chat rooms."));
break;
case RsSystemEventCode::DISK_SPACE_ERROR:
displayDiskSpaceWarning(ev6->mDiskErrorLocation,ev6->mDiskErrorSizeLimit);
break;
case RsSystemEventCode::DATA_STREAMING_ERROR:
case RsSystemEventCode::GENERAL_ERROR:
displayErrorMessage(RsNotifySysFlags::RS_SYS_WARNING,tr("Internal error"),QString::fromUtf8(ev6->mErrorMsg.c_str()));
break;
default: break;
}
return;
};
/*Now check Plugins*/
if(rsPlugins) // rsPlugins may not be initialized yet if we're handlign TorManager events.
{
int pluginCount = rsPlugins->nbPlugins();
for (int i = 0; i < pluginCount; ++i) {
RsPlugin *rsPlugin = rsPlugins->plugin(i);
if (rsPlugin) {
ToasterNotify *toasterNotify = rsPlugin->qt_toasterNotify();
if (toasterNotify) {
insertToaster(toasterNotify->toasterItem());
continue;
}
}
}
}
/* Now start the waiting toasters */
startWaitingToasters();
}
void RsGUIEventManager::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{
QString title = tr("Test");
QString message = tr("This is a test.");
RsPeerId id = rsPeers->getOwnId();
RsPgpId pgpid = rsPeers->getGPGOwnId();
uint pos = 0;
uint nf = (uint)notifyFlags;
while (nf) {
uint type = nf & (1 << pos);
nf &= ~(1 << pos);
++pos;
ToasterItem *toaster = NULL;
switch(type)
{
case (int)RsNotifyPopupFlags::RS_POPUP_ENCRYPTED_MSG:
toaster = new ToasterItem(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message"))));
break;
case (int)RsNotifyPopupFlags::RS_POPUP_MSG:
toaster = new ToasterItem(new MessageToaster(id.toStdString(), title, message));
break;
case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT:
toaster = new ToasterItem(new OnlineToaster(id));
break;
case (int)RsNotifyPopupFlags::RS_POPUP_DOWNLOAD:
toaster = new ToasterItem(new DownloadToaster(RsFileHash::random()));
break;
case (int)RsNotifyPopupFlags::RS_POPUP_CHAT:
toaster = new ToasterItem(new ChatToaster(id, message));
break;
case (int)RsNotifyPopupFlags::RS_POPUP_GROUPCHAT:
#ifdef RS_DIRECT_CHAT
toaster = new ToasterItem(new GroupChatToaster(id, message));
#endif // RS_DIRECT_CHAT
break;
case (int)RsNotifyPopupFlags::RS_POPUP_CHATLOBBY:
{
std::list<RsGxsId> gxsid;
if(rsIdentity->getOwnIds(gxsid) && (gxsid.size() > 0)){
toaster = new ToasterItem(new ChatLobbyToaster(0, gxsid.front(), message));
}
break;
}
case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT:
toaster = new ToasterItem(new FriendRequestToaster(pgpid, id));
break;
}
if (toaster) {
/* init attributes */
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
toaster->position = (RshareSettings::enumToasterPosition) position;
toaster->margin = margin;
/* add toaster to waiting list */
waitingToasterList.push_back(toaster);
}
}
}
void RsGUIEventManager::testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{
if (!toasterNotify) {
return;
}
ToasterItem *toaster = toasterNotify->testToasterItem();
if (toaster) {
/* init attributes */
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
toaster->position = (RshareSettings::enumToasterPosition) position;
toaster->margin = margin;
/* add toaster to waiting list */
//QMutexLocker lock(&waitingToasterMutex);
waitingToasterList.push_back(toaster);
}
}
void RsGUIEventManager::testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{
if (!toasterNotify) {
return;
}
ToasterItem *toaster = toasterNotify->testToasterItem(tag);
if (toaster) {
/* init attributes */
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
toaster->position = (RshareSettings::enumToasterPosition) position;
toaster->margin = margin;
/* add toaster to waiting list */
waitingToasterList.push_back(toaster);
}
}
void RsGUIEventManager::notifyChatFontChanged()
{
{
QMutexLocker m(&_mutex) ;
if(!_enabled)
return ;
}
emit chatFontChanged();
}
void RsGUIEventManager::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType)
{
{
QMutexLocker m(&_mutex) ;
if(!_enabled)
return ;
}
emit chatStyleChanged(styleType);
}
void RsGUIEventManager::notifySettingsChanged()
{
emit settingsChanged();
}
void RsGUIEventManager::startWaitingToasters()
{
{
if (waitingToasterList.empty()) {
/* No toasters are waiting */
return;
}
}
{
if (runningToasterList.size() >= 3) {
/* Don't show more than 3 toasters at once */
return;
}
}
ToasterItem *toaster = NULL;
{
if (waitingToasterList.size()) {
/* Take one toaster of the waiting list */
toaster = waitingToasterList.front();
waitingToasterList.pop_front();
}
}
if (toaster) {
/* Calculate positions */
QSize size = toaster->widget->size();
QRect desktopGeometry = RsApplication::primaryScreenGeometry();
switch (toaster->position) {
case RshareSettings::TOASTERPOS_TOPLEFT:
toaster->startPos = QPoint(desktopGeometry.left() + toaster->margin.x(), desktopGeometry.top() - size.height());
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + toaster->margin.y());
break;
case RshareSettings::TOASTERPOS_TOPRIGHT:
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - toaster->margin.x(), desktopGeometry.top() - size.height());
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + toaster->margin.y());
break;
case RshareSettings::TOASTERPOS_BOTTOMLEFT:
toaster->startPos = QPoint(desktopGeometry.left() + toaster->margin.x(), desktopGeometry.bottom());
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - toaster->margin.y());
break;
case RshareSettings::TOASTERPOS_BOTTOMRIGHT: // default
default:
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - toaster->margin.x(), desktopGeometry.bottom());
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - toaster->margin.y());
break;
}
/* Initialize widget */
toaster->widget->move(toaster->startPos);
/* Initialize toaster */
toaster->elapsedTimeToShow = 0;
toaster->elapsedTimeToLive = 0;
toaster->elapsedTimeToHide = 0;
/* Add toaster to the running list */
runningToasterList.push_front(toaster);
if (runningToasterTimer->isActive() == false) {
/* Start the toaster timer */
runningToasterTimer->start();
}
}
}
void RsGUIEventManager::runningTick()
{
//QMutexLocker lock(&runningToasterMutex);
int interval = runningToasterTimer->interval();
QPoint diff;
QList<ToasterItem*>::iterator it = runningToasterList.begin();
while (it != runningToasterList.end()) {
ToasterItem *toaster = *it;
bool visible = true;
if (toaster->elapsedTimeToShow) {
/* Toaster is started, check for visible */
visible = toaster->widget->isVisible();
}
QPoint newPos;
enum { NOTHING, SHOW, HIDE } operation = NOTHING;
if (visible && toaster->elapsedTimeToShow <= toaster->timeToShow) {
/* Toaster is showing */
if (toaster->elapsedTimeToShow == 0) {
/* Toaster is not visible, show it now */
operation = SHOW;
}
toaster->elapsedTimeToShow += interval;
newPos = QPoint(toaster->startPos.x() - (toaster->startPos.x() - toaster->endPos.x()) * toaster->elapsedTimeToShow / toaster->timeToShow,
toaster->startPos.y() - (toaster->startPos.y() - toaster->endPos.y()) * toaster->elapsedTimeToShow / toaster->timeToShow);
} else if (visible && toaster->elapsedTimeToLive <= toaster->timeToLive) {
/* Toaster is living */
toaster->elapsedTimeToLive += interval;
newPos = toaster->endPos;
} else if (visible && toaster->elapsedTimeToHide <= toaster->timeToHide) {
/* Toaster is hiding */
toaster->elapsedTimeToHide += interval;
if (toaster->elapsedTimeToHide == toaster->timeToHide) {
/* Toaster is back at the start position, hide it */
operation = HIDE;
}
newPos = QPoint(toaster->startPos.x() - (toaster->startPos.x() - toaster->endPos.x()) * (toaster->timeToHide - toaster->elapsedTimeToHide) / toaster->timeToHide,
toaster->startPos.y() - (toaster->startPos.y() - toaster->endPos.y()) * (toaster->timeToHide - toaster->elapsedTimeToHide) / toaster->timeToHide);
} else {
/* Toaster is hidden, delete it */
it = runningToasterList.erase(it);
//delete(toaster->widget);
delete(toaster);
continue;
}
toaster->widget->move(newPos + diff);
diff += newPos - toaster->startPos;
QRect mask = QRect(0, 0, toaster->widget->width(), qAbs(toaster->startPos.y() - newPos.y()));
if (newPos.y() > toaster->startPos.y()) {
/* Toaster is moving from top */
mask.moveTop(toaster->widget->height() - (newPos.y() - toaster->startPos.y()));
}
toaster->widget->setMask(QRegion(mask));
switch (operation) {
case NOTHING:
break;
case SHOW:
toaster->widget->show();
break;
case HIDE:
toaster->widget->hide();
break;
}
++it;
}
if (runningToasterList.size()) {
/* There are more running toasters, start the timer again */
runningToasterTimer->start();
}
}
void RsGUIEventManager::displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg)
{
/* make a warning message */
switch(type)
{
case RsNotifySysFlags::RS_SYS_ERROR: QMessageBox::critical(MainWindow::getInstance(),title,error_msg);
break;
case RsNotifySysFlags::RS_SYS_WARNING: QMessageBox::warning(MainWindow::getInstance(),title,error_msg);
break;
case RsNotifySysFlags::RS_SYS_INFO: QMessageBox::information(MainWindow::getInstance(),title,error_msg);
break;
default: std::cerr << "Warning: unhandled system error type " << type << std::endl;
break;
}
}
void RsGUIEventManager::displayDiskSpaceWarning(int loc,int size_limit_mb)
{
QString locString ;
switch(loc)
{
case RS_PARTIALS_DIRECTORY: locString = "Partials" ;
break ;
case RS_CONFIG_DIRECTORY: locString = "Config" ;
break ;
case RS_DOWNLOAD_DIRECTORY: locString = "Download" ;
break ;
default:
std::cerr << "Error: " << __PRETTY_FUNCTION__ << " was called with an unknown parameter loc=" << loc << std::endl ;
return ;
}
QMessageBox::critical(NULL,tr("Low disk space warning"),
tr("The disk space in your")+" "+locString +" "+tr("directory is running low (current limit is")+" "+QString::number(size_limit_mb)+tr("MB). \n\n RetroShare will now safely suspend any disk access to this directory. \n\n Please make some free space and click Ok.")) ;
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* gui/NotifyQt.h * * gui/RsGUIEventManager.h *
* * * *
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> * * Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
* * * *
@ -23,13 +23,14 @@
#include <retroshare/rsiface.h> #include <retroshare/rsiface.h>
#include <retroshare/rsturtle.h> #include <retroshare/rsturtle.h>
#include <retroshare/rsnotify.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <QObject> #include <QObject>
#include <QMutex> #include <QMutex>
#include <QPoint> #include <QPoint>
//#include <QMutex> //#include <QMutex>
#include "settings/rsharesettings.h"
#include <string> #include <string>
class QTimer; class QTimer;
@ -47,92 +48,40 @@ class SignatureEventData ;
struct TurtleFileInfo; struct TurtleFileInfo;
struct TurtleGxsInfo; struct TurtleGxsInfo;
class NotifyQt: public QObject, public NotifyClient class RsGUIEventManager: public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static NotifyQt *Create (); static void Create();
static NotifyQt *getInstance (); static RsGUIEventManager *getInstance ();
static bool isAllDisable(); static bool isAllDisable();
void enable() ; void enable() ;
virtual ~NotifyQt() = default; virtual ~RsGUIEventManager() = default;
void setNetworkDialog(NetworkDialog *c) { cDialog = c; } virtual bool GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad);
virtual bool GUI_askForPluginConfirmation(const std::string& plugin_filename, const RsFileHash& plugin_file_hash,bool first_time);
virtual void notifyListPreChange(int list, int type);
virtual void notifyListChange(int list, int type);
virtual void notifyErrorMsg(int list, int sev, std::string msg);
virtual void notifyChatMessage(const ChatMessage& /* msg */);
virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string);
virtual void notifyChatCleared(const ChatId &chat_id);
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
#ifdef TO_REMOVE
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
#endif
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
virtual void notifyOwnAvatarChanged() ;
virtual void notifyChatLobbyEvent(uint64_t /* lobby id */, uint32_t /* event type */, const RsGxsId & /*nickname*/, const std::string& /* any string */) ;
virtual void notifyChatLobbyTimeShift(int time_shift) ;
virtual void notifyOwnStatusMessageChanged() ;
virtual void notifyDiskFull(uint32_t loc,uint32_t size_in_mb) ;
/* peer has changed the state */
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary();
virtual void notifyHistoryChanged(uint32_t msgId, int type);
virtual void notifyDiscInfoChanged() ;
virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash,bool first_time);
/* Notify from GUI */ /* Notify from GUI */
void notifyChatFontChanged(); void notifyChatFontChanged();
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType); void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
void testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin); void testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin); void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin); void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
#ifdef TO_REMOVE
void addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg); void addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg);
#endif
void notifySettingsChanged(); void notifySettingsChanged();
signals: signals:
// It's beneficial to send info to the GUI using signals, because signals are thread-safe // It's beneficial to send info to the GUI using signals, because signals are thread-safe
// as they get queued by Qt. // as they get queued by Qt.
// //
void hashingInfoChanged(const QString&) const ;
void filesPreModChanged(bool) const ;
void filesPostModChanged(bool) const ;
void transfersChanged() const ;
void friendsChanged() const ;
void lobbyListChanged() const ;
void chatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&) ;
void neighboursChanged() const ;
void configChanged() const ; void configChanged() const ;
void logInfoChanged(const QString&) const ; void logInfoChanged(const QString&) const ;
void chatStatusChanged(const ChatId&,const QString&) const ;
void chatCleared(const ChatId&) const ; void chatCleared(const ChatId&) const ;
void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ;
void peerHasNewAvatar(const QString& peer_id) const ;
void ownAvatarChanged() const ;
void ownStatusMessageChanged() const ;
void errorOccurred(int,int,const QString&) const ;
void diskFull(int,int) const ;
void peerStatusChanged(const QString& /* peer_id */, int /* status */);
void peerStatusChangedSummary() const;
void gxsChange(const RsGxsChanges& /* changes */);
void chatMessageReceived(ChatMessage msg);
void groupsChanged(int type) const ;
void discInfoChanged() const ;
void historyChanged(uint msgId, int type); void historyChanged(uint msgId, int type);
void chatLobbyInviteReceived() ;
void deferredSignatureHandlingRequested() ;
void chatLobbyTimeShift(int time_shift) ;
void connectionWithoutCert();
/* Notify from GUI */ /* Notify from GUI */
void chatFontChanged(); void chatFontChanged();
@ -141,25 +90,24 @@ class NotifyQt: public QObject, public NotifyClient
void disableAllChanged(bool disableAll) const; void disableAllChanged(bool disableAll) const;
public slots: public slots:
void UpdateGUI(); /* called by timer */
void SetDisableAll(bool bValue); void SetDisableAll(bool bValue);
private slots: private slots:
void runningTick(); void runningTick();
void handleSignatureEvent() ;
void handleChatLobbyTimeShift(int) ;
private: private:
NotifyQt(); RsGUIEventManager();
static NotifyQt *_instance; static void displayDiskSpaceWarning(int loc,int size_limit_mb);
static void displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg);
static RsGUIEventManager *_instance;
static bool _disableAllToaster; static bool _disableAllToaster;
/* system notifications */ /* system notifications */
void startWaitingToasters(); void startWaitingToasters();
// QMutex waitingToasterMutex; // for lock of the waiting toaster list
QList<ToasterItem*> waitingToasterList; QList<ToasterItem*> waitingToasterList;
QTimer *runningToasterTimer; QTimer *runningToasterTimer;
@ -172,6 +120,11 @@ class NotifyQt: public QObject, public NotifyClient
/* so we can update windows */ /* so we can update windows */
NetworkDialog *cDialog; NetworkDialog *cDialog;
void async_handleIncomingEvent(std::shared_ptr<const RsEvent> e);
void sync_handleIncomingEvent(std::shared_ptr<const RsEvent> e);
RsEventsHandlerId_t mEventHandlerId;
}; };
#endif #endif

View file

@ -35,9 +35,9 @@
#include "gui/common/GroupFlagsWidget.h" #include "gui/common/GroupFlagsWidget.h"
#include "gui/common/GroupSelectionBox.h" #include "gui/common/GroupSelectionBox.h"
#include "gui/common/GroupDefs.h" #include "gui/common/GroupDefs.h"
#include "gui/notifyqt.h" #include "util/RsQtVersion.h"
#include "util/QtVersion.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/qtthreadsutils.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
/* Images for context menu icons */ /* Images for context menu icons */
@ -73,7 +73,21 @@ ShareManager::ShareManager()
connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int))); connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int)));
connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int))); connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(reload())); mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
{
RsQThreadUtils::postToObject([=]()
{
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
if(!fe)
return;
reload();
}
, this );
}, mEventHandlerId, RsEventType::FRIEND_LIST );
QHeaderView* header = ui.shareddirList->horizontalHeader(); QHeaderView* header = ui.shareddirList->horizontalHeader();
QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch); QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch);
@ -152,6 +166,7 @@ ShareManager::~ShareManager()
{ {
_instance = NULL; _instance = NULL;
rsEvents->unregisterEventsHandler(mEventHandlerId);
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
} }
@ -242,7 +257,7 @@ void ShareManager::load()
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget); listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ; listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ; listWidget->item(row,COLUMN_GROUPS)->setBackground(QColor(183,236,181)) ;
connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ; connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;

View file

@ -77,6 +77,7 @@ private:
Ui::ShareManager ui; Ui::ShareManager ui;
std::vector<SharedDirInfo> mDirInfos ; std::vector<SharedDirInfo> mDirInfos ;
RsEventsHandlerId_t mEventHandlerId;
}; };
#endif #endif

Some files were not shown because too many files have changed in this diff Show more