mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge branch 'RetroShare:master' into new_token_service
This commit is contained in:
commit
74e0692f69
2
.gitignore
vendored
2
.gitignore
vendored
@ -21,7 +21,7 @@ Thumbs.db
|
||||
!supportlibs/libsam3/Makefile
|
||||
|
||||
# QtCreator cruft
|
||||
*CMakeLists.txt.user
|
||||
*CMakeLists.txt.user*
|
||||
|
||||
# Build artifacts
|
||||
/jsonapi-generator/src/jsonapi-generator
|
||||
|
@ -1,7 +1,7 @@
|
||||
image: docker:stable
|
||||
image: docker:latest
|
||||
|
||||
services:
|
||||
- docker:stable-dind
|
||||
- docker:dind
|
||||
|
||||
stages:
|
||||
- build
|
||||
@ -18,6 +18,7 @@ variables:
|
||||
build-ubuntu-test-image:
|
||||
stage: build
|
||||
script:
|
||||
- docker --version
|
||||
- >
|
||||
docker login "$CI_REGISTRY"
|
||||
--username "$CI_REGISTRY_USER"
|
||||
@ -35,6 +36,7 @@ build-ubuntu-test-image:
|
||||
test-ubuntu:
|
||||
stage: test
|
||||
script:
|
||||
- docker --version
|
||||
- >
|
||||
docker login "$CI_REGISTRY"
|
||||
--username "$CI_REGISTRY_USER"
|
||||
|
7
.gitmodules
vendored
7
.gitmodules
vendored
@ -10,7 +10,8 @@
|
||||
[submodule "supportlibs/udp-discovery-cpp"]
|
||||
path = supportlibs/udp-discovery-cpp
|
||||
url = https://github.com/truvorskameikin/udp-discovery-cpp.git
|
||||
branch = develop
|
||||
branch = master
|
||||
# develop branch was removed we were using it at commit f3a3103a6c52e5707629e8d0a7e279a7758fe845
|
||||
[submodule "supportlibs/rapidjson"]
|
||||
path = supportlibs/rapidjson
|
||||
url = https://github.com/Tencent/rapidjson.git
|
||||
@ -30,8 +31,8 @@
|
||||
branch = master
|
||||
[submodule "libretroshare"]
|
||||
path = libretroshare
|
||||
url = ../libretroshare
|
||||
url = https://github.com/RetroShare/libretroshare.git
|
||||
branch = master
|
||||
[submodule "retroshare-webui"]
|
||||
path = retroshare-webui
|
||||
url = ../RSNewWebUI
|
||||
url = https://github.com/RetroShare/RSNewWebUI.git
|
||||
|
@ -40,18 +40,23 @@ RUN git clone --depth 1 https://github.com/aetilius/pHash.git && \
|
||||
rm -rf pHash-build pHash
|
||||
|
||||
ARG FRESHCLONE=0
|
||||
ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
|
||||
ARG REPO_URL=https://github.com/RetroShare/RetroShare.git
|
||||
ARG REPO_BRANCH=master
|
||||
ARG REPO_DEPTH="--depth 2000"
|
||||
RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \
|
||||
RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && \
|
||||
cd RetroShare && \
|
||||
git fetch --tags && \
|
||||
git submodule update --init --remote --force \
|
||||
libbitdht/ libretroshare/ openpgpsdk/ && \
|
||||
cd ..
|
||||
git submodule update --init \
|
||||
libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ \
|
||||
supportlibs/restbed/ && \
|
||||
cd supportlibs/restbed/ && \
|
||||
git submodule update --init \
|
||||
dependency/asio/ dependency/kashmir/ && \
|
||||
cd ../../../
|
||||
|
||||
RUN \
|
||||
mkdir RetroShare-build && cd RetroShare-build && \
|
||||
cmake -B. -S../RetroShare/retroshare-service \
|
||||
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON && \
|
||||
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON && \
|
||||
make -j$(nproc) && make install && \
|
||||
cd .. && rm -rf RetroShare-build
|
||||
|
@ -2,19 +2,19 @@ FROM registry.gitlab.com/retroshare/retroshare:base
|
||||
|
||||
RUN apt-get update -y && apt-get upgrade -y
|
||||
|
||||
ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
|
||||
ARG REPO_URL=https://github.com/RetroShare/RetroShare.git
|
||||
ARG REPO_BRANCH=master
|
||||
RUN \
|
||||
cd RetroShare && git remote add testing $REPO_URL && \
|
||||
git fetch --tags testing $REPO_BRANCH && \
|
||||
git reset --hard testing/$REPO_BRANCH && \
|
||||
git submodule update --init --remote --force \
|
||||
libbitdht/ libretroshare/ openpgpsdk/ && \
|
||||
git submodule update --init \
|
||||
libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ && \
|
||||
git --no-pager log --max-count 1
|
||||
RUN \
|
||||
mkdir RetroShare-build && cd RetroShare-build && \
|
||||
cmake -B. -S../RetroShare/retroshare-service \
|
||||
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON \
|
||||
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON \
|
||||
-DRS_WARN_DEPRECATED=OFF -DRS_WARN_LESS=ON && \
|
||||
make -j$(nproc) && make install && \
|
||||
cd .. && rm -rf RetroShare-build
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit df16cb915465d058c75277678799ce4dadeae287
|
||||
Subproject commit 97a75f2f098babf2f6498f01ff9119aa35ce9a28
|
@ -30,13 +30,36 @@ In GitHub Desktop -> Clone Repository -> URL
|
||||
|
||||
Add Repository URL: https://github.com/RetroShare/RetroShare.git and Clone
|
||||
|
||||
## ***Get XCode & MacOSX SDK***
|
||||
|
||||
Install XCode following this guide: [XCode](http://guide.macports.org/#installing.xcode)
|
||||
|
||||
To identify the correct version of Xcode to install, you need to know which OS you are running. Go to the [x] menu -> "About This Mac" and read the macOS version number.
|
||||
|
||||
If you are running the macOS Catalina >= 10.15, you can install Xcode directly from App Store using the instructions below.
|
||||
|
||||
You can find older versions of Xcode at [Apple Developer Downloads](https://developer.apple.com/downloads/). Find the appropriate .xip file for your macOS version
|
||||
|
||||
To install from App Store:
|
||||
|
||||
Select [x] menu - > "App Store…".
|
||||
Search for Xcode. Download and install.
|
||||
|
||||
Once Xcode has installed, you must drag the XCode icon into your Applications folder. After you have done this, open Xcode from the Applications folder by double-clicking on the icon and then follow the remaining instructions below.
|
||||
|
||||
Install XCode command line developer tools:
|
||||
|
||||
$xcode-select --install
|
||||
|
||||
Start XCode to get it updated and to able C compiler to create executables.
|
||||
|
||||
Get Your MacOSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
|
||||
|
||||
## ***Choose if you use MacPort or HomeBrew***
|
||||
|
||||
### MacPort Installation
|
||||
|
||||
Install MacPort and XCode following this guide: [MacPort and XCode](http://guide.macports.org/#installing.xcode)
|
||||
|
||||
Start XCode to get it updated and to able C compiler to create executables.
|
||||
Install MacPort following this guide: [MacPort](http://guide.macports.org/#installing.xcode)
|
||||
|
||||
#### Install libraries
|
||||
|
||||
@ -51,18 +74,11 @@ For VOIP Plugin:
|
||||
$ sudo port install opencv
|
||||
$ sudo port install ffmpeg
|
||||
|
||||
Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
|
||||
|
||||
### HOMEBREW Installation
|
||||
|
||||
Install HomeBrew following this guide: [HomeBrew](http://brew.sh/)
|
||||
|
||||
Install XCode command line developer tools:
|
||||
|
||||
$xcode-select --install
|
||||
|
||||
Start XCode to get it updated and to able C compiler to create executables.
|
||||
|
||||
#### Install libraries
|
||||
|
||||
$ brew install openssl
|
||||
@ -86,7 +102,6 @@ For FeedReader Plugin:
|
||||
|
||||
$ brew install libxslt
|
||||
|
||||
Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
|
||||
|
||||
## Last Settings
|
||||
|
||||
@ -104,11 +119,8 @@ In QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additiona
|
||||
|
||||
## Set your Mac OS SDK version
|
||||
|
||||
Edit RetroShare.pro
|
||||
|
||||
CONFIG += c++14 rs_macos11.1
|
||||
|
||||
and then retroshare.pri
|
||||
Edit retroshare.pri and set your installed sdk version example for 11.1 -> rs_macos11.1 (line 135:)
|
||||
|
||||
macx:CONFIG *= rs_macos11.1
|
||||
rs_macos10.8:CONFIG -= rs_macos11.1
|
||||
@ -122,7 +134,7 @@ and then retroshare.pri
|
||||
|
||||
## Link Include & Libraries
|
||||
|
||||
Edit your retroshare.pri and add to macx-* section
|
||||
When required edit your retroshare.pri macx-* section, check if the Include and Lib path are correct (macx-* section)
|
||||
|
||||
INCLUDEPATH += "/usr/local/opt/openssl/include"
|
||||
QMAKE_LIBDIR += "/usr/local/opt/openssl/lib"
|
||||
@ -131,13 +143,18 @@ Edit your retroshare.pri and add to macx-* section
|
||||
|
||||
alternative via Terminal
|
||||
|
||||
$ qmake INCLUDEPATH+="/usr/local/opt/openssl/include" QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" QMAKE_LIBDIR+="/usr/local/opt/sqlcipher/lib" QMAKE_LIBDIR+="/usr/local/opt/miniupnpc/lib"
|
||||
$ qmake
|
||||
INCLUDEPATH+="/usr/local/opt/openssl/include" \
|
||||
QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" \
|
||||
QMAKE_LIBDIR+="/usr/local/opt/sqlcipher/lib" \
|
||||
QMAKE_LIBDIR+="/usr/local/opt/miniupnpc/lib" \
|
||||
CONFIG+=rs_autologin \
|
||||
CONFIG+=rs_use_native_dialogs \
|
||||
CONFIG+=release \
|
||||
..
|
||||
|
||||
For FeedReader Plugin:
|
||||
|
||||
INCLUDEPATH += "/usr/local/opt/libxml2/include/libxml2"
|
||||
|
||||
For building RetroShare with plugins:
|
||||
With plugins:
|
||||
|
||||
$ qmake \
|
||||
INCLUDEPATH+="/usr/local/opt/openssl/include" QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" \
|
||||
@ -159,13 +176,30 @@ For building RetroShare with plugins:
|
||||
|
||||
You can now compile RetroShare into Qt Creator or with Terminal
|
||||
|
||||
cd retroshare
|
||||
qmake; make
|
||||
$ cd /path/to/retroshare
|
||||
$ qmake ..
|
||||
$ make
|
||||
|
||||
You can change Target and SDK in *./retroshare.pri:82* changing value of QMAKE_MACOSX_DEPLOYMENT_TARGET and QMAKE_MAC_SDK
|
||||
|
||||
You can find the compiled application at *./retroshare/retroshare-gui/src/retroshare.app*
|
||||
|
||||
## Issues
|
||||
|
||||
If you have issues with openssl (Undefined symbols for architecture x86_64) try to add to *~/.profile* file this or via Terminal
|
||||
|
||||
export PATH="/usr/local/opt/openssl/bin:$PATH"
|
||||
export LDFLAGS="-L/usr/local/opt/openssl/lib"
|
||||
export CPPFLAGS="-I/usr/local/opt/openssl/include"
|
||||
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
|
||||
|
||||
For Qt Creator -> QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additional arguments:
|
||||
|
||||
LDFLAGS="-L/usr/local/opt/openssl/lib"
|
||||
CPPFLAGS="-I/usr/local/opt/openssl/include"
|
||||
|
||||
|
||||
|
||||
## Copy Plugins
|
||||
|
||||
$ cp \
|
||||
|
50
build_scripts/OSX/makeOSXPackage.sh
Normal file
50
build_scripts/OSX/makeOSXPackage.sh
Normal file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
APP="RetroShare"
|
||||
RSVERSION="0.6.7a"
|
||||
QTVERSION="Qt-5.14.1"
|
||||
|
||||
# Install the 7z to create dmg archives.
|
||||
#brew list p7zip || brew install p7zip
|
||||
|
||||
# Package your app
|
||||
echo "Packaging retroshare..."
|
||||
#cd ${project_dir}/build/macOS/clang/x86_64/release/
|
||||
cd retroshare-gui/src/
|
||||
|
||||
# Remove build directories that you don't want to deploy
|
||||
rm -rf moc
|
||||
rm -rf obj
|
||||
rm -rf qrc
|
||||
|
||||
# This sets the CFBundleVersion & CFBundleShortVersionString string
|
||||
#/usr/libexec/PlistBuddy -c "Delete :CFBundleGetInfoString" retroshare.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $RSVERSION" retroshare.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string $RSVERSION" retroshare.app/Contents/Info.plist
|
||||
|
||||
# This automatically creates retroshare.dmg
|
||||
|
||||
echo "Creating dmg archive..."
|
||||
macdeployqt retroshare.app -dmg
|
||||
|
||||
DATE=`date +"%m-%d-%Y"`
|
||||
MACVERSION=`sw_vers -productVersion`
|
||||
#RSVERSION=`git describe --abbrev=0 --tags`
|
||||
GITHEAD=`git rev-parse --short HEAD`
|
||||
|
||||
mv $APP.dmg "$APP-$RSVERSION-$GITHEAD-$DATE-MacOS-$MACVERSION-$QTVERSION.dmg"
|
||||
|
||||
# You can use the appdmg command line app to create your dmg file if
|
||||
# you want to use a custom background and icon arrangement. I'm still
|
||||
# working on this for my apps, myself. If you want to do this, you'll
|
||||
# remove the -dmg option above.
|
||||
# appdmg json-path YourApp_${TRAVIS_TAG}.dmg
|
||||
|
||||
# Copy other project files
|
||||
cp "../../libbitdht/src/bitdht/bdboot.txt" "retroshare.app/Contents/Resources/"
|
||||
cp "../../plugins/FeedReader/lib/libFeedReader.dylib" "retroshare.app/Contents/Resources/"
|
||||
cp -R "sounds" "retroshare.app/Contents/Resources/sounds"
|
||||
|
||||
# cp "${project_dir}/README.md" "README.md"
|
||||
# cp "${project_dir}/LICENSE" "LICENSE"
|
||||
# cp "${project_dir}/Qt License" "Qt License"
|
@ -16,7 +16,13 @@ if "%~1"=="clean" (
|
||||
goto exit
|
||||
)
|
||||
|
||||
if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
|
||||
set MSYS2Version=20231026
|
||||
|
||||
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 MSYS2UnpackPath=%EnvMSYS2Path%\msys64
|
||||
|
||||
if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
|
||||
if "%~1"=="reinstall" (
|
||||
choice /M "Found existing MSYS2 version. Do you want to proceed?"
|
||||
if !ERRORLEVEL!==2 goto exit
|
||||
@ -25,30 +31,26 @@ if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
|
||||
)
|
||||
)
|
||||
|
||||
if "%MSYS2Architecture%"=="i686" set MSYS2Version=20210705
|
||||
if "%MSYS2Architecture%"=="x86_64" set MSYS2Version=20210725
|
||||
if exist "%MSYS2UnpackPath%" (
|
||||
%cecho% info "Remove previous MSYS2 version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%"
|
||||
)
|
||||
|
||||
set MSYS2Install=msys2-base-%MSYS2Architecture%-%MSYS2Version%.tar.xz
|
||||
set MSYS2Url=https://repo.msys2.org/distrib/%MSYS2Architecture%/%MSYS2Install%
|
||||
|
||||
%cecho% info "Remove previous MSYS2 version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
|
||||
|
||||
%cecho% info "Download installation files"
|
||||
%cecho% info "Download MSYS2 installation files"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
|
||||
|
||||
%cecho% info "Unpack MSYS2"
|
||||
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%"
|
||||
"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%"
|
||||
|
||||
set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh
|
||||
set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh
|
||||
|
||||
%cecho% info "Initialize MSYS2"
|
||||
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm -Sy"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm -Su"
|
||||
|
||||
call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat"
|
||||
call "%MSYS2UnpackPath%\autorebase.bat"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
|
@ -34,7 +34,7 @@ if not exist "%EnvToolsPath%\cecho.exe" (
|
||||
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
|
||||
|
||||
echo Unpack cecho
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0
|
||||
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
@ -2,18 +2,13 @@
|
||||
|
||||
setlocal
|
||||
|
||||
if exist "%~dp0msys2\msys32" call :update 32
|
||||
if exist "%~dp0msys2\msys64" call :update 64
|
||||
if not exist "%~dp0msys2\msys64" goto :EOF
|
||||
|
||||
goto :EOF
|
||||
set MSYS2SH=%~dp0msys2\msys64\usr\bin\sh
|
||||
|
||||
:update
|
||||
set MSYS2SH=%~dp0msys2\msys%~1\usr\bin\sh
|
||||
|
||||
echo Update MSYS2 %~1
|
||||
echo Update MSYS2
|
||||
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm -Su"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
goto :EOF
|
||||
|
@ -1,7 +1,7 @@
|
||||
ZLIB_VERSION=1.2.11
|
||||
BZIP2_VERSION=1.0.8
|
||||
MINIUPNPC_VERSION=2.2.3
|
||||
OPENSSL_VERSION=1.1.1p
|
||||
OPENSSL_VERSION=1.1.1w
|
||||
SPEEX_VERSION=1.2.0
|
||||
SPEEXDSP_VERSION=1.2.0
|
||||
LIBXML2_VERSION=2.9.12
|
||||
|
@ -56,7 +56,7 @@ if "%ParamWebui%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_webui
|
||||
if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% retroshare_plugins
|
||||
if "%ParamUseNativeDialogs%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_use_native_dialogs
|
||||
if "%ParamService%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_retroshare_service
|
||||
if "%ParamFriendServer%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_rs_friendserver
|
||||
if "%ParamFriendServer%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_retroshare_friendserver
|
||||
if "%ParamEmbeddedFriendServer%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_efs
|
||||
|
||||
qmake "%SourcePath%\RetroShare.pro" -r -spec win32-g++ "CONFIG+=%RS_QMAKE_CONFIG%" "EXTERNAL_LIB_DIR=%BuildLibsPath%\libs"
|
||||
|
3
build_scripts/Windows/env/env-msys2.bat
vendored
3
build_scripts/Windows/env/env-msys2.bat
vendored
@ -22,11 +22,12 @@ if "%GCCArchitecture%"=="x64" (
|
||||
)
|
||||
|
||||
set EnvMSYS2Path=%EnvRootPath%\msys2
|
||||
set EnvMSYS2BasePath=%EnvMSYS2Path%\msys64
|
||||
|
||||
call "%~dp0tools\prepare-msys2.bat" %1
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
set EnvMSYS2SH=%EnvMSYS2Path%\msys64\usr\bin\sh.exe
|
||||
set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe
|
||||
if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc
|
||||
|
@ -16,15 +16,15 @@ if "%~1"=="clean" (
|
||||
goto exit
|
||||
)
|
||||
|
||||
set MSYS2Version=20230318
|
||||
set MSYS2Version=20231026
|
||||
|
||||
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 MSYS2UnpackPath=%EnvMSYS2Path%\msys64
|
||||
set CMakeInstall=cmake-3.19.0-win32-x86.zip
|
||||
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall%
|
||||
set CMakeUnpackPath=%EnvMSYS2Path%\msys64
|
||||
|
||||
if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" (
|
||||
if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
|
||||
if "%~1"=="reinstall" (
|
||||
choice /M "Found existing MSYS2 version. Do you want to proceed?"
|
||||
if !ERRORLEVEL!==2 goto exit
|
||||
@ -33,13 +33,12 @@ if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" (
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if exist "%CMakeUnpackPath%" (
|
||||
if exist "%MSYS2UnpackPath%" (
|
||||
%cecho% info "Remove previous MSYS2 version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%CMakeUnpackPath%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%"
|
||||
)
|
||||
|
||||
%cecho% info "Download installation files"
|
||||
%cecho% info "Download MSYS2 installation files"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
|
||||
|
||||
@ -50,29 +49,29 @@ if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download C
|
||||
"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%"
|
||||
|
||||
%cecho% info "Unpack CMake"
|
||||
"%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%MSYS2UnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0
|
||||
|
||||
%cecho% info "Install CMake"
|
||||
set CMakeVersion=
|
||||
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
|
||||
for /D %%F in (%MSYS2UnpackPath%\cmake*) do set CMakeVersion=%%~nxF
|
||||
if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit
|
||||
%cecho% info "Found CMake version %CMakeVersion%"
|
||||
|
||||
set FoundProfile=
|
||||
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%CMakeUnpackPath%\etc\profile"') do set FoundProfile=%%F
|
||||
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYS2UnpackPath%\etc\profile"') do set FoundProfile=%%F
|
||||
|
||||
if "%FoundProfile%"=="0" (
|
||||
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%CMakeUnpackPath%\etc\profile"
|
||||
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYS2UnpackPath%\etc\profile"
|
||||
)
|
||||
|
||||
set MSYS2SH=%CMakeUnpackPath%\usr\bin\sh
|
||||
set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh
|
||||
|
||||
%cecho% info "Initialize MSYS2"
|
||||
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm -Sy"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm -Su"
|
||||
|
||||
call "%CMakeUnpackPath%\autorebase.bat"
|
||||
call "%MSYS2UnpackPath%\autorebase.bat"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
|
@ -53,7 +53,7 @@ if not exist "%EnvToolsPath%\cecho.exe" (
|
||||
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
|
||||
|
||||
echo Unpack cecho
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0
|
||||
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
@ -69,7 +69,7 @@ if not exist "%EnvToolsPath%\depends.exe" (
|
||||
if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Dependency Walker"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" -y -bso0
|
||||
copy "%EnvTempPath%\*" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
@ -85,7 +85,7 @@ if not exist "%EnvToolsPath%\cut.exe" (
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Unix Tools"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0
|
||||
copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
@ -101,7 +101,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Unix Tools"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0
|
||||
copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
@ -121,7 +121,7 @@ if not exist "%NSISInstallPath%\nsis.exe" (
|
||||
if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error
|
||||
|
||||
%cecho% info "Unpack NSIS"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" -y -bso0
|
||||
if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%"
|
||||
xcopy /s "%EnvTempPath%" "%NSISInstallPath%"
|
||||
|
||||
@ -135,7 +135,7 @@ if not exist "%MinGitInstallPath%\cmd\git.exe" (
|
||||
if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error
|
||||
|
||||
%cecho% info "Unpack MinGit"
|
||||
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" -y -bso0
|
||||
)
|
||||
|
||||
if not exist "%EnvDownloadPath%\%DoxygenInstall%" call "%ToolsPath%\remove-dir.bat" "%DoxygenInstallPath%"
|
||||
@ -148,7 +148,7 @@ if not exist "%DoxygenInstallPath%\doxygen.exe" (
|
||||
if not exist "%EnvDownloadPath%\%DoxygenInstall%" %cecho% error "Cannot download doxygen installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Doxygen"
|
||||
"%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" -y -bso0
|
||||
)
|
||||
|
||||
if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%"
|
||||
@ -163,7 +163,7 @@ if not exist "%CMakeInstallPath%\bin\cmake.exe" (
|
||||
if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error
|
||||
|
||||
%cecho% info "Unpack CMake"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0
|
||||
|
||||
move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%"
|
||||
|
||||
@ -176,7 +176,7 @@ mkdir "%EnvTempPath%"
|
||||
call "%ToolsPath%\download-file.bat" "%TorDownloadIndexUrl%" "%EnvTempPath%\index.html"
|
||||
if not exist "%EnvTempPath%\index.html" %cecho% error "Cannot download Tor installation" & goto error
|
||||
|
||||
for /F "tokens=1,2 delims= " %%A in ('%EnvSedExe% -r -n -e"s/.*href=\"^(.*^)^(tor-.*windows-i686\.tar\.gz^)\".*/\2 \1\2/p" "%EnvTempPath%\index.html"') do set TorInstall=%%A& set TorDownloadUrl=%%B
|
||||
for /F "tokens=1,2 delims= " %%A in ('%EnvSedExe% -r -n -e"s/.*href=\"^(.*^)^(tor-.*windows-i686.*\.tar\.gz^)\".*/\2 \1\2/p" "%EnvTempPath%\index.html"') do set TorInstall=%%A& set TorDownloadUrl=%%B
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
if "%TorInstall%"=="" %cecho% error "Cannot download Tor installation" & goto error
|
||||
if "%TorDownloadUrl%"=="" %cecho% error "Cannot download Tor installation" & goto error
|
||||
@ -189,7 +189,7 @@ if not exist "%EnvTorPath%\Tor\tor.exe" (
|
||||
if not exist "%EnvDownloadPath%\%TorInstall%" %cecho% error "Cannot download Tor installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Tor"
|
||||
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%"
|
||||
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" -y -bso0
|
||||
)
|
||||
|
||||
:exit
|
||||
|
@ -318,7 +318,7 @@ SectionEnd
|
||||
!ifdef TOR_EXISTS
|
||||
Section /o $(Section_Tor) Section_Tor
|
||||
SetOutPath "$INSTDIR\tor"
|
||||
File /r "${TORDIR}\*"
|
||||
File "${TORDIR}\*"
|
||||
SectionEnd
|
||||
!endif
|
||||
|
||||
|
20
build_scripts/git_tag_cleaner.sh
Executable file
20
build_scripts/git_tag_cleaner.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
function git_del_tag()
|
||||
{
|
||||
mTag=$1
|
||||
|
||||
for mRemote in $(git remote); do
|
||||
echo "Attempting tag $mTag removal from remote $mRemote"
|
||||
GIT_TERMINAL_PROMPT=0 git push $mRemote :$mTag || true
|
||||
done
|
||||
git tag --delete $mTag
|
||||
}
|
||||
|
||||
for mModule in . build_scripts/OBS/ libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ ; do
|
||||
pushd $mModule
|
||||
git_del_tag v0.6.7a
|
||||
git tag --list | grep untagged | while read mTag; do git_del_tag $mTag ; done
|
||||
popd
|
||||
done
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 659423769541169457c41f71c8a038e2d64ba079
|
||||
Subproject commit 2ddc86fb575a61170f4c06a00152e3e7dc74c8f4
|
@ -1 +1 @@
|
||||
Subproject commit 8c02b54e4d16e38b28e77263a0b1570c50df4c99
|
||||
Subproject commit 78739f1eb504503b12f107109356624da49e75ef
|
@ -1151,10 +1151,10 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
|
||||
|
||||
if (isRunning()) {
|
||||
/* process description */
|
||||
bool processPostedFirstImage = (feed.flag & RS_FEED_FLAG_POSTED_FIRST_IMAGE) ? TRUE : FALSE;
|
||||
bool processPostedFirstImage = (feed.flag & RS_FEED_FLAG_POSTED_FIRST_IMAGE) ? true : false;
|
||||
if (!msg->attachmentBinary.empty()) {
|
||||
/* use attachment as image */
|
||||
processPostedFirstImage = FALSE;
|
||||
processPostedFirstImage = false;
|
||||
}
|
||||
|
||||
//long todo; // encoding
|
||||
|
@ -609,7 +609,9 @@ void GenCertDialog::genPerson()
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance();
|
||||
std::cout << "Waiting ed->processEvents()" << std::endl;
|
||||
#ifdef DEBUG_GENCERTDIALOG
|
||||
std::cout << "Waiting ed->processEvents()" << std::endl;
|
||||
#endif
|
||||
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
|
||||
if (ed->hasPendingEvents())
|
||||
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));
|
||||
|
@ -301,8 +301,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>456</width>
|
||||
<height>731</height>
|
||||
<width>466</width>
|
||||
<height>738</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="scrollAreaWidgetContentsVLayout">
|
||||
@ -573,17 +573,68 @@ border-image: url(:/images/closepressed.png)
|
||||
<string>Identity info</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_GpgId">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="neighborNodesOpinion_LB">
|
||||
<property name="text">
|
||||
<string>Owner node ID :</string>
|
||||
<string>Friend votes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QLineEdit" name="overallOpinion_TF">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="Line" name="line_IdInfo">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_KeyId">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_LastUsed">
|
||||
<property name="text">
|
||||
<string>Last used:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="autoBanIdentities_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html></string>
|
||||
<string>Auto-Ban all identities signed by the same node</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto-Ban profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_PublishTS">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Nickname">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
@ -600,61 +651,253 @@ border-image: url(:/images/closepressed.png)
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="14">
|
||||
<item row="14" column="1">
|
||||
<widget class="QLineEdit" name="overallOpinion_TF">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html></string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_YourOpinion">
|
||||
<property name="text">
|
||||
<string>Your opinion:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="overallOpinion_LB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Overall:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_PublishTS">
|
||||
<property name="text">
|
||||
<string>Created on :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_Nickname">
|
||||
<property name="text">
|
||||
<string>Identity name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_KeyId">
|
||||
<property name="text">
|
||||
<string>Identity ID :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html></string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Type">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_Type">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_LastUsed">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_GpgId">
|
||||
<property name="text">
|
||||
<string>Owner node ID :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_GpgName">
|
||||
<property name="text">
|
||||
<string>Owner node name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="banoption_label">
|
||||
<property name="text">
|
||||
<string>Ban-option:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" rowspan="2">
|
||||
<widget class="RSComboBox" name="ownOpinion_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><span style=" font-family:'Sans'; font-size:9pt;">Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">You can change the thresholds and the time of inactivity to delete identities in preferences -&gt; people. </span></p></body></html></string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Negative</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Neutral</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Positive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="15">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="avatarLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string extracomment="Click here to change your avatar">Your Avatar</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="inviteButton">
|
||||
<property name="text">
|
||||
<string>Send Invite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="text">
|
||||
<string>Edit Identity</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="avatarLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string extracomment="Click here to change your avatar">Your Avatar</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="text">
|
||||
<string>Edit Identity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="inviteButton">
|
||||
<property name="text">
|
||||
<string>Send Invite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="avatarOpinionHLayout">
|
||||
@ -756,200 +999,6 @@ border-image: url(:/images/closepressed.png)
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Type">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_Type">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="overallOpinion_LB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Overall:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_LastUsed">
|
||||
<property name="text">
|
||||
<string>Last used:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_KeyId">
|
||||
<property name="text">
|
||||
<string>Identity ID :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_PublishTS">
|
||||
<property name="text">
|
||||
<string>Created on :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_GpgName">
|
||||
<property name="text">
|
||||
<string>Owner node name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="banoption_label">
|
||||
<property name="text">
|
||||
<string>Ban-option:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_YourOpinion">
|
||||
<property name="text">
|
||||
<string>Your opinion:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html></string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_LastUsed">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" rowspan="2">
|
||||
<widget class="RSComboBox" name="ownOpinion_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><span style=" font-family:'Sans'; font-size:9pt;">Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">You can change the thresholds and the time of inactivity to delete identities in preferences -&gt; people. </span></p></body></html></string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Negative</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Neutral</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Positive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_Nickname">
|
||||
<property name="text">
|
||||
<string>Identity name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="autoBanIdentities_CB">
|
||||
<property name="toolTip">
|
||||
<string>Auto-Ban all identities signed by the same node</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto-Ban profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_GpgName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_PublishTS">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="neighborNodesOpinion_LB">
|
||||
<property name="text">
|
||||
<string>Friend votes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Nickname">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="Line" name="line_IdInfo">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_KeyId">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -83,7 +83,7 @@ NetworkDialog::NetworkDialog(QWidget */*parent*/)
|
||||
ui.connectTreeWidget->setUpdatesEnabled(true);
|
||||
ui.connectTreeWidget->setSortingEnabled(true);
|
||||
ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui.connectTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui.connectTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails()));
|
||||
|
||||
@ -117,24 +117,12 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu *contextMnu = new QMenu;
|
||||
|
||||
RsPgpId peer_id(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString()) ;
|
||||
|
||||
// That's what context menus are made for
|
||||
RsPeerDetails detail;
|
||||
if(!rsPeers->getGPGDetails(peer_id, detail)) // that is not suppose to fail.
|
||||
return ;
|
||||
|
||||
if(peer_id == rsPeers->getGPGOwnId())
|
||||
contextMnu->addAction(QIcon(), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated()));
|
||||
|
||||
contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails()));
|
||||
contextMnu->addSeparator() ;
|
||||
contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys()));
|
||||
contextMnu->addAction(QIcon(), tr("Remove this key"), this, SLOT(removeSelectedKeys()));
|
||||
|
||||
contextMnu->exec(QCursor::pos());
|
||||
}
|
||||
|
||||
@ -177,11 +165,34 @@ void NetworkDialog::removeSelectedKeys()
|
||||
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
|
||||
if(l.empty())
|
||||
return;
|
||||
|
||||
std::set<RsPgpId> selected;
|
||||
selected.insert(RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString()));
|
||||
|
||||
removeKeys(selected);
|
||||
std::set<RsPgpId> friends;
|
||||
for (int i = 0; i < l.size(); i++)
|
||||
{
|
||||
RsPgpId peer_id = RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l[i].row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString());
|
||||
RsPeerDetails details ;
|
||||
if(rsPeers->getGPGDetails(peer_id,details))
|
||||
{
|
||||
if(details.accept_connection)
|
||||
friends.insert(peer_id);
|
||||
else
|
||||
selected.insert(peer_id);
|
||||
}
|
||||
}
|
||||
if(!friends.empty())
|
||||
{
|
||||
if ((QMessageBox::question(this, "RetroShare", tr("You have selected %1 accepted peers among others,\n Are you sure you want to un-friend them?").arg(friends.size()), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes)
|
||||
{
|
||||
for(std::set<RsPgpId>::const_iterator it(friends.begin());it!=friends.end();++it)
|
||||
rsPeers->removeFriend(*it);
|
||||
selected.insert(friends.begin(),friends.end());
|
||||
}
|
||||
}
|
||||
if(!selected.empty())
|
||||
removeKeys(selected);
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
void NetworkDialog::removeKeys(std::set<RsPgpId> selected)
|
||||
|
@ -299,7 +299,7 @@ void NewsFeed::handleChannelEvent(std::shared_ptr<const RsEvent> event)
|
||||
addFeedItem(new GxsChannelPostItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId, false, true));
|
||||
break;
|
||||
case RsChannelEventCode::NEW_COMMENT:
|
||||
addFeedItem(new ChannelsCommentsItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId, false, true));
|
||||
addFeedItem(new ChannelsCommentsItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId,pe->mChannelThreadId, false, true));
|
||||
break;
|
||||
case RsChannelEventCode::RECEIVED_PUBLISH_KEY:
|
||||
addFeedItem(new GxsChannelGroupItem(this, NEWSFEED_CHANNELPUBKEYLIST, pe->mChannelGroupId, false, true));
|
||||
|
@ -216,7 +216,7 @@ void PulseAddDialog::setReplyTo(const RsWirePulse &pulse, RsWirePulseSPtr pPulse
|
||||
mReplyToPulse = pulse;
|
||||
mReplyType = replyType;
|
||||
ui.frame_reply->setVisible(true);
|
||||
ui.pushButton_picture->show();
|
||||
ui.pushButton_picture->hide();
|
||||
ui.topheadshot->hide();
|
||||
|
||||
{
|
||||
@ -245,10 +245,12 @@ void PulseAddDialog::setReplyTo(const RsWirePulse &pulse, RsWirePulseSPtr pPulse
|
||||
if (mReplyType & WIRE_PULSE_TYPE_REPUBLISH) {
|
||||
ui.postButton->setText(tr("Republish Pulse"));
|
||||
ui.pushButton_picture->hide();
|
||||
ui.pushButton_Browse->hide();
|
||||
}
|
||||
else if (mReplyType & WIRE_PULSE_TYPE_LIKE) {
|
||||
ui.postButton->setText(tr("Like Pulse"));
|
||||
ui.pushButton_picture->hide();
|
||||
ui.pushButton_Browse->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@
|
||||
<widget class="QWidget" name="widget_sentiment" native="true">
|
||||
<layout class="QHBoxLayout" name="widget_sentiment_HL">
|
||||
<property name="leftMargin">
|
||||
<number>20</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
|
@ -40,10 +40,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
|
@ -154,9 +154,16 @@ void WireDialog::processSettings(bool load)
|
||||
|
||||
// state of splitter
|
||||
ui.splitter->restoreState(Settings->value("SplitterWire").toByteArray());
|
||||
|
||||
// state of filter combobox
|
||||
int index = Settings->value("ShowGroup", 0).toInt();
|
||||
ui.comboBox_groupSet->setCurrentIndex(index);
|
||||
} else {
|
||||
// save settings
|
||||
|
||||
// state of filter combobox
|
||||
Settings->setValue("ShowGroup", ui.comboBox_groupSet->currentIndex());
|
||||
|
||||
// state of splitter
|
||||
Settings->setValue("SplitterWire", ui.splitter->saveState());
|
||||
}
|
||||
@ -1064,4 +1071,3 @@ void WireDialog::postGroupsPulses(std::list<RsWirePulseSPtr> pulses)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,8 +1145,6 @@ void RsFriendListModel::updateInternalData()
|
||||
mLocations.clear();
|
||||
mTopLevel.clear();
|
||||
|
||||
endResetModel();
|
||||
|
||||
auto TL = mTopLevel ; // This allows to fill TL without touching mTopLevel outside of [begin/end]InsertRows().
|
||||
|
||||
// create a map of profiles and groups
|
||||
@ -1282,7 +1280,8 @@ void RsFriendListModel::updateInternalData()
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
endResetModel();
|
||||
postMods();
|
||||
|
||||
mLastInternalDataUpdate = time(NULL);
|
||||
}
|
||||
|
@ -1619,7 +1619,9 @@ bool NewFriendList::isColumnVisible(int col) const
|
||||
}
|
||||
void NewFriendList::setColumnVisible(int col,bool visible)
|
||||
{
|
||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||
std::cerr << "Setting column " << col << " to be visible: " << visible << std::endl;
|
||||
#endif
|
||||
ui->peerTreeWidget->setColumnHidden(col, !visible);
|
||||
}
|
||||
void NewFriendList::toggleColumnVisible()
|
||||
|
@ -34,6 +34,7 @@
|
||||
#endif
|
||||
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/misc.h"
|
||||
#include "ConnectFriendWizard.h"
|
||||
@ -449,8 +450,9 @@ void ConnectFriendWizard::initializePage(int id)
|
||||
}
|
||||
|
||||
sockaddr_storage addr ;
|
||||
|
||||
#ifdef DEBUG_FRIENDWIZARD
|
||||
std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl;
|
||||
#endif
|
||||
|
||||
if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr))
|
||||
{
|
||||
@ -870,7 +872,18 @@ void ConnectFriendWizard::cleanFriendCert()
|
||||
bool certValid = false;
|
||||
QString errorMsg ;
|
||||
QString certDetail;
|
||||
std::string cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
|
||||
|
||||
std::string cert ;
|
||||
RetroShareLink rslink(ui->friendCertEdit->toPlainText());
|
||||
|
||||
if(rslink.valid() && rslink.type() == RetroShareLink::TYPE_CERTIFICATE)
|
||||
cert = rslink.radix().toStdString();
|
||||
else
|
||||
cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
|
||||
|
||||
#ifdef DEBUG_FRIENDWIZARD
|
||||
std::cerr << "Friend cert:\"" << cert << "\"" << std::endl;
|
||||
#endif
|
||||
|
||||
if (cert.empty()) {
|
||||
ui->friendCertCleanLabel->setToolTip("");
|
||||
@ -936,7 +949,7 @@ void ConnectFriendWizard::cleanFriendCert()
|
||||
void ConnectFriendWizard::pasteCert()
|
||||
{
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
ui->friendCertEdit->setPlainText(clipboard->text());
|
||||
ui->friendCertEdit->setPlainText(clipboard->text());
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::openCert()
|
||||
|
@ -49,46 +49,41 @@
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group_meta, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate),
|
||||
mGroupMeta(group_meta)
|
||||
// ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group_meta, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
// GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate),
|
||||
// mGroupMeta(group_meta)
|
||||
// {
|
||||
// mLoadingGroup = false;
|
||||
// mLoadingMessage = false;
|
||||
// mLoadingComment = false;
|
||||
//
|
||||
// mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||
// mPost.mMeta.mGroupId = mGroupMeta.mGroupId;
|
||||
//
|
||||
// QVector<RsGxsMessageId> v;
|
||||
// //bool self = false;
|
||||
//
|
||||
// for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
// v.push_back(*it) ;
|
||||
//
|
||||
// if(older_versions.find(messageId) == older_versions.end())
|
||||
// v.push_back(messageId);
|
||||
//
|
||||
// setMessageVersions(v) ;
|
||||
// setup();
|
||||
//
|
||||
// // no call to loadGroup() here because we have it already.
|
||||
// }
|
||||
|
||||
ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &commentId, const RsGxsMessageId &threadId, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, groupId, commentId, isHome, rsGxsChannels, autoUpdate), // this one should be in GxsFeedItem
|
||||
mThreadId(threadId)
|
||||
{
|
||||
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||
mPost.mMeta.mGroupId = mGroupMeta.mGroupId;
|
||||
mLoading= false;
|
||||
|
||||
QVector<RsGxsMessageId> v;
|
||||
//bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
v.push_back(*it) ;
|
||||
|
||||
if(older_versions.find(messageId) == older_versions.end())
|
||||
v.push_back(messageId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
setup();
|
||||
|
||||
// no call to loadGroup() here because we have it already.
|
||||
}
|
||||
|
||||
ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) // this one should be in GxsFeedItem
|
||||
{
|
||||
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||
|
||||
QVector<RsGxsMessageId> v;
|
||||
//bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
v.push_back(*it) ;
|
||||
|
||||
if(older_versions.find(messageId) == older_versions.end())
|
||||
v.push_back(messageId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
setup();
|
||||
|
||||
loadGroup();
|
||||
}
|
||||
|
||||
void ChannelsCommentsItem::paintEvent(QPaintEvent *e)
|
||||
@ -99,21 +94,22 @@ void ChannelsCommentsItem::paintEvent(QPaintEvent *e)
|
||||
if(!mLoaded)
|
||||
{
|
||||
mLoaded = true ;
|
||||
|
||||
std::set<RsGxsMessageId> older_versions; // not so nice. We need to use std::set everywhere
|
||||
for(auto& m:messageVersions())
|
||||
older_versions.insert(m);
|
||||
|
||||
fill();
|
||||
requestMessage();
|
||||
requestComment();
|
||||
}
|
||||
load();
|
||||
}
|
||||
|
||||
GxsFeedItem::paintEvent(e) ;
|
||||
}
|
||||
|
||||
ChannelsCommentsItem::~ChannelsCommentsItem()
|
||||
{
|
||||
auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(300);
|
||||
|
||||
while( mLoading && std::chrono::steady_clock::now() < timeout )
|
||||
{
|
||||
RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for data to load " << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
@ -182,21 +178,19 @@ void ChannelsCommentsItem::setup()
|
||||
ui->expandFrame->hide();
|
||||
}
|
||||
|
||||
bool ChannelsCommentsItem::setPost(const RsGxsChannelPost &post, bool doFill)
|
||||
bool ChannelsCommentsItem::setPost(const RsGxsChannelPost& post, bool doFill)
|
||||
{
|
||||
if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) {
|
||||
std::cerr << "ChannelsCommentsItem::setPost() - Wrong id, cannot set post";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
mPost = post;
|
||||
|
||||
if (doFill) {
|
||||
if (doFill)
|
||||
fill();
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
bool ChannelsCommentsItem::setMissingPost()
|
||||
{
|
||||
fill(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
QString ChannelsCommentsItem::getTitleLabel()
|
||||
@ -230,168 +224,148 @@ void ChannelsCommentsItem::loadComments()
|
||||
|
||||
void ChannelsCommentsItem::loadGroup()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
|
||||
if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
RsGxsChannelGroup group(groups[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mGroupMeta = group.mMeta;
|
||||
|
||||
}, this );
|
||||
});
|
||||
//#ifdef DEBUG_ITEM
|
||||
// std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
// std::cerr << std::endl;
|
||||
//#endif
|
||||
// if(mLoading)
|
||||
// return;
|
||||
//
|
||||
// mLoading= true;
|
||||
//
|
||||
// std::cerr << "Loading group" << std::endl;
|
||||
// RsThread::async([this]()
|
||||
// {
|
||||
// // 1 - get group data
|
||||
//
|
||||
// std::vector<RsGxsChannelGroup> groups;
|
||||
// const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
//
|
||||
// if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group
|
||||
// {
|
||||
// RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (groups.size() != 1)
|
||||
// {
|
||||
// std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
|
||||
// std::cerr << std::endl;
|
||||
// return;
|
||||
// }
|
||||
// RsGxsChannelGroup group(groups[0]);
|
||||
//
|
||||
// RsQThreadUtils::postToObject( [group,this]()
|
||||
// {
|
||||
// /* Here it goes any code you want to be executed on the Qt Gui
|
||||
// * thread, for example to update the data model with new information
|
||||
// * after a blocking call to RetroShare API complete */
|
||||
//
|
||||
// mGroupMeta = group.mMeta;
|
||||
// mLoading= false;
|
||||
//
|
||||
// std::cerr << "End loading group" << std::endl;
|
||||
// }, this );
|
||||
// });
|
||||
}
|
||||
void ChannelsCommentsItem::loadMessage()
|
||||
void ChannelsCommentsItem::load()
|
||||
{
|
||||
// This function loads everything that's needed:
|
||||
// - the comment text
|
||||
// - the comment parent message
|
||||
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChannelsCommentsItem::loadMessage()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
RsThread::async([this]()
|
||||
if(mLoading)
|
||||
return;
|
||||
|
||||
mLoading= true;
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
// 1 - get group meta data
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
|
||||
if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items" << std::endl;
|
||||
return;
|
||||
}
|
||||
RsGxsChannelGroup group(groups[0]);
|
||||
|
||||
// 2 - get message and comment data
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
std::vector<RsGxsVote> votes;
|
||||
|
||||
if(! rsGxsChannels->getChannelContent( groupId(), std::set<RsGxsMessageId>( { messageId() } ),posts,comments,votes))
|
||||
if(! rsGxsChannels->getChannelContent( groupId(), std::set<RsGxsMessageId>( { messageId(),mThreadId } ),posts,comments,votes))
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (posts.size() == 1)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
|
||||
#endif
|
||||
RsGxsChannelPost post(posts[0]); // no reference to temporary here, because we pass this to a thread
|
||||
// now that everything is in place, update the UI
|
||||
|
||||
RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this );
|
||||
}
|
||||
else if(comments.size() == 1)
|
||||
{
|
||||
RsGxsComment cmt(comments[0]);
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
|
||||
#endif
|
||||
RsQThreadUtils::postToObject( [group,posts,comments,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
RsQThreadUtils::postToObject( [cmt,this]()
|
||||
{
|
||||
uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height())
|
||||
/ QFontMetricsF(ui->subjectLabel->font()).height());
|
||||
mGroupMeta = group.mMeta;
|
||||
|
||||
ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
if(comments.size()==1)
|
||||
{
|
||||
RsGxsComment cmt(comments[0]);
|
||||
|
||||
ui->nameLabel->setId(cmt.mMeta.mAuthorId);
|
||||
ui->datetimeLabel->setText(DateTime::formatLongDateTime(cmt.mMeta.mPublishTs));
|
||||
uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height())
|
||||
/ QFontMetricsF(ui->subjectLabel->font()).height());
|
||||
|
||||
RsIdentityDetails idDetails ;
|
||||
rsIdentity->getIdDetails(cmt.mMeta.mAuthorId,idDetails);
|
||||
QPixmap pixmap ;
|
||||
ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
ui->nameLabel->setId(cmt.mMeta.mAuthorId);
|
||||
ui->datetimeLabel->setText(DateTime::formatLongDateTime(cmt.mMeta.mPublishTs));
|
||||
|
||||
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
|
||||
pixmap = GxsIdDetails::makeDefaultIcon(cmt.mMeta.mAuthorId,GxsIdDetails::LARGE);
|
||||
ui->avatarLabel->setPixmap(pixmap);
|
||||
RsIdentityDetails idDetails ;
|
||||
rsIdentity->getIdDetails(cmt.mMeta.mAuthorId,idDetails);
|
||||
QPixmap pixmap ;
|
||||
|
||||
//Change this item to be uploaded with thread element.
|
||||
setMessageId(cmt.mMeta.mThreadId);
|
||||
requestMessage();
|
||||
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
|
||||
pixmap = GxsIdDetails::makeDefaultIcon(cmt.mMeta.mAuthorId,GxsIdDetails::LARGE);
|
||||
ui->avatarLabel->setPixmap(pixmap);
|
||||
|
||||
}, this );
|
||||
//Change this item to be uploaded with thread element. This is really bad practice.
|
||||
}
|
||||
else
|
||||
{
|
||||
mLoading=false;
|
||||
removeItem();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChannelsCommentsItem::loadMessage() Wrong number of Items. Remove It.";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (posts.size() == 1)
|
||||
setPost(posts[0]);
|
||||
else
|
||||
setMissingPost();
|
||||
|
||||
RsQThreadUtils::postToObject( [this]() { removeItem(); }, this );
|
||||
}
|
||||
});
|
||||
|
||||
emit sizeChanged(this);
|
||||
emit sizeChanged(this);
|
||||
mLoading=false;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
void ChannelsCommentsItem::loadComment()
|
||||
void ChannelsCommentsItem::fill(bool missing_post)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChannelsCommentsItem::loadComment()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
|
||||
std::set<RsGxsMessageId> msgIds;
|
||||
|
||||
for(auto MsgId: messageVersions())
|
||||
msgIds.insert(MsgId);
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
|
||||
if(! rsGxsChannels->getChannelComments( groupId(),msgIds,comments))
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int comNb = comments.size();
|
||||
|
||||
RsQThreadUtils::postToObject( [comNb]()
|
||||
{
|
||||
QString sComButText = tr("Comment");
|
||||
if (comNb == 1)
|
||||
sComButText = sComButText.append("(1)");
|
||||
else if(comNb > 1)
|
||||
sComButText = tr("Comments ").append("(%1)").arg(comNb);
|
||||
|
||||
//ui->commentButton->setText(sComButText);
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
void ChannelsCommentsItem::fill()
|
||||
{
|
||||
/* fill in */
|
||||
|
||||
// if (isLoading()) {
|
||||
// /* Wait for all requests */
|
||||
//return;
|
||||
// }
|
||||
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChannelsCommentsItem::fill()";
|
||||
std::cerr << std::endl;
|
||||
@ -399,9 +373,6 @@ void ChannelsCommentsItem::fill()
|
||||
|
||||
mInFill = true;
|
||||
|
||||
//QString title;
|
||||
//float f = QFontMetricsF(font()).height()/14.0 ;
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||
@ -412,19 +383,14 @@ void ChannelsCommentsItem::fill()
|
||||
//title += link.toHtml();
|
||||
//ui->titleLabel->setText(title);
|
||||
|
||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||
ui->subjectLabel->setText(msgLink.toHtml());
|
||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||
|
||||
if(missing_post)
|
||||
ui->subjectLabel->setText("[" + QObject::tr("Missing channel post")+"]");
|
||||
else
|
||||
ui->subjectLabel->setText(msgLink.toHtml());
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
||||
{
|
||||
//ui->unsubscribeButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//ui->unsubscribeButton->setEnabled(false);
|
||||
}
|
||||
ui->readButton->hide();
|
||||
//ui->titleLabel->hide();
|
||||
|
||||
if (IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||
mCloseOnRead = true;
|
||||
@ -432,19 +398,10 @@ void ChannelsCommentsItem::fill()
|
||||
}
|
||||
else
|
||||
{
|
||||
/* subject */
|
||||
//ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
|
||||
|
||||
//uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height())
|
||||
// / QFontMetricsF(ui->subjectLabel->font()).height());
|
||||
|
||||
// fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy
|
||||
//ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
||||
|
||||
//QString score = QString::number(post.mTopScore);
|
||||
// scoreLabel->setText(score);
|
||||
if(missing_post)
|
||||
ui->subjectLabel->setText("[" + QObject::tr("Missing channel post")+"]");
|
||||
else
|
||||
ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
||||
|
||||
/* disable buttons: deletion facility not enabled with cache services yet */
|
||||
ui->clearButton->setEnabled(false);
|
||||
@ -467,50 +424,9 @@ void ChannelsCommentsItem::fill()
|
||||
mCloseOnRead = false;
|
||||
}
|
||||
|
||||
// differences between Feed or Top of Comment.
|
||||
if (mFeedHolder)
|
||||
{
|
||||
//ui->commentButton->show();
|
||||
|
||||
// Not yet functional
|
||||
/*if (mPost.mCommentCount)
|
||||
{
|
||||
QString commentText = QString::number(mPost.mCommentCount);
|
||||
commentText += " ";
|
||||
commentText += tr("Comments");
|
||||
ui->commentButton->setText(commentText);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->commentButton->setText(tr("Comment"));
|
||||
}*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//ui->commentButton->hide();
|
||||
}
|
||||
|
||||
// disable voting buttons - if they have already voted.
|
||||
/*if (post.mMeta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK)
|
||||
{
|
||||
voteUpButton->setEnabled(false);
|
||||
voteDownButton->setEnabled(false);
|
||||
}*/
|
||||
|
||||
if (wasExpanded() || ui->expandFrame->isVisible()) {
|
||||
fillExpandFrame();
|
||||
}
|
||||
|
||||
mInFill = false;
|
||||
}
|
||||
|
||||
void ChannelsCommentsItem::fillExpandFrame()
|
||||
{
|
||||
//ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
}
|
||||
|
||||
QString ChannelsCommentsItem::messageName()
|
||||
{
|
||||
return QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
|
||||
@ -574,10 +490,6 @@ void ChannelsCommentsItem::doExpand(bool open)
|
||||
void ChannelsCommentsItem::expandFill(bool first)
|
||||
{
|
||||
GxsFeedItem::expandFill(first);
|
||||
|
||||
if (first) {
|
||||
fillExpandFrame();
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelsCommentsItem::toggle()
|
||||
|
@ -42,12 +42,17 @@ public:
|
||||
// It can be used for all apparences of channel posts. But in rder to merge comments from the previous versions of the post, the list of
|
||||
// previous posts should be supplied. It's optional. If not supplied only the comments of the new version will be displayed.
|
||||
|
||||
ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
ChannelsCommentsItem(FeedHolder *feedHolder,
|
||||
uint32_t feedId,
|
||||
const RsGxsGroupId& groupId,
|
||||
const RsGxsMessageId& commentId,
|
||||
const RsGxsMessageId& threadId,
|
||||
bool isHome,
|
||||
bool autoUpdate);
|
||||
|
||||
// This one is used in channel thread widget. We don't want the group data to reload at every post, so we load it in the hosting
|
||||
// GxsChannelsPostsWidget and pass it to created items.
|
||||
|
||||
ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
// ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
virtual ~ChannelsCommentsItem();
|
||||
|
||||
@ -55,6 +60,7 @@ public:
|
||||
|
||||
bool setGroup(const RsGxsChannelGroup& group, bool doFill = true);
|
||||
bool setPost(const RsGxsChannelPost& post, bool doFill = true);
|
||||
bool setMissingPost();
|
||||
|
||||
QString getTitleLabel();
|
||||
QString getMsgLabel();
|
||||
@ -85,8 +91,8 @@ protected:
|
||||
|
||||
/* GxsFeedItem */
|
||||
virtual QString messageName();
|
||||
virtual void loadMessage();
|
||||
virtual void loadComment();
|
||||
virtual void loadMessage() override {}
|
||||
virtual void loadComment() override {}
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
@ -104,17 +110,20 @@ signals:
|
||||
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
||||
|
||||
private:
|
||||
void setup();
|
||||
void fill();
|
||||
void fillExpandFrame();
|
||||
void load();
|
||||
void setup();
|
||||
void fill(bool missing_post=false);
|
||||
|
||||
private:
|
||||
bool mInFill;
|
||||
bool mCloseOnRead;
|
||||
bool mLoaded;
|
||||
|
||||
bool mLoading;
|
||||
|
||||
RsGroupMetaData mGroupMeta;
|
||||
RsGxsChannelPost mPost;
|
||||
RsGxsMessageId mThreadId;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ChannelsCommentsItem *ui;
|
||||
|
@ -37,20 +37,47 @@ GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId
|
||||
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
addEventHandler();
|
||||
}
|
||||
|
||||
GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) :
|
||||
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
setup();
|
||||
setGroup(group);
|
||||
addEventHandler();
|
||||
}
|
||||
|
||||
setGroup(group);
|
||||
void GxsChannelGroupItem::addEventHandler()
|
||||
{
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
const auto *e = dynamic_cast<const RsGxsChannelEvent*>(event.get());
|
||||
|
||||
if(!e || e->mChannelGroupId != this->groupId())
|
||||
return;
|
||||
|
||||
switch(e->mChannelEventCode)
|
||||
{
|
||||
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||
case RsChannelEventCode::UPDATED_CHANNEL:
|
||||
case RsChannelEventCode::RECEIVED_PUBLISH_KEY:
|
||||
loadGroup();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}, this );
|
||||
}, mEventHandlerId, RsEventType::GXS_CHANNELS );
|
||||
}
|
||||
|
||||
GxsChannelGroupItem::~GxsChannelGroupItem()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
|
@ -60,12 +60,14 @@ private slots:
|
||||
private:
|
||||
void fill();
|
||||
void setup();
|
||||
void addEventHandler();
|
||||
|
||||
private:
|
||||
RsGxsChannelGroup mGroup;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsChannelGroupItem *ui;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -251,7 +251,7 @@
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Subscribe to Channel</string>
|
||||
<string>Subscribe this Channel</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Subscribe</string>
|
||||
|
@ -49,6 +49,10 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
||||
GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate),
|
||||
mGroupMeta(group_meta)
|
||||
{
|
||||
mLoadingGroup = false;
|
||||
mLoadingMessage = false;
|
||||
mLoadingComment = false;
|
||||
|
||||
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||
mPost.mMeta.mGroupId = mGroupMeta.mGroupId;
|
||||
|
||||
@ -136,6 +140,19 @@ void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||
|
||||
GxsChannelPostItem::~GxsChannelPostItem()
|
||||
{
|
||||
auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(300);
|
||||
|
||||
while( (mLoadingGroup || mLoadingMessage || mLoadingComment)
|
||||
&& std::chrono::steady_clock::now() < timeout)
|
||||
{
|
||||
RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for "
|
||||
<< (mLoadingGroup ? "Group " : "")
|
||||
<< (mLoadingMessage ? "Message " : "")
|
||||
<< (mLoadingComment ? "Comment " : "")
|
||||
<< "loading." << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
@ -277,6 +294,7 @@ void GxsChannelPostItem::loadGroup()
|
||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
mLoadingGroup = true;
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
@ -306,6 +324,7 @@ void GxsChannelPostItem::loadGroup()
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mGroupMeta = group.mMeta;
|
||||
mLoadingGroup = false;
|
||||
|
||||
}, this );
|
||||
});
|
||||
@ -316,6 +335,8 @@ void GxsChannelPostItem::loadMessage()
|
||||
std::cerr << "GxsChannelPostItem::loadMessage()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
mLoadingMessage = true;
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
@ -337,7 +358,11 @@ void GxsChannelPostItem::loadMessage()
|
||||
#endif
|
||||
const RsGxsChannelPost& post(posts[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this );
|
||||
RsQThreadUtils::postToObject( [post,this]()
|
||||
{
|
||||
setPost(post);
|
||||
mLoadingMessage = false;
|
||||
}, this );
|
||||
}
|
||||
else if(comments.size() == 1)
|
||||
{
|
||||
@ -356,7 +381,8 @@ void GxsChannelPostItem::loadMessage()
|
||||
setMessageId(cmt.mMeta.mThreadId);
|
||||
requestMessage();
|
||||
|
||||
}, this );
|
||||
mLoadingMessage = false;
|
||||
}, this );
|
||||
|
||||
}
|
||||
else
|
||||
@ -366,7 +392,11 @@ void GxsChannelPostItem::loadMessage()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsQThreadUtils::postToObject( [this]() { removeItem(); }, this );
|
||||
RsQThreadUtils::postToObject( [this]()
|
||||
{
|
||||
removeItem();
|
||||
mLoadingMessage = false;
|
||||
}, this );
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -377,6 +407,7 @@ void GxsChannelPostItem::loadComment()
|
||||
std::cerr << "GxsChannelPostItem::loadComment()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
mLoadingComment = true;
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
@ -407,6 +438,7 @@ void GxsChannelPostItem::loadComment()
|
||||
sComButText = tr("Comments ").append("(%1)").arg(comNb);
|
||||
|
||||
ui->commentButton->setText(sComButText);
|
||||
mLoadingComment = false;
|
||||
|
||||
}, this );
|
||||
});
|
||||
|
@ -119,7 +119,12 @@ private:
|
||||
private:
|
||||
bool mInFill;
|
||||
bool mCloseOnRead;
|
||||
bool mLoaded;
|
||||
bool mLoaded;
|
||||
|
||||
bool mLoadingMessage;
|
||||
bool mLoadingGroup;
|
||||
bool mLoadingComment;
|
||||
|
||||
|
||||
RsGroupMetaData mGroupMeta;
|
||||
RsGxsChannelPost mPost;
|
||||
|
@ -35,8 +35,8 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
|
||||
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
addEventHandler();
|
||||
}
|
||||
|
||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate):
|
||||
@ -45,21 +45,48 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
|
||||
mRemovedModerators(removed_moderators)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
addEventHandler();
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::addEventHandler()
|
||||
{
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
const auto *e = dynamic_cast<const RsGxsForumEvent*>(event.get());
|
||||
|
||||
if(!e || e->mForumGroupId != this->groupId())
|
||||
return;
|
||||
|
||||
switch(e->mForumEventCode)
|
||||
{
|
||||
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||
case RsForumEventCode::UPDATED_FORUM:
|
||||
case RsForumEventCode::MODERATOR_LIST_CHANGED:
|
||||
loadGroup();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}, this );
|
||||
}, mEventHandlerId, RsEventType::GXS_FORUMS );
|
||||
}
|
||||
|
||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) :
|
||||
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
setGroup(group);
|
||||
addEventHandler();
|
||||
}
|
||||
|
||||
GxsForumGroupItem::~GxsForumGroupItem()
|
||||
{
|
||||
delete(ui);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
void GxsForumGroupItem::setup()
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define _GXSFORUMGROUPITEM_H
|
||||
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
#include <retroshare/rsevents.h>
|
||||
#include "gui/gxs/GxsGroupFeedItem.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -39,27 +40,28 @@ public:
|
||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate);
|
||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate);
|
||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate);
|
||||
~GxsForumGroupItem();
|
||||
virtual ~GxsForumGroupItem() override;
|
||||
|
||||
bool setGroup(const RsGxsForumGroup &group);
|
||||
|
||||
uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumGroupItem " + groupId().toStdString()) ; }
|
||||
protected:
|
||||
/* FeedItem */
|
||||
virtual void doExpand(bool open);
|
||||
void toggle() override;
|
||||
virtual void doExpand(bool open) override;
|
||||
|
||||
/* GxsGroupFeedItem */
|
||||
virtual QString groupName();
|
||||
virtual QString groupName() override;
|
||||
virtual void loadGroup() override;
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
||||
virtual RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_FORUM; }
|
||||
|
||||
private slots:
|
||||
void subscribeForum();
|
||||
void toggle() override;
|
||||
|
||||
private:
|
||||
void fill();
|
||||
void setup();
|
||||
void addEventHandler();
|
||||
|
||||
private:
|
||||
RsGxsForumGroup mGroup;
|
||||
@ -69,6 +71,8 @@ private:
|
||||
|
||||
std::list<RsGxsId> mAddedModerators;
|
||||
std::list<RsGxsId> mRemovedModerators;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -47,7 +47,13 @@ GxsForumMsgItem::GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const
|
||||
{
|
||||
mMessage.mMeta.mMsgId = messageId; // useful for uniqueIdentifier() before the post is actually loaded
|
||||
mMessage.mMeta.mGroupId = groupId;
|
||||
setup();
|
||||
|
||||
mLoadingGroup = false;
|
||||
mLoadingMessage = false;
|
||||
mLoadingSetAsRead = false;
|
||||
mLoadingParentMessage = false;
|
||||
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
requestMessage();
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QDateTime>
|
||||
|
||||
//#define DEBUG_COMMENT_DIALOG 1
|
||||
|
||||
/** Constructor */
|
||||
GxsCommentDialog::GxsCommentDialog(QWidget *parent, const RsGxsId &default_author, RsGxsCommentService *comment_service)
|
||||
: QWidget(parent), ui(new Ui::GxsCommentDialog)
|
||||
@ -95,8 +97,11 @@ void GxsCommentDialog::commentClear()
|
||||
}
|
||||
void GxsCommentDialog::commentLoad(const RsGxsGroupId &grpId, const std::set<RsGxsMessageId>& msg_versions,const RsGxsMessageId& most_recent_msgId,bool use_cache)
|
||||
{
|
||||
std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", most recent msg version: " << most_recent_msgId << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_COMMENT_DIALOG
|
||||
std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", most recent msg version: " << most_recent_msgId << ")" << std::endl;
|
||||
for(const auto& mid:msg_versions)
|
||||
std::cerr << " msg version: " << mid << std::endl;
|
||||
#endif
|
||||
|
||||
mGrpId = grpId;
|
||||
mMostRecentMsgId = most_recent_msgId;
|
||||
|
@ -42,6 +42,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//#define DEBUG_COMMENT_TREE_WIDGET
|
||||
|
||||
#define PCITEM_COLUMN_COMMENT 0
|
||||
#define PCITEM_COLUMN_AUTHOR 1
|
||||
#define PCITEM_COLUMN_DATE 2
|
||||
@ -73,6 +75,7 @@ std::map<RsGxsMessageId, std::vector<RsGxsComment> > GxsCommentTreeWidget::mComm
|
||||
QMutex GxsCommentTreeWidget::mCacheMutex;
|
||||
|
||||
//#define USE_NEW_DELEGATE 1
|
||||
//#define DEBUG_GXSCOMMENT_TREEWIDGET 1
|
||||
|
||||
// This class allows to draw the item using an appropriate size
|
||||
|
||||
@ -508,6 +511,8 @@ void GxsCommentTreeWidget::service_requestComments(const RsGxsGroupId& group_id,
|
||||
/* request comments */
|
||||
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
|
||||
std::cerr << "GxsCommentTreeWidget::service_requestComments for group " << group_id << std::endl;
|
||||
for(const auto& mid:msgIds)
|
||||
std::cerr << " including message " << mid << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this,group_id,msgIds]()
|
||||
@ -765,8 +770,10 @@ void GxsCommentTreeWidget::insertComments(const std::vector<RsGxsComment>& comme
|
||||
new_comments.push_back(comment.mMeta.mMsgId);
|
||||
|
||||
/* convert to a QTreeWidgetItem */
|
||||
#ifdef DEBUG_COMMENT_TREE_WIDGET
|
||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL,GxsIdDetails::ICON_TYPE_AVATAR) ;
|
||||
QString text;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/RichTextEdit.h"
|
||||
#include "util/imageutil.h"
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
@ -607,11 +608,13 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
|
||||
if(imageBuffer == NULL)
|
||||
return false;
|
||||
|
||||
QImage tNail(imageBuffer, width, height, QImage::Format_RGB32);
|
||||
QImage tNail(imageBuffer, width, height, QImage::Format_RGBA32);
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
bool has_transparency = ImageUtil::hasAlphaContent(tNail.toImage());
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
tNail.save(&buffer, "JPG");
|
||||
tNail.save(&buffer, has_transparency?"PNG":"JPG");
|
||||
QPixmap img;
|
||||
img.loadFromData(ba, "PNG");
|
||||
img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
@ -797,15 +800,19 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
RsGxsImage image;
|
||||
RsGxsImage image;
|
||||
QPixmap pixmap;
|
||||
pixmap = preview_W->getCroppedScaledPicture();
|
||||
QImage qimg = pixmap.toImage();
|
||||
bool has_transparency = ImageUtil::hasAlphaContent(qimg);
|
||||
|
||||
if(!picture.isNull())
|
||||
{
|
||||
// send chan image
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
preview_W->getCroppedScaledPicture().save(&buffer, "JPG"); // writes image into ba in PNG format
|
||||
image.copy((uint8_t *) ba.data(), ba.size());
|
||||
preview_W->getCroppedScaledPicture().save(&buffer, has_transparency?"PNG":"JPG"); // writes image into ba in PNG format
|
||||
image.copy((uint8_t *) ba.data(), ba.size());
|
||||
}
|
||||
|
||||
std::string error_string;
|
||||
|
@ -176,6 +176,25 @@ int RsGxsChannelPostsModel::rowCount(const QModelIndex& parent) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RsGxsChannelPostsModel::columnCount(int row) const
|
||||
{
|
||||
if(mTreeMode == TREE_MODE_GRID)
|
||||
{
|
||||
if(row+1 == rowCount())
|
||||
{
|
||||
int r = ((int)mFilteredPosts.size() % (int)mColumns);
|
||||
|
||||
if(r > 0)
|
||||
return r;
|
||||
else
|
||||
return columnCount();
|
||||
}
|
||||
else
|
||||
return columnCount();
|
||||
}
|
||||
else
|
||||
return 2;
|
||||
}
|
||||
int RsGxsChannelPostsModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
if(mTreeMode == TREE_MODE_GRID)
|
||||
@ -245,7 +264,7 @@ bool RsGxsChannelPostsModel::convertRefPointerToTabEntry(quintptr ref, uint32_t&
|
||||
|
||||
QModelIndex RsGxsChannelPostsModel::index(int row, int column, const QModelIndex & parent) const
|
||||
{
|
||||
if(row < 0 || column < 0 || column >= (int)mColumns)
|
||||
if(row < 0 || column < 0 || row >= rowCount() || column >= columnCount(row))
|
||||
return QModelIndex();
|
||||
|
||||
quintptr ref = getChildRef(parent.internalId(),(mTreeMode == TREE_MODE_GRID)?(column + row*mColumns):row);
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
|
||||
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
|
||||
QModelIndex getIndexOfMessage(const RsGxsMessageId& mid) const;
|
||||
int columnCount(int row) const; // columns in the row of this particular index.
|
||||
|
||||
std::vector<std::pair<time_t,RsGxsMessageId> > getPostVersions(const RsGxsMessageId& mid) const;
|
||||
|
||||
|
@ -504,6 +504,30 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
||||
}, mEventHandlerId, RsEventType::GXS_CHANNELS );
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidgetWithModel::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
||||
|
||||
if(index.isValid() && mChannelPostsModel->getMode() == RsGxsChannelPostsModel::TREE_MODE_GRID)
|
||||
{
|
||||
int n = mChannelPostsModel->columnCount(index.row())-1;
|
||||
|
||||
if(e->key() == Qt::Key_Left && index.column()==0)
|
||||
{
|
||||
ui->postsTree->setCurrentIndex(index.sibling(index.row(),n));
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
if(e->key() == Qt::Key_Right && index.column()==n)
|
||||
{
|
||||
ui->postsTree->setCurrentIndex(index.sibling(index.row(),0));
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GxsMessageFrameWidget::keyPressEvent(e);
|
||||
}
|
||||
void GxsChannelPostsWidgetWithModel::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
GxsMessageFrameWidget::resizeEvent(e);
|
||||
|
@ -139,6 +139,7 @@ protected:
|
||||
/* GxsMessageFrameWidget */
|
||||
virtual void setAllMessagesReadDo(bool read) override;
|
||||
virtual void resizeEvent(QResizeEvent *e) override;
|
||||
virtual void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void showPostDetails();
|
||||
|
@ -255,7 +255,7 @@ private:
|
||||
QList<QLabel*> tagLabels;
|
||||
|
||||
// needed to send system flags with reply
|
||||
unsigned msgFlags;
|
||||
unsigned int msgFlags;
|
||||
|
||||
RSTreeWidgetItemCompareRole *m_compareRole;
|
||||
QCompleter *m_completer;
|
||||
|
@ -690,6 +690,10 @@ void RsMessageModel::setCurrentBox(Rs::Msgs::BoxName bn)
|
||||
}
|
||||
}
|
||||
|
||||
Rs::Msgs::BoxName RsMessageModel::currentBox() const
|
||||
{
|
||||
return mCurrentBox;
|
||||
}
|
||||
void RsMessageModel::setQuickViewFilter(QuickViewFilter fn)
|
||||
{
|
||||
if(fn != mQuickViewFilter)
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
// This method will asynchroneously update the data
|
||||
|
||||
void setCurrentBox(Rs::Msgs::BoxName bn) ;
|
||||
Rs::Msgs::BoxName currentBox() const ;
|
||||
void setQuickViewFilter(QuickViewFilter fn) ;
|
||||
|
||||
void setFilter(FilterType filter_type, const QStringList& strings) ;
|
||||
|
@ -738,7 +738,8 @@ void MessageWidget::remove()
|
||||
return;
|
||||
}
|
||||
|
||||
bool deleteReal = false;
|
||||
#ifdef TO_REMOVE
|
||||
bool deleteReal = false;
|
||||
if (msgInfo.msgflags & RS_MSG_TRASH) {
|
||||
deleteReal = true;
|
||||
} else {
|
||||
@ -763,8 +764,8 @@ void MessageWidget::remove()
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
emit messageRemoved();
|
||||
#endif
|
||||
emit messageRemovalRequested(currMsgId);
|
||||
}
|
||||
|
||||
void MessageWidget::print()
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
|
||||
signals:
|
||||
void messageRemoved();
|
||||
void messageRemovalRequested(std::string);
|
||||
|
||||
private slots:
|
||||
void reply();
|
||||
|
@ -95,6 +95,7 @@
|
||||
#define ROW_SENTBOX 3
|
||||
#define ROW_TRASHBOX 4
|
||||
|
||||
// #define DEBUG_MESSAGES_DIALOG 1
|
||||
|
||||
class MessageSortFilterProxyModel: public QSortFilterProxyModel
|
||||
{
|
||||
@ -144,7 +145,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
|
||||
msgWidget = new MessageWidget(true, this);
|
||||
ui.msgLayout->addWidget(msgWidget);
|
||||
connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved()));
|
||||
connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage()));
|
||||
|
||||
connectActions();
|
||||
|
||||
@ -365,15 +366,18 @@ void MessagesDialog::preModelUpdate()
|
||||
if (m.isValid()) {
|
||||
mTmpSavedCurrentId = m.sibling(m.row(), RsMessageModel::COLUMN_THREAD_MSGID).data(RsMessageModel::MsgIdRole).toString();
|
||||
}
|
||||
|
||||
#ifdef DEBUG_MESSAGES_DIALOG
|
||||
std::cerr << "Pre-change: saving selection for " << mTmpSavedSelectedIds.size() << " indexes" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MessagesDialog::postModelUpdate()
|
||||
{
|
||||
// restore selection
|
||||
|
||||
#ifdef DEBUG_MESSAGES_DIALOG
|
||||
std::cerr << "Post-change: restoring selection for " << mTmpSavedSelectedIds.size() << " indexes" << std::endl;
|
||||
#endif
|
||||
QItemSelection sel;
|
||||
|
||||
foreach(const QString& s,mTmpSavedSelectedIds)
|
||||
@ -838,7 +842,7 @@ void MessagesDialog::openAsWindow()
|
||||
}
|
||||
|
||||
msgWidget->activateWindow();
|
||||
connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved()));
|
||||
connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage()));
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
@ -858,7 +862,7 @@ void MessagesDialog::openAsTab()
|
||||
|
||||
ui.tabWidget->addTab(msgWidget,FilesDefs::getIconFromQtResourcePath(IMAGE_MAIL), msgWidget->subject(true));
|
||||
ui.tabWidget->setCurrentWidget(msgWidget);
|
||||
connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved()));
|
||||
connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage()));
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
@ -921,9 +925,9 @@ void MessagesDialog::changeBox(int box_row)
|
||||
|
||||
ui.messageTreeWidget->setPlaceholderText(placeholderText);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_READ,box_row!=ROW_INBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row==ROW_OUTBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_SPAM,box_row==ROW_OUTBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row==ROW_OUTBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row!=ROW_INBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_SPAM,box_row!=ROW_INBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row!=ROW_INBOX);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_MSGID,true);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_CONTENT,true);
|
||||
}
|
||||
@ -1292,7 +1296,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||
/* calculating the new messages */
|
||||
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_ALL,msgList);
|
||||
rsMail->getMessageSummaries(mMessageModel->currentBox(),msgList);
|
||||
|
||||
QMap<int, int> tagCount;
|
||||
|
||||
|
@ -2436,7 +2436,7 @@ WireGroupItem QFrame#wire_frame QLabel{
|
||||
background: transparent;
|
||||
}
|
||||
WireGroupItem QFrame#wire_frame:hover {
|
||||
background-color: #2e8bab;
|
||||
background-color: #346792;
|
||||
}
|
||||
|
||||
PulseTopLevel QFrame#frame,
|
||||
@ -2446,13 +2446,6 @@ PulseReply QFrame#frame {
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
PulseAddDialog QTextEdit#textEdit_Pulse {
|
||||
border: 2px solid #c4cfd6;
|
||||
border-radius: 6px;
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
PulseReply #line_replyLine,
|
||||
PulseMessage #line{
|
||||
color: #c4cfd6;
|
||||
@ -2462,6 +2455,16 @@ PulseReply QLabel#label_groupName{
|
||||
color: #5b7083;
|
||||
}
|
||||
|
||||
PulseReplySeperator QFrame#frame {
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #455364, stop: 0.5 #54687A,stop: 0.6 #44586A, stop:1 #455364);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
QLabel#label_masthead{
|
||||
border: 2px solid #CCCCCC;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/**** Color definitions ****/
|
||||
|
||||
ForumsDialog, GxsForumThreadWidget
|
||||
@ -2552,10 +2555,3 @@ OpModeStatus[opMode="Minimal"] {
|
||||
[WrongValue="true"] {
|
||||
background-color: #702020;
|
||||
}
|
||||
|
||||
/**** The Wire ****/
|
||||
|
||||
QLabel#label_masthead{
|
||||
border: 2px solid #CCCCCC;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
@ -2687,6 +2687,12 @@ PulseReply QLabel#label_groupName{
|
||||
color: #5b7083;
|
||||
}
|
||||
|
||||
PulseReplySeperator QFrame#frame {
|
||||
border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}
|
||||
}
|
||||
|
||||
QLabel#label_masthead{
|
||||
border: 2px solid #CCCCCC;
|
||||
border-radius: 4px;
|
||||
|
@ -74,8 +74,13 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
foreach (QString code, LanguageSupport::languageCodes()) {
|
||||
ui.cmboLanguage->addItem(FilesDefs::getIconFromQtResourcePath(":/images/flags/" + code + ".png"), LanguageSupport::languageName(code), code);
|
||||
}
|
||||
foreach (QString style, QStyleFactory::keys()) {
|
||||
ui.cmboStyle->addItem(style, style.toLower());
|
||||
|
||||
// Note: apparently, on some linux systems (e.g. Debian 11), the gtk2 style makes Qt libs crash when the environment variable is not set.
|
||||
// So we first check that it's here before start.
|
||||
|
||||
foreach (QString style, QStyleFactory::keys()) {
|
||||
if(style.toLower() != "gtk2" || (getenv("QT_QPA_PLATFORMTHEME")!=nullptr && !strcmp(getenv("QT_QPA_PLATFORMTHEME"),"gtk2")))
|
||||
ui.cmboStyle->addItem(style, style.toLower());
|
||||
}
|
||||
|
||||
QMap<QString, QString> styleSheets;
|
||||
@ -266,9 +271,9 @@ void AppearancePage::load()
|
||||
|
||||
index = ui.mainPageButtonType_CB->findData(Settings->getPageButtonLoc());
|
||||
if (index != 0) {
|
||||
ui.cmboTollButtonsStyle->hide();
|
||||
}else {
|
||||
ui.cmboTollButtonsStyle->show();
|
||||
ui.cmboTollButtonsStyle->show();
|
||||
}else {
|
||||
ui.cmboTollButtonsStyle->hide();
|
||||
}
|
||||
|
||||
whileBlocking(ui.mainPageButtonType_CB)->setCurrentIndex(!Settings->getPageButtonLoc());
|
||||
|
@ -23,11 +23,14 @@
|
||||
#include "rsharesettings.h"
|
||||
#include "jsonapi/jsonapi.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QStringListModel>
|
||||
#include <QProgressDialog>
|
||||
|
||||
#define IMAGE_LEDOFF ":/images/ledoff1.png"
|
||||
#define IMAGE_LEDON ":/images/ledon1.png"
|
||||
|
||||
JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||
{
|
||||
@ -57,9 +60,41 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||
QRegExpValidator *ipValidator = new QRegExpValidator(ipRegex, this);
|
||||
|
||||
ui.listenAddressLineEdit->setValidator(ipValidator);
|
||||
ui.providersListView->setSelectionMode(QAbstractItemView::NoSelection); // prevents edition.
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
if(e->mType != RsEventType::JSON_API)
|
||||
return;
|
||||
|
||||
auto je = dynamic_cast<const RsJsonApiEvent*>(e.get());
|
||||
|
||||
if(!je)
|
||||
return;
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Caught JSONAPI event! code=" << static_cast<int>(je->mJsonApiEventCode) << std::endl;
|
||||
#endif
|
||||
|
||||
RsQThreadUtils::postToObject([=]() { load(); }, this );
|
||||
},
|
||||
mEventHandlerId, RsEventType::JSON_API );
|
||||
}
|
||||
|
||||
JsonApiPage::~JsonApiPage()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
QString JsonApiPage::helpText() const
|
||||
{
|
||||
return tr("<h1><img width=\"24\" src=\":/icons/help_64.png\"> Webinterface</h1> \
|
||||
<p>Retroshare provides a JSON API allowing other softwares to communicate with its core using token-controlled HTTP requests to http://localhost:[port]. \
|
||||
Please refer to the Retroshare documentation for how to use this feature. </p>\
|
||||
<p>Unless you know what you're doing, you shouldn't need to change anything in this page. \
|
||||
The web interface for instance will automatically register its own token to the JSON API which will be visible \
|
||||
in the list of authenticated tokens after you enable it.</p>");
|
||||
}
|
||||
void JsonApiPage::enableJsonApi(bool checked)
|
||||
{
|
||||
ui.addTokenPushButton->setEnabled(checked);
|
||||
@ -93,9 +128,9 @@ bool JsonApiPage::updateParams()
|
||||
|
||||
void JsonApiPage::load()
|
||||
{
|
||||
whileBlocking(ui.portSpinBox)->setValue(Settings->getJsonApiPort());
|
||||
whileBlocking(ui.listenAddressLineEdit)->setText(Settings->getJsonApiListenAddress());
|
||||
whileBlocking(ui.enableCheckBox)->setChecked(Settings->getJsonApiEnabled());
|
||||
whileBlocking(ui.portSpinBox)->setValue(rsJsonApi->listeningPort());
|
||||
whileBlocking(ui.listenAddressLineEdit)->setText(QString::fromStdString(rsJsonApi->getBindingAddress()));
|
||||
whileBlocking(ui.enableCheckBox)->setChecked(rsJsonApi->isRunning());
|
||||
|
||||
QStringList newTk;
|
||||
|
||||
@ -104,10 +139,20 @@ void JsonApiPage::load()
|
||||
QString::fromStdString(it.first) + ":" +
|
||||
QString::fromStdString(it.second) );
|
||||
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
||||
}
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
||||
|
||||
QString JsonApiPage::helpText() const { return ""; }
|
||||
QStringList newTk2;
|
||||
|
||||
for(const auto& it : rsJsonApi->getResourceProviders())
|
||||
newTk2.push_back( QString::fromStdString(it.get().getName())) ;
|
||||
|
||||
whileBlocking(ui.providersListView)->setModel(new QStringListModel(newTk2));
|
||||
|
||||
if(rsJsonApi->isRunning())
|
||||
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ;
|
||||
else
|
||||
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ;
|
||||
}
|
||||
|
||||
bool JsonApiPage::checkStartJsonApi()
|
||||
{
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "retroshare/rsevents.h"
|
||||
|
||||
#include "retroshare-gui/configpage.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "ui_JsonApiPage.h"
|
||||
@ -31,7 +33,7 @@ class JsonApiPage : public ConfigPage
|
||||
public:
|
||||
|
||||
JsonApiPage(QWidget * parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
~JsonApiPage() override = default;
|
||||
~JsonApiPage() override ;
|
||||
|
||||
virtual QPixmap iconPixmap() const override
|
||||
{
|
||||
@ -63,4 +65,6 @@ public slots:
|
||||
|
||||
private:
|
||||
Ui::JsonApiPage ui; /// Qt Designer generated object
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="WebuiPageVLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="jsonApiGroupBox">
|
||||
<property name="minimumSize">
|
||||
@ -25,13 +25,65 @@
|
||||
<property name="title">
|
||||
<string>JSON API Server</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable RetroShare JSON API Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable RetroShare JSON API Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabelLED">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Listen Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="listenAddressLineEdit">
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@ -57,24 +109,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Listen Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="listenAddressLineEdit">
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
@ -110,13 +144,23 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Authenticated Tokens</string>
|
||||
<string>Authenticated Tokens:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="tokensListView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Registered services:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="providersListView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -142,6 +186,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -107,6 +107,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
ui.hiddenpage_proxyPort_tor->setEnabled(false) ;
|
||||
ui.hiddenpage_localAddress->setEnabled(false) ;
|
||||
ui.hiddenpage_localPort->setEnabled(false) ;
|
||||
ui.hiddenpage_serviceAddress->setEnabled(false) ;
|
||||
ui.hiddenpage_servicePort->setEnabled(false) ;
|
||||
ui.testIncoming_PB->hide() ;
|
||||
ui.l_incomingTestResult->hide() ;
|
||||
ui.iconlabel_service_incoming->hide() ;
|
||||
|
@ -256,11 +256,14 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconlabel_ext">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -272,6 +275,12 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabel_ext">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The bullet turns green as soon as Retroshare manages to get your own IP from the websites listed below, if you enabled that action. Retroshare will also use other means to find out your own IP.</p></body></html></string>
|
||||
</property>
|
||||
@ -290,13 +299,29 @@
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabel_netLimited">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local network</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconlabel_netLimited">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -306,13 +331,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabel_netLimited">
|
||||
<property name="text">
|
||||
<string>Local network</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
@ -351,13 +369,29 @@
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabel_upnp">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>UPnP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconlabel_upnp">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -367,13 +401,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabel_upnp">
|
||||
<property name="text">
|
||||
<string>UPnP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
@ -386,11 +413,14 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconlabel_hiddenMode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -402,6 +432,12 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="textlabel_hiddenMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
@ -802,12 +838,6 @@ behind a firewall or a VPN.</string>
|
||||
<layout class="QHBoxLayout" name="hiddenpage_proxyOKHLayout_tor">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconlabel_tor_outgoing">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "retroshare/rswebui.h"
|
||||
#include "retroshare/rsjsonapi.h"
|
||||
|
||||
@ -40,6 +41,8 @@ resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0;
|
||||
#endif
|
||||
resource_api::RsControlModule* WebuiPage::controlModule = 0;
|
||||
|
||||
#define IMAGE_LEDOFF ":/images/ledoff1.png"
|
||||
#define IMAGE_LEDON ":/images/ledon1.png"
|
||||
|
||||
WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||
{
|
||||
@ -50,11 +53,22 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||
connect(ui.password_LE, SIGNAL(textChanged(QString)), this, SLOT(onPasswordValueChanged(QString)));
|
||||
connect(ui.startWebBrowser_PB, SIGNAL(clicked()), this, SLOT(onStartWebBrowserClicked()));
|
||||
connect(ui.webInterfaceFilesDirectory_PB, SIGNAL(clicked()), this, SLOT(selectWebInterfaceDirectory()));
|
||||
|
||||
mEventsHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> /* event */)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Caught JSONAPI event in webui!" << std::endl;
|
||||
#endif
|
||||
RsQThreadUtils::postToObject([=]() { load(); }, this );
|
||||
},
|
||||
mEventsHandlerId, RsEventType::JSON_API );
|
||||
}
|
||||
|
||||
WebuiPage::~WebuiPage()
|
||||
{
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventsHandlerId);
|
||||
}
|
||||
|
||||
void WebuiPage::selectWebInterfaceDirectory()
|
||||
@ -73,22 +87,12 @@ void WebuiPage::selectWebInterfaceDirectory()
|
||||
bool WebuiPage::updateParams(QString &errmsg)
|
||||
{
|
||||
std::cerr << "WebuiPage::save()" << std::endl;
|
||||
bool ok = true;
|
||||
bool changed = false;
|
||||
if(ui.enableWebUI_CB->isChecked() != Settings->getWebinterfaceEnabled())
|
||||
changed = true;
|
||||
if(ui.webInterfaceFiles_LE->text() != Settings->getWebinterfaceFilesDirectory())
|
||||
changed = true;
|
||||
|
||||
if(changed)
|
||||
{
|
||||
// store config
|
||||
Settings->setWebinterfaceEnabled(ui.enableWebUI_CB->isChecked());
|
||||
Settings->setWebinterfaceFilesDirectory(ui.webInterfaceFiles_LE->text());
|
||||
// store config
|
||||
Settings->setWebinterfaceEnabled(ui.enableWebUI_CB->isChecked());
|
||||
Settings->setWebinterfaceFilesDirectory(ui.webInterfaceFiles_LE->text());
|
||||
|
||||
rsWebUi->setHtmlFilesDirectory(ui.webInterfaceFiles_LE->text().toStdString());
|
||||
}
|
||||
return ok;
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebuiPage::onPasswordValueChanged(QString password)
|
||||
@ -112,12 +116,27 @@ void WebuiPage::onPasswordValueChanged(QString password)
|
||||
|
||||
bool WebuiPage::restart()
|
||||
{
|
||||
return checkStartWebui();
|
||||
if(ui.password_LE->text().isNull())
|
||||
{
|
||||
QMessageBox::critical(nullptr,tr("Missing passphrase"),tr("Please set a passphrase to proect the access to the WEB interface."));
|
||||
return false;
|
||||
}
|
||||
|
||||
rsWebUi->setUserPassword(ui.password_LE->text().toStdString());
|
||||
rsWebUi->setHtmlFilesDirectory(ui.webInterfaceFiles_LE->text().toStdString());
|
||||
|
||||
setCursor(Qt::WaitCursor) ;
|
||||
rsWebUi->restart();
|
||||
setCursor(Qt::ArrowCursor) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebuiPage::load()
|
||||
void WebuiPage::loadParams()
|
||||
{
|
||||
std::cerr << "WebuiPage::load()" << std::endl;
|
||||
#ifdef DEBUG
|
||||
std::cerr << "WebuiPage::load()" << std::endl;
|
||||
#endif
|
||||
whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled());
|
||||
whileBlocking(ui.webInterfaceFiles_LE)->setText(Settings->getWebinterfaceFilesDirectory());
|
||||
|
||||
@ -127,6 +146,15 @@ void WebuiPage::load()
|
||||
|
||||
if(it != smap.end())
|
||||
whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second));
|
||||
else
|
||||
whileBlocking(ui.enableWebUI_CB)->setChecked(false);
|
||||
|
||||
if(rsWebUi->isRunning())
|
||||
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ;
|
||||
else
|
||||
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ;
|
||||
#else
|
||||
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -138,13 +166,11 @@ QString WebuiPage::helpText() const
|
||||
<p>Warning: don't expose the webinterface to the internet, because there is no access control and no encryption. If you want to use the webinterface over the internet, use a SSH tunnel or a proxy to secure the connection.</p>");
|
||||
}
|
||||
|
||||
/*static*/ bool WebuiPage::checkStartWebui()
|
||||
/*static*/ bool WebuiPage::checkStartWebui() // This is supposed to be called from main(). But normally the parameters below (including the paswd
|
||||
// for the webUI should be saved in p3webui instead.
|
||||
{
|
||||
if(!Settings->getWebinterfaceEnabled())
|
||||
return false;
|
||||
|
||||
rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString());
|
||||
rsWebUi->restart();
|
||||
rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString());
|
||||
rsWebUi->restart();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -173,15 +199,21 @@ QString WebuiPage::helpText() const
|
||||
|
||||
void WebuiPage::onEnableCBClicked(bool checked)
|
||||
{
|
||||
ui.params_GB->setEnabled(checked);
|
||||
ui.apply_PB->setEnabled(checked);
|
||||
ui.startWebBrowser_PB->setEnabled(checked);
|
||||
QString S;
|
||||
QString errmsg;
|
||||
updateParams(errmsg);
|
||||
|
||||
Settings->setWebinterfaceEnabled(checked);
|
||||
ui.params_GB->setEnabled(checked);
|
||||
ui.startWebBrowser_PB->setEnabled(checked);
|
||||
ui.apply_PB->setEnabled(checked);
|
||||
|
||||
if(checked)
|
||||
checkStartWebui();
|
||||
{
|
||||
if(!restart())
|
||||
{
|
||||
QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
checkShutdownWebui();
|
||||
}
|
||||
@ -199,18 +231,12 @@ void WebuiPage::onAllIPCBClicked(bool /*checked*/)
|
||||
}
|
||||
void WebuiPage::onApplyClicked()
|
||||
{
|
||||
rsWebUi->setUserPassword(ui.password_LE->text().toStdString());
|
||||
|
||||
QString errmsg;
|
||||
updateParams(errmsg);
|
||||
|
||||
if(!restart())
|
||||
{
|
||||
QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface.");
|
||||
return;
|
||||
}
|
||||
restart();
|
||||
|
||||
emit passwordChanged();
|
||||
load();
|
||||
}
|
||||
|
||||
void WebuiPage::onStartWebBrowserClicked() { showWebui(); }
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "retroshare/rsevents.h"
|
||||
|
||||
#include "retroshare-gui/configpage.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "ui_WebuiPage.h"
|
||||
@ -42,11 +44,11 @@ public:
|
||||
~WebuiPage();
|
||||
|
||||
/** Loads the settings for this page */
|
||||
virtual void load();
|
||||
virtual void load() override { loadParams() ; }
|
||||
|
||||
virtual QPixmap iconPixmap() const { return FilesDefs::getPixmapFromQtResourcePath(":/icons/settings/webinterface.svg") ; }
|
||||
virtual QString pageName() const { return tr("Webinterface") ; }
|
||||
virtual QString helpText() const;
|
||||
virtual QPixmap iconPixmap() const override { return FilesDefs::getPixmapFromQtResourcePath(":/icons/settings/webinterface.svg") ; }
|
||||
virtual QString pageName() const override { return tr("Webinterface") ; }
|
||||
virtual QString helpText() const override ;
|
||||
|
||||
// call this after start of libretroshare/Retroshare
|
||||
// checks the settings and starts the webinterface if required
|
||||
@ -67,10 +69,9 @@ public slots:
|
||||
void onApplyClicked();
|
||||
void onStartWebBrowserClicked();
|
||||
|
||||
signals:
|
||||
void passwordChanged();
|
||||
|
||||
private:
|
||||
virtual void loadParams();
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::WebuiPage ui;
|
||||
|
||||
@ -83,4 +84,6 @@ private:
|
||||
static resource_api::ApiServerLocal* apiServerLocal;
|
||||
#endif
|
||||
static resource_api::RsControlModule* controlModule;
|
||||
|
||||
RsEventsHandlerId_t mEventsHandlerId;
|
||||
};
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>960</width>
|
||||
<height>717</height>
|
||||
<width>570</width>
|
||||
<height>646</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -15,11 +15,45 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableWebUI_CB">
|
||||
<property name="text">
|
||||
<string>Enable Retroshare WEB Interface</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableWebUI_CB">
|
||||
<property name="text">
|
||||
<string>Enable Retroshare WEB Interface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabelLED">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="params_GB">
|
||||
|
@ -178,10 +178,7 @@ SettingsPage::initStackedWidget()
|
||||
JsonApiPage *jsonapi_p = new JsonApiPage() ;
|
||||
addPage(jsonapi_p);
|
||||
#ifdef RS_WEBUI
|
||||
WebuiPage *webui_p = new WebuiPage() ;
|
||||
addPage(new WebuiPage() );
|
||||
|
||||
QObject::connect(webui_p,SIGNAL(passwordChanged()),jsonapi_p,SLOT(load()));
|
||||
addPage(new WebuiPage());
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "util/stacktrace.h"
|
||||
#include "util/argstream.h"
|
||||
#include "retroshare/rswebui.h"
|
||||
|
||||
CrashStackTrace gCrashStackTrace;
|
||||
|
||||
@ -380,7 +381,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* recreate global settings object, now with correct path */
|
||||
/* recreate global settings object, now with correct path, specific to the selected node */
|
||||
RshareSettings::Create(true);
|
||||
Rshare::resetLanguageAndStyle();
|
||||
|
||||
@ -537,8 +538,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
//
|
||||
|
||||
qRegisterMetaType<RsPeerId>("RsPeerId") ;
|
||||
|
||||
#ifdef DEBUG
|
||||
std::cerr << "connecting signals and slots" << std::endl ;
|
||||
#endif
|
||||
QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
|
||||
@ -571,13 +573,18 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
|
||||
notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt.
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
JsonApiPage::checkStartJsonApi();
|
||||
// Read webui params in settings. We cannot save them to some webui.cfg because cfg needs the node id and
|
||||
// jsonapi is started before node ID selection in retroshare-service.
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
#ifdef RS_WEBUI
|
||||
WebuiPage::checkStartWebui(); // normally we should rather save the UI flags internally to p3webui
|
||||
conf.enableWebUI = Settings->getWebinterfaceEnabled();
|
||||
|
||||
if(!Settings->getWebinterfaceFilesDirectory().isNull())
|
||||
rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString());
|
||||
#endif
|
||||
RsInit::startupWebServices(conf,false);
|
||||
#endif
|
||||
#endif // RS_JSONAPI
|
||||
|
||||
/* dive into the endless loop */
|
||||
int ti = rshare.exec();
|
||||
|
@ -184,3 +184,9 @@ QLabel#label_masthead{
|
||||
border: 2px solid #CCCCCC;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
PulseReplySeperator QFrame#frame {
|
||||
border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}
|
||||
}
|
||||
|
@ -139,17 +139,22 @@ static bool notifyRunningInstance()
|
||||
// that a new process had been started
|
||||
QLocalSocket localSocket;
|
||||
localSocket.connectToServer(QString(TARGET));
|
||||
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Rshare::Rshare waitForConnected to other instance." << std::endl;
|
||||
#endif
|
||||
if( localSocket.waitForConnected(100) )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Rshare::Rshare Connection etablished. Waiting for disconnection." << std::endl;
|
||||
#endif
|
||||
localSocket.waitForDisconnected(1000);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Rshare::Rshare failed to connect to other instance." << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ if(EXISTS "${LIBRETROSHARE_DEVEL_DIR}/CMakeLists.txt" )
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
libretroshare
|
||||
GIT_REPOSITORY "https://gitlab.com/RetroShare/libretroshare.git"
|
||||
GIT_REPOSITORY "https://github.com/RetroShare/libretroshare.git"
|
||||
GIT_TAG "origin/master"
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
@ -116,15 +116,17 @@ if(RS_SERVICE_DESKTOP)
|
||||
|
||||
install(
|
||||
FILES data/retroshare-service_48x48.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps/retroshare-service.png )
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps/
|
||||
RENAME retroshare-service.png)
|
||||
|
||||
install(
|
||||
FILES data/retroshare-service_128x128.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps/retroshare-service.png )
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps/
|
||||
RENAME retroshare-service.png )
|
||||
|
||||
install(
|
||||
FILES data/retroshare-service.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/data/retroshare-service.desktop )
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/data/ )
|
||||
endif(UNIX AND NOT APPLE)
|
||||
endif(RS_SERVICE_DESKTOP)
|
||||
|
||||
@ -149,7 +151,7 @@ if(RS_WEBUI)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
webui
|
||||
GIT_REPOSITORY "https://gitlab.com/RetroShare/RetroShareWebUI.git"
|
||||
GIT_REPOSITORY "https://github.com/RetroShare/RSNewWebUI.git"
|
||||
GIT_TAG "origin/master"
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "retroshare/rsiface.h"
|
||||
|
||||
#include "util/stacktrace.h"
|
||||
#include "util/rsprint.h"
|
||||
#include "util/argstream.h"
|
||||
#include "util/rskbdinput.h"
|
||||
#include "util/rsdir.h"
|
||||
@ -48,6 +49,28 @@
|
||||
|
||||
static CrashStackTrace gCrashStackTrace;
|
||||
|
||||
// We should move these functions to rsprint in libretroshare
|
||||
|
||||
#define COLOR_GREEN 0
|
||||
#define COLOR_YELLOW 1
|
||||
#define COLOR_BLUE 2
|
||||
#define COLOR_PURPLE 3
|
||||
#define COLOR_RED 4
|
||||
|
||||
std::string colored(int color,const std::string& s)
|
||||
{
|
||||
switch(color)
|
||||
{
|
||||
case COLOR_GREEN : return "\033[0;32m"+s+"\033[0m";
|
||||
case COLOR_YELLOW: return "\033[0;33m"+s+"\033[0m";
|
||||
case COLOR_BLUE : return "\033[0;36m"+s+"\033[0m";
|
||||
case COLOR_PURPLE: return "\033[0;35m"+s+"\033[0m";
|
||||
case COLOR_RED : return "\033[0;31m"+s+"\033[0m";
|
||||
default:
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RS_SERVICE_TERMINAL_LOGIN
|
||||
class RsServiceNotify: public NotifyClient
|
||||
{
|
||||
@ -59,9 +82,7 @@ public:
|
||||
const std::string& title, const std::string& question,
|
||||
bool /*prev_is_bad*/, std::string& password, bool& cancel )
|
||||
{
|
||||
std::string question1 = title +
|
||||
"\nPlease enter your PGP password for key:\n " +
|
||||
question + " :";
|
||||
std::string question1 = title + colored(COLOR_GREEN,"Please enter your PGP password for key:\n ") + question + " :";
|
||||
password = RsUtil::rs_getpass(question1.c_str()) ;
|
||||
cancel = false ;
|
||||
|
||||
@ -90,6 +111,33 @@ int main(int argc, char* argv[])
|
||||
signal(SIGBREAK, signalHandler);
|
||||
#endif // ifdef SIGBREAK
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
// Enable ANSI color support in Windows console
|
||||
{
|
||||
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4
|
||||
#endif
|
||||
|
||||
HANDLE hStdin = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (hStdin) {
|
||||
DWORD consoleMode;
|
||||
if (GetConsoleMode(hStdin, &consoleMode)) {
|
||||
if ((consoleMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == 0) {
|
||||
if (SetConsoleMode(hStdin, consoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) {
|
||||
std::cout << "Enabled ANSI color support in console" << std::endl;
|
||||
} else {
|
||||
RsErr() << "Error getting console mode" << std::endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RsErr() << "Error getting console mode" << std::endl;
|
||||
}
|
||||
} else {
|
||||
RsErr() << "Error getting stdin handle" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
RsInfo() << "\n" <<
|
||||
"+================================================================+\n"
|
||||
"| o---o o |\n"
|
||||
@ -181,31 +229,45 @@ int main(int argc, char* argv[])
|
||||
|
||||
while(keepRunning)
|
||||
{
|
||||
webui_pass1 = RsUtil::rs_getpass(
|
||||
"Please register a password for the web interface: " );
|
||||
webui_pass2 = RsUtil::rs_getpass(
|
||||
"Please enter the same password again : " );
|
||||
webui_pass1 = RsUtil::rs_getpass( colored(COLOR_GREEN,"Please register a password for the web interface: "));
|
||||
webui_pass2 = RsUtil::rs_getpass( colored(COLOR_GREEN,"Please enter the same password again : "));
|
||||
|
||||
if(webui_pass1 != webui_pass2)
|
||||
{
|
||||
std::cout << "Passwords do not match!" << std::endl;
|
||||
std::cout << colored(COLOR_RED,"Passwords do not match!") << std::endl;
|
||||
continue;
|
||||
}
|
||||
if(webui_pass1.empty())
|
||||
{
|
||||
std::cout << "Password cannot be empty!" << std::endl;
|
||||
std::cout << colored(COLOR_RED,"Password cannot be empty!") << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef RS_SERVICE_TERMINAL_WEBUI_PASSWORD
|
||||
if(askWebUiPassword && !webui_pass1.empty())
|
||||
{
|
||||
rsWebUi->setHtmlFilesDirectory(webui_base_directory);
|
||||
conf.webUIPasswd = webui_pass1; // cannot be set using rsWebUI methods because it calls the still non-existent rsJsonApi
|
||||
conf.enableWebUI = true;
|
||||
|
||||
// JsonApi is started below in InitRetroShare(). Not calling restart here avoids multiple restart.
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(RS_JSONAPI) && defined(RS_WEBUI)
|
||||
&& defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) */
|
||||
|
||||
conf.main_executable_path = argv[0];
|
||||
|
||||
int initResult = RsInit::InitRetroShare(conf);
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
RsInit::startupWebServices(conf,true);
|
||||
rstime::rs_usleep(1000000); // waits for jas->restart to print stuff
|
||||
#endif
|
||||
|
||||
if(initResult != RS_INIT_OK)
|
||||
{
|
||||
RsFatal() << "Retroshare core initalization failed with: " << initResult
|
||||
@ -223,28 +285,27 @@ int main(int argc, char* argv[])
|
||||
|
||||
if(locations.size() == 0)
|
||||
{
|
||||
RsErr() << "No available accounts. You cannot use option -U list" << std::endl;
|
||||
RsErr() << colored(COLOR_RED,"No available accounts. You cannot use option -U list") << std::endl;
|
||||
return -RsInit::ERR_NO_AVAILABLE_ACCOUNT;
|
||||
}
|
||||
|
||||
std::cout << std::endl << std::endl
|
||||
<< "Available accounts:" << std::endl;
|
||||
<< colored(COLOR_GREEN,"Available accounts:") << std::endl<<std::endl;
|
||||
|
||||
int accountCountDigits = static_cast<int>( ceil(log(locations.size())/log(10.0)) );
|
||||
|
||||
for( uint32_t i=0; i<locations.size(); ++i )
|
||||
std::cout << "[" << std::setw(accountCountDigits)
|
||||
<< std::setfill('0') << i+1 << "] "
|
||||
<< locations[i].mLocationId << " ("
|
||||
<< locations[i].mPgpId << "): "
|
||||
<< locations[i].mPgpName
|
||||
<< " \t (" << locations[i].mLocationName << ")"
|
||||
std::cout << colored(COLOR_GREEN," [" + RsUtil::NumberToString(i+1,false,'0',accountCountDigits)+"]") << " "
|
||||
<< colored(COLOR_YELLOW,locations[i].mLocationId.toStdString())<< " "
|
||||
<< colored(COLOR_BLUE,"(" + locations[i].mPgpId.toStdString()+ "): ")
|
||||
<< colored(COLOR_PURPLE,locations[i].mPgpName + " (" + locations[i].mLocationName + ")" )
|
||||
<< std::endl;
|
||||
|
||||
uint32_t nacc = 0;
|
||||
std::cout << std::endl;
|
||||
uint32_t nacc = 0;
|
||||
while(keepRunning && (nacc < 1 || nacc >= locations.size()))
|
||||
{
|
||||
std::cout << "Please enter account number: ";
|
||||
std::cout << colored(COLOR_GREEN,"Please enter account number: ");
|
||||
std::cout.flush();
|
||||
|
||||
std::string inputStr;
|
||||
@ -264,7 +325,7 @@ int main(int argc, char* argv[])
|
||||
RsPeerId ssl_id(prefUserString);
|
||||
if(ssl_id.isNull())
|
||||
{
|
||||
RsErr() << "Invalid User location id: a hexadecimal ID is expected."
|
||||
RsErr() << colored(COLOR_RED,"Invalid User location id: a hexadecimal ID is expected.")
|
||||
<< std::endl;
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -299,7 +360,7 @@ int main(int argc, char* argv[])
|
||||
if(RsAccounts::isTorAuto())
|
||||
{
|
||||
|
||||
std::cerr << "(II) Hidden service is ready:" << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN,"(II) Hidden service is ready:") << std::endl;
|
||||
|
||||
std::string service_id ;
|
||||
std::string onion_address ;
|
||||
@ -312,13 +373,13 @@ int main(int argc, char* argv[])
|
||||
RsTor::getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
|
||||
RsTor::getProxyServerInfo(proxy_server_address,proxy_server_port) ;
|
||||
|
||||
std::cerr << " onion address : " << onion_address << std::endl;
|
||||
std::cerr << " service_id : " << service_id << std::endl;
|
||||
std::cerr << " service port : " << service_port << std::endl;
|
||||
std::cerr << " target port : " << service_target_port << std::endl;
|
||||
std::cerr << " target address : " << service_target_address << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN," onion address : ") << onion_address << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN," service_id : ") << service_id << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN," service port : ") << service_port << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN," target port : ") << service_target_port << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN," target address : ") << service_target_address << std::endl;
|
||||
|
||||
std::cerr << "Setting proxy server to " << service_target_address << ":" << service_target_port << std::endl;
|
||||
std::cerr << colored(COLOR_GREEN,"Setting proxy server to ") << service_target_address << ":" << service_target_port << std::endl;
|
||||
|
||||
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address, service_target_port);
|
||||
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address, service_port);
|
||||
@ -327,15 +388,6 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
#endif // def RS_SERVICE_TERMINAL_LOGIN
|
||||
|
||||
#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
|
||||
if(rsJsonApi && !webui_pass1.empty())
|
||||
{
|
||||
rsWebUi->setHtmlFilesDirectory(webui_base_directory);
|
||||
rsWebUi->setUserPassword(webui_pass1);
|
||||
rsWebUi->restart();
|
||||
}
|
||||
#endif
|
||||
|
||||
rsControl->setShutdownCallback([&](int){keepRunning = false;});
|
||||
|
||||
while(keepRunning)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit b0ddb09184e8fff86bd3325e00c6d4b329ae1790
|
||||
Subproject commit dae0c13ef78aee59a4f1f9e1cdb0127b5e27d256
|
@ -52,9 +52,9 @@ CONFIG *= retroshare_service
|
||||
no_retroshare_service:CONFIG -= retroshare_service
|
||||
|
||||
# To disable RetroShare FriendServer append the following assignation to
|
||||
# qmake command line "CONFIG+=no_rs_friendserver"
|
||||
# qmake command line "CONFIG+=no_retroshare_friendserver"
|
||||
CONFIG *= retroshare_friendserver
|
||||
no_rs_friendserver:CONFIG -= retroshare_friendserver
|
||||
no_retroshare_friendserver:CONFIG -= retroshare_friendserver
|
||||
|
||||
# To disable SQLCipher support append the following assignation to qmake
|
||||
# command line "CONFIG+=no_sqlcipher"
|
||||
@ -456,13 +456,26 @@ defined in command line")
|
||||
RS_MINOR_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 1)
|
||||
|
||||
RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 2)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, -)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, )
|
||||
|
||||
RS_MINI_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 0)
|
||||
|
||||
RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 1, -1)
|
||||
|
||||
RS_EXTRA_VERSION = $$join(RS_GIT_DESCRIBE_SPLIT,-,-)
|
||||
# Split string into mini version (leading numbers) and extra version (string after the numbers)
|
||||
RS_MINI_VERSION =
|
||||
RS_EXTRA_VERSION =
|
||||
for(CHAR, RS_GIT_DESCRIBE_SPLIT) {
|
||||
isEqual(CHAR, 0) | greaterThan(CHAR, 0):lessThan(CHAR, 9) | isEqual(CHAR, 9) {
|
||||
# Number
|
||||
isEmpty(RS_EXTRA_VERSION) {
|
||||
# Add leading numbers to mini version
|
||||
RS_MINI_VERSION = $${RS_MINI_VERSION}$${CHAR}
|
||||
} else {
|
||||
# Add to extra version
|
||||
RS_EXTRA_VERSION = $${RS_EXTRA_VERSION}$${CHAR}
|
||||
}
|
||||
} else {
|
||||
# Add to extra version
|
||||
RS_EXTRA_VERSION = $${RS_EXTRA_VERSION}$${CHAR}
|
||||
}
|
||||
}
|
||||
|
||||
message("RetroShare version\
|
||||
$${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION}\
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8623304b62294dafbe477573f321a464fef721dd
|
||||
Subproject commit 2226ef0a20a001ec0942be6abe5e909c15447d8e
|
Loading…
Reference in New Issue
Block a user