Compare commits

..

No commits in common. "master" and "v0.6.7-RC2" have entirely different histories.

339 changed files with 70043 additions and 60809 deletions

2
.gitignore vendored
View file

@ -21,7 +21,7 @@ Thumbs.db
!supportlibs/libsam3/Makefile !supportlibs/libsam3/Makefile
# QtCreator cruft # QtCreator cruft
*CMakeLists.txt.user* *CMakeLists.txt.user
# Build artifacts # Build artifacts
/jsonapi-generator/src/jsonapi-generator /jsonapi-generator/src/jsonapi-generator

View file

@ -1,7 +1,7 @@
image: docker:latest image: docker:stable
services: services:
- docker:dind - docker:stable-dind
stages: stages:
- build - build
@ -18,7 +18,6 @@ variables:
build-ubuntu-test-image: build-ubuntu-test-image:
stage: build stage: build
script: script:
- docker --version
- > - >
docker login "$CI_REGISTRY" docker login "$CI_REGISTRY"
--username "$CI_REGISTRY_USER" --username "$CI_REGISTRY_USER"
@ -36,7 +35,6 @@ build-ubuntu-test-image:
test-ubuntu: test-ubuntu:
stage: test stage: test
script: script:
- docker --version
- > - >
docker login "$CI_REGISTRY" docker login "$CI_REGISTRY"
--username "$CI_REGISTRY_USER" --username "$CI_REGISTRY_USER"

12
.gitmodules vendored
View file

@ -10,8 +10,7 @@
[submodule "supportlibs/udp-discovery-cpp"] [submodule "supportlibs/udp-discovery-cpp"]
path = supportlibs/udp-discovery-cpp path = supportlibs/udp-discovery-cpp
url = https://github.com/truvorskameikin/udp-discovery-cpp.git url = https://github.com/truvorskameikin/udp-discovery-cpp.git
branch = master branch = develop
# develop branch was removed we were using it at commit f3a3103a6c52e5707629e8d0a7e279a7758fe845
[submodule "supportlibs/rapidjson"] [submodule "supportlibs/rapidjson"]
path = supportlibs/rapidjson path = supportlibs/rapidjson
url = https://github.com/Tencent/rapidjson.git url = https://github.com/Tencent/rapidjson.git
@ -31,13 +30,8 @@
branch = master branch = master
[submodule "libretroshare"] [submodule "libretroshare"]
path = libretroshare path = libretroshare
url = https://github.com/RetroShare/libretroshare.git url = ../libretroshare
branch = master branch = master
[submodule "retroshare-webui"] [submodule "retroshare-webui"]
path = retroshare-webui path = retroshare-webui
url = https://github.com/RetroShare/RSNewWebUI.git url = ../RSNewWebUI
branch = master
[submodule "supportlibs/librnp"]
path = supportlibs/librnp
url = https://github.com/rnpgp/rnp.git
branch = main

View file

@ -7,9 +7,6 @@ RetroShare is a decentralized, private, secure, cross-platform, communication
toolkit. toolkit.
RetroShare provides file sharing, chat, messages, forums, channels and more. RetroShare provides file sharing, chat, messages, forums, channels and more.
|===============================================================================
| Developer Documentation | image:https://deepwiki.com/badge.svg[link="https://deepwiki.com/RetroShare/RetroShare",title="Ask DeepWiki"]
|===============================================================================
.Build Status .Build Status
|=============================================================================== |===============================================================================
|GNU/Linux (via Gitlab CI) | image:https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/RetroShare/-/commits/master",title="pipeline status"] |GNU/Linux (via Gitlab CI) | image:https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/RetroShare/-/commits/master",title="pipeline status"]

View file

@ -25,6 +25,9 @@ CONFIG += c++14
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS += openpgpsdk
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) { rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
SUBDIRS += jsonapi-generator SUBDIRS += jsonapi-generator
jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro
@ -33,7 +36,7 @@ rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
SUBDIRS += libbitdht SUBDIRS += libbitdht
libbitdht.file = libbitdht/src/libbitdht.pro libbitdht.file = libbitdht/src/libbitdht.pro
libretroshare.depends += libbitdht libretroshare.depends += openpgpsdk libbitdht
SUBDIRS += libretroshare SUBDIRS += libretroshare
libretroshare.file = libretroshare/src/libretroshare.pro libretroshare.file = libretroshare/src/libretroshare.pro

View file

@ -40,23 +40,18 @@ RUN git clone --depth 1 https://github.com/aetilius/pHash.git && \
rm -rf pHash-build pHash rm -rf pHash-build pHash
ARG FRESHCLONE=0 ARG FRESHCLONE=0
ARG REPO_URL=https://github.com/RetroShare/RetroShare.git ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
ARG REPO_BRANCH=master ARG REPO_BRANCH=master
ARG REPO_DEPTH="--depth 2000" ARG REPO_DEPTH="--depth 2000"
RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && \ RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \
cd RetroShare && \
git fetch --tags && \ git fetch --tags && \
git submodule update --init \ git submodule update --init --remote --force \
libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ \ libbitdht/ libretroshare/ openpgpsdk/ && \
supportlibs/restbed/ && \ cd ..
cd supportlibs/restbed/ && \
git submodule update --init \
dependency/asio/ dependency/kashmir/ && \
cd ../../../
RUN \ RUN \
mkdir RetroShare-build && cd RetroShare-build && \ mkdir RetroShare-build && cd RetroShare-build && \
cmake -B. -S../RetroShare/retroshare-service \ cmake -B. -S../RetroShare/retroshare-service \
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON && \ -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON && \
make -j$(nproc) && make install && \ make -j$(nproc) && make install && \
cd .. && rm -rf RetroShare-build cd .. && rm -rf RetroShare-build

View file

@ -2,19 +2,19 @@ FROM registry.gitlab.com/retroshare/retroshare:base
RUN apt-get update -y && apt-get upgrade -y RUN apt-get update -y && apt-get upgrade -y
ARG REPO_URL=https://github.com/RetroShare/RetroShare.git ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
ARG REPO_BRANCH=master ARG REPO_BRANCH=master
RUN \ RUN \
cd RetroShare && git remote add testing $REPO_URL && \ cd RetroShare && git remote add testing $REPO_URL && \
git fetch --tags testing $REPO_BRANCH && \ git fetch --tags testing $REPO_BRANCH && \
git reset --hard testing/$REPO_BRANCH && \ git reset --hard testing/$REPO_BRANCH && \
git submodule update --init \ git submodule update --init --remote --force \
libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ && \ libbitdht/ libretroshare/ openpgpsdk/ && \
git --no-pager log --max-count 1 git --no-pager log --max-count 1
RUN \ RUN \
mkdir RetroShare-build && cd RetroShare-build && \ mkdir RetroShare-build && cd RetroShare-build && \
cmake -B. -S../RetroShare/retroshare-service \ cmake -B. -S../RetroShare/retroshare-service \
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON \ -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON \
-DRS_WARN_DEPRECATED=OFF -DRS_WARN_LESS=ON && \ -DRS_WARN_DEPRECATED=OFF -DRS_WARN_LESS=ON && \
make -j$(nproc) && make install && \ make -j$(nproc) && make install && \
cd .. && rm -rf RetroShare-build cd .. && rm -rf RetroShare-build

@ -1 +1 @@
Subproject commit 0a3997cc1355b2c848161dca015b7e2df039707b Subproject commit df16cb915465d058c75277678799ce4dadeae287

View file

@ -2,15 +2,13 @@
## Qt Installation ## Qt Installation
Qt 5.15 is not available as install package. Install Qt via: [Qt Download](http://www.qt.io/download/)
Download Qt 5.15.x from here: [Qt 5.15.17](https://download.qt.io/archive/qt/5.15/5.15.17/single/qt-everywhere-opensource-src-5.15.17.tar.xz) Use default options. And add Qt Script support.
Instruction howto Build Qt 5.15.x on macOS: [macOS Building](https://doc.qt.io/archives/qt-5.15/macos-building.html)
## Set the Environment Variables
Add to the PATH environment variable by editing your *~/.profile* file. Add to the PATH environment variable by editing your *~/.profile* file.
export PATH="/users/$USER/Qt/5.15.17/clang_64/bin:$PATH" export PATH="/users/$USER/Qt/5.14.1/clang_64/bin:$PATH"
Depends on which version of Qt you use. Depends on which version of Qt you use.
@ -32,20 +30,32 @@ In GitHub Desktop -> Clone Repository -> URL
Add Repository URL: https://github.com/RetroShare/RetroShare.git and Clone Add Repository URL: https://github.com/RetroShare/RetroShare.git and Clone
## ***Get XCode & MacOSX SDK*** ## ***Choose if you use MacPort or HomeBrew***
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. ### MacPort Installation
If you are running macOS Ventura 13.5 or later, you can install Xcode directly from App Store using the instructions below. Install MacPort and XCode following this guide: [MacPort and XCode](http://guide.macports.org/#installing.xcode)
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 Start XCode to get it updated and to able C compiler to create executables.
To install from App Store: #### Install libraries
Select [x] menu - > "App Store…". $ sudo port -v selfupdate
Search for Xcode. Download and install. $ sudo port install openssl
$ sudo port install miniupnpc
$ sudo port install libmicrohttpd
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. For VOIP Plugin:
$ sudo port install speex-devel
$ 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: Install XCode command line developer tools:
@ -53,34 +63,14 @@ Install XCode command line developer tools:
Start XCode to get it updated and to able C compiler to create executables. Start XCode to get it updated and to able C compiler to create executables.
Older MacOSX SDK is available from here: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
### MacPort Installation
Install MacPort following this guide: [MacPort](http://guide.macports.org/#installing.xcode)
### HOMEBREW Installation
Install HomeBrew following this guide: [HomeBrew](http://brew.sh/)
#### Install libraries #### Install libraries
$ brew install openssl $ brew install openssl
$ brew install miniupnpc $ brew install miniupnpc
$ brew install libmicrohttpd
$ brew install rapidjson $ brew install rapidjson
$ brew install sqlcipher $ brew install sqlcipher
For RNP lib:
$ brew install bzip2
$ brew install zlib
$ brew install json-c
$ brew install botan@2
#### Install CMake
$ brew install cmake
If you have error in linking, run this: If you have error in linking, run this:
$sudo chown -R $(whoami) /usr/local/lib/pkgconfig $sudo chown -R $(whoami) /usr/local/lib/pkgconfig
@ -95,7 +85,8 @@ For VOIP Plugin:
For FeedReader Plugin: For FeedReader Plugin:
$ brew install libxslt $ brew install libxslt
$ brew install libxml2
Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
## Last Settings ## Last Settings
@ -113,8 +104,11 @@ In QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additiona
## Set your Mac OS SDK version ## Set your Mac OS SDK version
Edit RetroShare.pro
Edit retroshare.pri and set your installed sdk version example for 11.1 -> rs_macos11.1 (line 135:) CONFIG += c++14 rs_macos11.1
and then retroshare.pri
macx:CONFIG *= rs_macos11.1 macx:CONFIG *= rs_macos11.1
rs_macos10.8:CONFIG -= rs_macos11.1 rs_macos10.8:CONFIG -= rs_macos11.1
@ -128,7 +122,7 @@ Edit retroshare.pri and set your installed sdk version example for 11.1 -> rs_ma
## Link Include & Libraries ## Link Include & Libraries
When required edit your retroshare.pri macx-* section, check if the Include and Lib path are correct (macx-* section) Edit your retroshare.pri and add to macx-* section
INCLUDEPATH += "/usr/local/opt/openssl/include" INCLUDEPATH += "/usr/local/opt/openssl/include"
QMAKE_LIBDIR += "/usr/local/opt/openssl/lib" QMAKE_LIBDIR += "/usr/local/opt/openssl/lib"
@ -137,21 +131,13 @@ When required edit your retroshare.pri macx-* section, check if the Include and
alternative via Terminal alternative via Terminal
$ qmake $ 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"
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: For FeedReader Plugin:
INCLUDEPATH += "/usr/local/opt/libxml2/include/libxml2" INCLUDEPATH += "/usr/local/opt/libxml2/include/libxml2"
With plugins: For building RetroShare with plugins:
$ qmake \ $ qmake \
INCLUDEPATH+="/usr/local/opt/openssl/include" QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" \ INCLUDEPATH+="/usr/local/opt/openssl/include" QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" \
@ -173,30 +159,13 @@ With plugins:
You can now compile RetroShare into Qt Creator or with Terminal You can now compile RetroShare into Qt Creator or with Terminal
$ cd /path/to/retroshare cd retroshare
$ qmake .. qmake; make
$ make
You can change Target and SDK in *./retroshare.pri:82* changing value of QMAKE_MACOSX_DEPLOYMENT_TARGET and QMAKE_MAC_SDK 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* 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 ## Copy Plugins
$ cp \ $ cp \
@ -204,13 +173,3 @@ For Qt Creator -> QtCreator Projects -> Build -> Build Settings -> Build Steps -
./plugins/VOIP/lib/libVOIP.dylib \ ./plugins/VOIP/lib/libVOIP.dylib \
./plugins/RetroChess/lib/libRetroChess.dylib \ ./plugins/RetroChess/lib/libRetroChess.dylib \
./retroshare-gui/src/RetroShare.app/Contents/Resources/ ./retroshare-gui/src/RetroShare.app/Contents/Resources/
### Compile Retroshare-Service & Webui with CMake
before you can compile overwrite the file "asio/include/asio/detail/config.hpp" here is a fix for macos [
asio fix](https://github.com/chriskohlhoff/asio/commit/68df16d560c68944809bb2947360fe8035e9ae0a)
$ cd retroshare-service
$ mkdir build-dir
$ cd build-dir
$ cmake -DRS_WEBUI=ON -DCMAKE_BUILD_TYPE=Release ..
$ make

View file

@ -1,51 +0,0 @@
#!/bin/sh
APP="RetroShare"
RSVERSION="0.6.7a"
QTVERSION="Qt-5.15.11"
# 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
/usr/libexec/PlistBuddy -c "Delete :NSRequiresAquaSystemAppearance" 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"

View file

@ -1,11 +1,10 @@
[Desktop Entry] [Desktop Entry]
Encoding=UTF-8
Version=1.0 Version=1.0
Name=RetroShare Name=RetroShare
Comment=Securely communicate with your friends Comment=Securely share files with your friends
Exec=/usr/bin/retroshare %U Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm Icon=/usr/share/pixmaps/retroshare.xpm
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P Categories=Network;P2P;
MimeType=x-scheme-handler/retroshare; MimeType=x-scheme-handler/retroshare;

View file

@ -18,8 +18,8 @@ At the end, you'll get at ..\\*-msys2\deploy\ the Portable 7zip file.
### MSYS2 INSTALLATION (for editing or debugging) ### MSYS2 INSTALLATION (for editing or debugging)
Download MSYS2 from [MSYS2](http://www.msys2.org/). Installing Download MSYS2 from [MSYS2](http://www.msys2.org/). Get the i686 version
MSYS2 requires 64 bit Windows 10 or newer. if you run a 32-bit Windows or the x86_64 if you run a 64-bit Windows.
Run the installer and install MSYS2. Run the installer and install MSYS2.
@ -40,29 +40,26 @@ Run MSYS2 MSYS again and finish updating with:
Install the default programs needed to build: Install the default programs needed to build:
pacman -S base-devel git wget p7zip gcc perl ruby doxygen cmake pacman -S base-devel git wget p7zip gcc perl ruby python2 doxygen cmake
Install the 64-bit toolchain: Install the 32-bit toolchain:
pacman -S mingw-w64-x86_64-toolchain pacman -S mingw-w64-i686-toolchain
Install all needed dependencies: Install all needed dependencies:
pacman -S mingw-w64-x86_64-miniupnpc pacman -S mingw-w64-i686-miniupnpc
pacman -S mingw-w64-x86_64-libxslt pacman -S mingw-w64-i686-libmicrohttpd
pacman -S mingw-w64-x86_64-xapian-core pacman -S mingw-w64-i686-libxslt
pacman -S mingw-w64-x86_64-sqlcipher pacman -S mingw-w64-i686-xapian-core
pacman -S mingw-w64-x86_64-qt5-base pacman -S mingw-w64-i686-sqlcipher
pacman -S mingw-w64-x86_64-qt5-multimedia pacman -S mingw-w64-i686-qt5
pacman -S mingw-w64-x86_64-ccmake pacman -S mingw32/mingw-w64-i686-cmake
pacman -S mingw-w64-x86_64-rapidjson pacman -S mingw-w64-i686-rapidjson
pacman -S mingw-w64-x86_64-json-c
pacman -S mingw-w64-x86_64-libbotan
pacman -S mingw-w64-x86_64-asio
If you want to use QtCreator as IDE, prefer using this one publish by MSYS2 as all build Kit are already setted. If you want to use QtCreator as IDE, prefer using this one publish by MSYS2 as all build Kit are already setted.
pacman -S mingw-w64-x86_64-qt-creator pacman -S mingw-w64-i686-qt-creator
*You can start it from MSYS2 terminal.* *You can start it from MSYS2 terminal.*
@ -70,7 +67,7 @@ We're done installing MSYS2, close the shell terminal.
### BUILDING RETROSHARE ### BUILDING RETROSHARE
Now run the MSYS2 MinGW 64-bit shell terminal (it's in the start menu). Now run the MSYS2 MinGW 32-bit shell terminal (it's in the start menu).
We will use it to checkout Retroshare and build it: We will use it to checkout Retroshare and build it:
git clone https://github.com/RetroShare/RetroShare.git git clone https://github.com/RetroShare/RetroShare.git

View file

@ -43,7 +43,6 @@ set NSIS_PARAM=%NSIS_PARAM% /DDEPLOYDIR="%RsDeployPath%"
set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%" set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%"
set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%" set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%"
set NSIS_PARAM=%NSIS_PARAM% /DARCHITECTURE="%RsArchitecture%" set NSIS_PARAM=%NSIS_PARAM% /DARCHITECTURE="%RsArchitecture%"
set NSIS_PARAM=%NSIS_PARAM% /DTOOLCHAIN="%RsToolchain%"
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra% set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra%
set QtMainVersion=%QtVersion:~0,1% set QtMainVersion=%QtVersion:~0,1%

View file

@ -18,17 +18,15 @@ if errorlevel 1 goto error_env
if not "%ParamNoupdate%"=="1" ( if not "%ParamNoupdate%"=="1" (
:: Install needed things :: Install needed things
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson"
:: rnp
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-json-c mingw-w64-%RsMSYS2Architecture%-libbotan"
:: Webui :: Webui
if "%ParamWebui%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-doxygen mingw-w64-%RsMSYS2Architecture%-asio" if "%ParamWebui%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-doxygen"
:: Plugins :: Plugins
if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg" if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg"
:: Clang :: Clang
if "%ClangCompiler%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-clang" if "%ParamClang%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-clang"
:: Indexing :: Indexing
if "%ParamIndexing%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-libvorbis mingw-w64-%RsMSYS2Architecture%-flac mingw-w64-%RsMSYS2Architecture%-taglib" if "%ParamIndexing%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-libvorbis mingw-w64-%RsMSYS2Architecture%-flac mingw-w64-%RsMSYS2Architecture%-taglib"
@ -79,10 +77,11 @@ echo %RsBuildConfig% >> buildinfo.txt
echo %RsArchitecture% >> buildinfo.txt echo %RsArchitecture% >> buildinfo.txt
echo Qt %QtVersion% >> buildinfo.txt echo Qt %QtVersion% >> buildinfo.txt
echo %RsToolchain% >> buildinfo.txt echo %RsToolchain% >> buildinfo.txt
echo %RsCompiler% >> buildinfo.txt
call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath
call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path
if "%ClangCompiler%"=="1" ( if "%ParamClang%"=="1" (
%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-clang-g++ %RS_QMAKE_CONFIG%" %EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-clang-g++ %RS_QMAKE_CONFIG%"
) else ( ) else (
%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%" %EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%"

View file

@ -5,7 +5,7 @@ set ParamAutologin=0
set ParamPlugins=0 set ParamPlugins=0
set ParamTor=0 set ParamTor=0
set ParamWebui=0 set ParamWebui=0
set ClangCompiler=0 set ParamClang=0
set ParamIndexing=0 set ParamIndexing=0
set ParamFriendserver=0 set ParamFriendserver=0
set ParamNoupdate=0 set ParamNoupdate=0
@ -55,6 +55,8 @@ if "%~1" NEQ "" (
set ParamWebui=1 set ParamWebui=1
) else if "%%~a"=="singlethread" ( ) else if "%%~a"=="singlethread" (
set CoreCount=1 set CoreCount=1
) else if "%%~a"=="clang" (
set ParamClang=1
) else if "%%~a"=="indexing" ( ) else if "%%~a"=="indexing" (
set ParamIndexing=1 set ParamIndexing=1
) else if "%%~a"=="friendserver" ( ) else if "%%~a"=="friendserver" (
@ -94,18 +96,24 @@ if "%RsToolchain%"=="mingw32" (
set RsArchitecture=x64 set RsArchitecture=x64
set RsMSYS2Architecture=clang-x86_64 set RsMSYS2Architecture=clang-x86_64
set MSYSTEM=CLANG64 set MSYSTEM=CLANG64
set ClangCompiler=1 set ParamClang=1
) else if "%RsToolchain%"=="clang32" ( ) else if "%RsToolchain%"=="clang32" (
set RsArchitecture=x86 set RsArchitecture=x86
set RsMSYS2Architecture=clang-i686 set RsMSYS2Architecture=clang-i686
set MSYSTEM=CLANG32 set MSYSTEM=CLANG32
set ClangCompiler=1 set ParamClang=1
) else if "%RsToolchain%"=="clangarm64" ( ) else if "%RsToolchain%"=="clangarm64" (
set RsArchitecture=arm64 set RsArchitecture=arm64
set RsMSYS2Architecture=clang-aarch64 set RsMSYS2Architecture=clang-aarch64
set MSYSTEM=CLANGARM64 set MSYSTEM=CLANGARM64
) )
if "%ParamClang%"=="1" (
set RsCompiler=Clang
) else (
set RsCompiler=GCC
)
if "%ParamRelease%"=="1" ( if "%ParamRelease%"=="1" (
if "%ParamDebug%"=="1" ( if "%ParamDebug%"=="1" (
echo. echo.
@ -154,6 +162,7 @@ echo autologin Build with autologin
echo plugins Build plugins echo plugins Build plugins
echo webui Enable JsonAPI and pack webui files echo webui Enable JsonAPI and pack webui files
echo singlethread Use only 1 thread for building echo singlethread Use only 1 thread for building
echo clang Use clang compiler instead of GCC
echo indexing Build with deep channel and file indexing support echo indexing Build with deep channel and file indexing support
echo friendserver Enable friendserver support echo friendserver Enable friendserver support
echo noupdate Skip updating the libraries echo noupdate Skip updating the libraries

View file

@ -14,8 +14,8 @@ if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
set RsMinGWPath=%EnvMSYS2BasePath%\%RsToolchain% set RsMinGWPath=%EnvMSYS2BasePath%\%RsToolchain%
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsToolchain%-%RsBuildConfig% set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsToolchain%-%RsCompiler%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%-%RsToolchain%%RsType%-%RsBuildConfig% set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsToolchain%-%RsCompiler%-%RsBuildConfig%
set RsPackPath=%DeployPath% set RsPackPath=%DeployPath%
set RsArchiveAdd= set RsArchiveAdd=
set RsWebuiBuildPath=%RsBuildPath%\retroshare-webui\webui set RsWebuiBuildPath=%RsBuildPath%\retroshare-webui\webui

View file

@ -71,9 +71,9 @@ if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5 if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%RsBuildConfig%" NEQ "release" ( if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-%RsToolchain%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-%RsArchitecture%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
) else ( ) else (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-%RsToolchain%-msys2%RsType%%RsArchiveAdd%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-%RsArchitecture%-msys2%RsType%%RsArchiveAdd%.7z
) )
if exist "%Archive%" del /Q "%Archive%" if exist "%Archive%" del /Q "%Archive%"
@ -105,7 +105,6 @@ copy "%RsBuildPath%\retroshare-nogui\src\%RsBuildConfig%\retroshare*-nogui.exe"
copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite% copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite%
copy "%RsBuildPath%\supportlibs\cmark\build\src\libcmark.dll" "%RsDeployPath%" %Quite% copy "%RsBuildPath%\supportlibs\cmark\build\src\libcmark.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" copy "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" "%RsDeployPath%" %Quite% if exist "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" copy "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" copy "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\retroshare-friendserver\src\%RsBuildConfig%\retroshare-friendserver.exe" ( if exist "%RsBuildPath%\retroshare-friendserver\src\%RsBuildConfig%\retroshare-friendserver.exe" (
copy "%RsBuildPath%\retroshare-friendserver\src\%RsBuildConfig%\retroshare-friendserver.exe" "%RsDeployPath%" %Quite% copy "%RsBuildPath%\retroshare-friendserver\src\%RsBuildConfig%\retroshare-friendserver.exe" "%RsDeployPath%" %Quite%
) )

View file

@ -16,13 +16,7 @@ if "%~1"=="clean" (
goto exit goto exit
) )
set MSYS2Version=20241208 if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%
set MSYS2UnpackPath=%EnvMSYS2Path%\msys64
if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
if "%~1"=="reinstall" ( if "%~1"=="reinstall" (
choice /M "Found existing MSYS2 version. Do you want to proceed?" choice /M "Found existing MSYS2 version. Do you want to proceed?"
if !ERRORLEVEL!==2 goto exit if !ERRORLEVEL!==2 goto exit
@ -31,26 +25,30 @@ if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
) )
) )
if exist "%MSYS2UnpackPath%" ( if "%MSYS2Architecture%"=="i686" set MSYS2Version=20210705
%cecho% info "Remove previous MSYS2 version" if "%MSYS2Architecture%"=="x86_64" set MSYS2Version=20210725
call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%"
)
%cecho% info "Download MSYS2 installation files" 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"
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" 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 if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
%cecho% info "Unpack MSYS2" %cecho% info "Unpack MSYS2"
"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%"
set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh
%cecho% info "Initialize MSYS2" %cecho% info "Initialize MSYS2"
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
"%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Sy"
"%MSYS2SH%" -lc "pacman --noconfirm -Su" "%MSYS2SH%" -lc "pacman --noconfirm -Su"
call "%MSYS2UnpackPath%\autorebase.bat" call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat"
:exit :exit
endlocal endlocal

View file

@ -34,7 +34,7 @@ if not exist "%EnvToolsPath%\cecho.exe" (
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
echo Unpack cecho echo Unpack cecho
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%"
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"

View file

@ -2,13 +2,18 @@
setlocal setlocal
if not exist "%~dp0msys2\msys64" goto :EOF if exist "%~dp0msys2\msys32" call :update 32
if exist "%~dp0msys2\msys64" call :update 64
set MSYS2SH=%~dp0msys2\msys64\usr\bin\sh goto :EOF
echo Update MSYS2 :update
set MSYS2SH=%~dp0msys2\msys%~1\usr\bin\sh
echo Update MSYS2 %~1
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
"%MSYS2SH%" -lc "pacman --noconfirm -Su" "%MSYS2SH%" -lc "pacman --noconfirm -Su"
:exit
endlocal endlocal
goto :EOF goto :EOF

View file

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

View file

@ -55,6 +55,7 @@ Run the scripts in this order:
* "CONFIG+=..." enable other extra compile time features, you can find the almost complete list in file *<sourcefolder>\retroshare.pri* * "CONFIG+=..." enable other extra compile time features, you can find the almost complete list in file *<sourcefolder>\retroshare.pri*
* For fixing compile problems (optional) * For fixing compile problems (optional)
* singlethread: use only 1 thread for building, slow but useful if you don't find the error message in the console * singlethread: use only 1 thread for building, slow but useful if you don't find the error message in the console
* clang: use clang compiler instead of GCC
* noupdate: skip the msys2 update step, sometimes some msys2 packages are broken, you can manually switch back to the older package, and this option will prevent updating to the broken version again * noupdate: skip the msys2 update step, sometimes some msys2 packages are broken, you can manually switch back to the older package, and this option will prevent updating to the broken version again
Example: Example:

View file

@ -1,33 +1,24 @@
ZLIB_VERSION=1.2.11 ZLIB_VERSION=1.2.11
BZIP2_VERSION=1.0.8 BZIP2_VERSION=1.0.8
MINIUPNPC_VERSION=2.2.3 MINIUPNPC_VERSION=2.2.3
OPENSSL_VERSION=1.1.1w OPENSSL_VERSION=1.1.1p
SPEEX_VERSION=1.2.1 SPEEX_VERSION=1.2.0
SPEEXDSP_VERSION=1.2.1 SPEEXDSP_VERSION=1.2.0
LIBXML2_MAIN_VERSION=2.14 LIBXML2_VERSION=2.9.12
LIBXML2_VERSION=$(LIBXML2_MAIN_VERSION).5 LIBXSLT_VERSION=1.1.34
LIBXSLT_MAIN_VERSION=1.1 CURL_VERSION=7.81.0
LIBXSLT_VERSION=$(LIBXSLT_MAIN_VERSION).43
CURL_VERSION=8.9.1
TCL_VERSION=8.6.10 TCL_VERSION=8.6.10
SQLCIPHER_VERSION=4.5.0 SQLCIPHER_VERSION=4.5.0
LIBMICROHTTPD_VERSION=0.9.75 LIBMICROHTTPD_VERSION=0.9.75
FFMPEG_VERSION=4.4.6 FFMPEG_VERSION=4.4
RAPIDJSON_VERSION=1.1.0 RAPIDJSON_VERSION=1.1.0
XAPIAN_VERSION=1.4.29 XAPIAN_VERSION=1.4.19
ASIO_VERSION=1-34-2
#RNP_VERSION=0.17.1
# libaries for rnp
JSON_C_VERSION=0.18
BOTAN_VERSION=2.19.5
DOWNLOAD_PATH?=download DOWNLOAD_PATH?=download
BUILD_PATH=build BUILD_PATH=build
LIBS_PATH?=libs LIBS_PATH?=libs
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp libxml curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian jsonc botan asio copylibs all: dirs zlib bzip2 miniupnpc openssl speex speexdsp libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian copylibs
#rnp
download: \ download: \
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \ $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \
@ -36,13 +27,13 @@ download: \
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz \ $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz \ $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz \ $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz \ $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz \ $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz \
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz \ $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \ $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \ $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \ $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz \ $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz \
$(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz \ $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz \
$(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz
@ -193,52 +184,50 @@ $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP
rm -r -f speexdsp-$(SPEEXDSP_VERSION) rm -r -f speexdsp-$(SPEEXDSP_VERSION)
mv $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION) mv $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION)
libxml: \ libxml2: $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION) \
$(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz: $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz:
wget --no-check-certificate https://download.gnome.org/sources/libxml2/$(LIBXML2_MAIN_VERSION)/libxml2-$(LIBXML2_VERSION).tar.xz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz: $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
wget --no-check-certificate https://download.gnome.org/sources/libxslt/$(LIBXSLT_MAIN_VERSION)/libxslt-$(LIBXSLT_VERSION).tar.xz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz # prepare
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION) $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION): \
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz \
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz
# libxml2: prepare
pacman --needed --noconfirm -S python3 pkg-config
rm -r -f $(BUILD_PATH)/libxml2-* rm -r -f $(BUILD_PATH)/libxml2-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
# libxslt: prepare # build
rm -r -f $(BUILD_PATH)/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.xz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.xz
# libxml2: build
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)" #cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd libxml2-$(LIBXML2_VERSION) && make libxml2.la cd libxml2-$(LIBXML2_VERSION) && make
# libxslt: build # copy files
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION)/libxslt && make
cd libxslt-$(LIBXSLT_VERSION)/libexslt && make
# libxml2: copy files
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml
cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/ cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib/ cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib/
# libxslt: copy files # cleanup
#rm -r -f libxml2-$(LIBXML2_VERSION) # see libxslt
mv $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
libxslt: $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
$(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# build
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt
cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/ cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/ cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/ cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
# libxml2: cleanup # cleanup
rm -r -f libxml2-$(LIBXML2_VERSION) rm -r -f libxml2-$(LIBXML2_VERSION)
# libxslt: cleanup
rm -r -f libxslt-$(LIBXSLT_VERSION) rm -r -f libxslt-$(LIBXSLT_VERSION)
# finish
mv $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
mv $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION) mv $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
curl: $(BUILD_PATH)/curl-$(CURL_VERSION) curl: $(BUILD_PATH)/curl-$(CURL_VERSION)
@ -253,7 +242,7 @@ $(BUILD_PATH)/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# build # build
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)" cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)"
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)" #cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd curl-$(CURL_VERSION)/lib && make cd curl-$(CURL_VERSION) && make
# copy files # copy files
mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl
cp curl-$(CURL_VERSION)/include/curl/*.h $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl/ cp curl-$(CURL_VERSION)/include/curl/*.h $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl/
@ -316,13 +305,13 @@ $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION): $(DOWNLOAD_PATH)/libmicroh
ffmpeg: $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION) ffmpeg: $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz: $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz:
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.xz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# prepare # prepare
rm -r -f $(BUILD_PATH)/ffmpeg-* rm -r -f $(BUILD_PATH)/ffmpeg-*
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.xz tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# build # build
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp" cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp"
cd ffmpeg-$(FFMPEG_VERSION) && make install cd ffmpeg-$(FFMPEG_VERSION) && make install
@ -374,73 +363,8 @@ $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION): $(DOWNLOAD_PATH)/xapian-core-$(XAPI
rm -r -f xapian-core-$(XAPIAN_VERSION) rm -r -f xapian-core-$(XAPIAN_VERSION)
mv $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION) mv $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION)
jsonc: $(BUILD_PATH)/json-c-$(JSON_C_VERSION)
$(BUILD_PATH)/json-c-$(JSON_C_VERSION):
# prepare
rm -r -f $(BUILD_PATH)/json-c-*
[ -d "json-c-$(JSON_C_VERSION)" ] || git clone https://github.com/json-c/json-c.git --depth=1 --branch json-c-$(JSON_C_VERSION) "json-c-$(JSON_C_VERSION)"
# build
mkdir -p json-c-$(JSON_C_VERSION)/build
cd json-c-$(JSON_C_VERSION)/build && cmake .. -G"MSYS Makefiles" -Wno-dev -DCMAKE_BUILD_TYPE="release" -DBUILD_SHARED_LIBS=off -DBUILD_STATIC_LIBS=on -DBUILD_TESTING=off -DCMAKE_CXX_FLAGS="-D__MINGW_USE_VC2005_COMPAT" -DCMAKE_INSTALL_PREFIX="`pwd`/install" -DCMAKE_INSTALL_PREFIX="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp"
cd json-c-$(JSON_C_VERSION)/build && make install
# cleanup
rm -r -f json-c-$(JSON_C_VERSION)
mv $(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp $(BUILD_PATH)/json-c-$(JSON_C_VERSION)
botan: $(BUILD_PATH)/botan-$(BOTAN_VERSION)
$(BUILD_PATH)/botan-$(BOTAN_VERSION):
# prepare
pacman --needed --noconfirm -S python3
rm -r -f $(BUILD_PATH)/botan-*
[ -d "botan-$(BOTAN_VERSION)" ] || git clone https://github.com/randombit/botan.git --depth=1 --branch $(BOTAN_VERSION) "botan-$(BOTAN_VERSION)"
# build
if [ $(MSYSTEM) = "MINGW32" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_32 --disable-shared-library --enable-static-library --extra-cxxflags="-D__MINGW_USE_VC2005_COMPAT" --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi
if [ $(MSYSTEM) = "MINGW64" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_64 --disable-shared-library --enable-static-library --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi
cd botan-$(BOTAN_VERSION) && make install
# cleanup
rm -r -f botan-$(BOTAN_VERSION)
mv $(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp $(BUILD_PATH)/botan-$(BOTAN_VERSION)
asio: $(BUILD_PATH)/asio-$(ASIO_VERSION)
$(BUILD_PATH)/asio-$(ASIO_VERSION):
# prepare
rm -r -f $(BUILD_PATH)/asio-*
[ -d "asio-$(ASIO_VERSION)" ] || git clone https://github.com/chriskohlhoff/asio.git --depth=1 --branch asio-$(ASIO_VERSION) "asio-$(ASIO_VERSION)"
# copy files
mkdir -p $(BUILD_PATH)/asio-$(ASIO_VERSION).tmp/include/asio
cp asio-$(ASIO_VERSION)/asio/include/*.hpp $(BUILD_PATH)/asio-$(ASIO_VERSION).tmp/include/
cp -r asio-$(ASIO_VERSION)/asio/include/asio/* $(BUILD_PATH)/asio-$(ASIO_VERSION).tmp/include/asio/
# cleanup
rm -r -f asio-$(ASIO_VERSION)
mv $(BUILD_PATH)/asio-$(ASIO_VERSION).tmp $(BUILD_PATH)/asio-$(ASIO_VERSION)
rnp: $(BUILD_PATH)/rnp-$(RNP_VERSION)
$(BUILD_PATH)/rnp-$(RNP_VERSION):
# prepare
rm -r -f $(BUILD_PATH)/rnp-*
[ -d "rnp-$(RNP_VERSION)" ] || git clone https://github.com/rnpgp/rnp.git --depth=1 --branch v$(RNP_VERSION) --recurse-submodules --shallow-submodules "rnp-$(RNP_VERSION)"
# build
mkdir -p rnp-$(RNP_VERSION)/build
cd rnp-$(RNP_VERSION)/build && cmake .. -G"MSYS Makefiles" -Wno-dev -DCMAKE_INSTALL_PREFIX="`pwd`/install" -DBUILD_SHARED_LIBS=yes -DBUILD_TESTING=off -DCMAKE_CXX_FLAGS="-D__MINGW_USE_VC2005_COMPAT -D__STDC_FORMAT_MACROS" -DBZIP2_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/bzip2-$(BZIP2_VERSION)/include" -DBZIP2_LIBRARY_RELEASE="`pwd`/../../$(BUILD_PATH)/bzip2-$(BZIP2_VERSION)/lib/libbz2.a" -DBZIP2_LIBRARIES="`pwd`/../../$(BUILD_PATH)/bzip2-$(BZIP2_VERSION)/lib/libbz2.a" -DZLIB_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/zlib-$(ZLIB_VERSION)/include" -DZLIB_LIBRARY="`pwd`/../../$(BUILD_PATH)/zlib-$(ZLIB_VERSION)/lib/libz.a" -DJSON-C_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION)/include/json-c" -DJSON-C_LIBRARY="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION)/lib/libjson-c.a" -DBOTAN_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/botan-$(BOTAN_VERSION)/include/botan-`echo $(BOTAN_VERSION) | cut -c1-1`" -DBOTAN_LIBRARY="`pwd`/../../$(BUILD_PATH)/botan-$(BOTAN_VERSION)/lib/libbotan-`echo $(BOTAN_VERSION) | cut -c1-1`.a"
cmake --build rnp-$(RNP_VERSION)/build
# copy files
mkdir -p $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/include/rnp
cp -r rnp-$(RNP_VERSION)/include/rnp/* $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/include/rnp/
cp -r rnp-$(RNP_VERSION)/build/src/lib/rnp/* $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/include/rnp/
mkdir -p $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/lib
cp -r rnp-$(RNP_VERSION)/build/src/lib/librnp.dll.a $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/lib/
mkdir -p $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/bin
cp -r rnp-$(RNP_VERSION)/build/src/lib/librnp.dll $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/bin/
# cleanup
rm -r -f rnp-$(RNP_VERSION)
mv $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp $(BUILD_PATH)/rnp-$(RNP_VERSION)
copylibs: copylibs:
rm -r -f $(LIBS_PATH) ; \ rm -r -f $(LIBS_PATH) ; \
mkdir -p $(LIBS_PATH) ; \ mkdir -p $(LIBS_PATH) ; \
cp -p $(BUILD_PATH)/gcc-version $(LIBS_PATH) ; \ cp $(BUILD_PATH)/gcc-version $(LIBS_PATH) ; \
find $(BUILD_PATH) -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r -p {}/. $(LIBS_PATH) \; ; \ find $(BUILD_PATH) -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r {}/. $(LIBS_PATH) \; ; \

View file

@ -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 "%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 "%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 "%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_retroshare_friendserver if "%ParamFriendServer%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_rs_friendserver
if "%ParamEmbeddedFriendServer%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_efs 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" qmake "%SourcePath%\RetroShare.pro" -r -spec win32-g++ "CONFIG+=%RS_QMAKE_CONFIG%" "EXTERNAL_LIB_DIR=%BuildLibsPath%\libs"

View file

@ -96,7 +96,6 @@ copy nul "%RsDeployPath%\portable" %Quite%
echo copy binaries echo copy binaries
copy "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare*.exe" "%RsDeployPath%" %Quite% copy "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare*.exe" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" copy "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" "%RsDeployPath%" %Quite% if exist "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" copy "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" copy "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" "%RsDeployPath%" %Quite%
if "%ParamService%"=="1" ( if "%ParamService%"=="1" (
copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite% copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite%

View file

@ -22,12 +22,11 @@ if "%GCCArchitecture%"=="x64" (
) )
set EnvMSYS2Path=%EnvRootPath%\msys2 set EnvMSYS2Path=%EnvRootPath%\msys2
set EnvMSYS2BasePath=%EnvMSYS2Path%\msys64
call "%~dp0tools\prepare-msys2.bat" %1 call "%~dp0tools\prepare-msys2.bat" %1
if errorlevel 1 exit /B %ERRORLEVEL% if errorlevel 1 exit /B %ERRORLEVEL%
set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe set EnvMSYS2SH=%EnvMSYS2Path%\msys64\usr\bin\sh.exe
if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env
set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc

View file

@ -16,15 +16,15 @@ if "%~1"=="clean" (
goto exit goto exit
) )
set MSYS2Version=20241208 set MSYS2Version=20230318
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%
set MSYS2UnpackPath=%EnvMSYS2Path%\msys64 set CMakeInstall=cmake-3.19.0-win32-x86.zip
set CMakeInstall=cmake-3.31.3-windows-i386.zip set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall%
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.31.3/%CMakeInstall% set CMakeUnpackPath=%EnvMSYS2Path%\msys64
if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" ( if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" (
if "%~1"=="reinstall" ( if "%~1"=="reinstall" (
choice /M "Found existing MSYS2 version. Do you want to proceed?" choice /M "Found existing MSYS2 version. Do you want to proceed?"
if !ERRORLEVEL!==2 goto exit if !ERRORLEVEL!==2 goto exit
@ -33,12 +33,13 @@ if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
) )
) )
if exist "%MSYS2UnpackPath%" (
if exist "%CMakeUnpackPath%" (
%cecho% info "Remove previous MSYS2 version" %cecho% info "Remove previous MSYS2 version"
call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%" call "%ToolsPath%\remove-dir.bat" "%CMakeUnpackPath%"
) )
%cecho% info "Download MSYS2 installation files" %cecho% info "Download installation files"
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" 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 if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
@ -49,29 +50,29 @@ if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download C
"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" "%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%"
%cecho% info "Unpack CMake" %cecho% info "Unpack CMake"
"%EnvSevenZipExe%" x -o"%MSYS2UnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%"
%cecho% info "Install CMake" %cecho% info "Install CMake"
set CMakeVersion= set CMakeVersion=
for /D %%F in (%MSYS2UnpackPath%\cmake*) do set CMakeVersion=%%~nxF for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit
%cecho% info "Found CMake version %CMakeVersion%" %cecho% info "Found CMake version %CMakeVersion%"
set FoundProfile= set FoundProfile=
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYS2UnpackPath%\etc\profile"') do set FoundProfile=%%F for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%CMakeUnpackPath%\etc\profile"') do set FoundProfile=%%F
if "%FoundProfile%"=="0" ( if "%FoundProfile%"=="0" (
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYS2UnpackPath%\etc\profile" echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%CMakeUnpackPath%\etc\profile"
) )
set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh set MSYS2SH=%CMakeUnpackPath%\usr\bin\sh
%cecho% info "Initialize MSYS2" %cecho% info "Initialize MSYS2"
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
"%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Sy"
"%MSYS2SH%" -lc "pacman --noconfirm -Su" "%MSYS2SH%" -lc "pacman --noconfirm -Su"
call "%MSYS2UnpackPath%\autorebase.bat" call "%CMakeUnpackPath%\autorebase.bat"
:exit :exit
endlocal endlocal

View file

@ -19,9 +19,9 @@ set MinGitInstallPath=%EnvToolsPath%\MinGit
set DoxygenInstall=doxygen-1.9.6.windows.x64.bin.zip set DoxygenInstall=doxygen-1.9.6.windows.x64.bin.zip
set DoxygenUrl=https://github.com/doxygen/doxygen/releases/download/Release_1_9_6/%DoxygenInstall% set DoxygenUrl=https://github.com/doxygen/doxygen/releases/download/Release_1_9_6/%DoxygenInstall%
set DoxygenInstallPath=%EnvToolsPath%\doxygen set DoxygenInstallPath=%EnvToolsPath%\doxygen
set CMakeVersion=cmake-3.31.3-windows-i386 set CMakeVersion=cmake-3.19.0-win32-x86
set CMakeInstall=%CMakeVersion%.zip set CMakeInstall=%CMakeVersion%.zip
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.31.3/%CMakeInstall% set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall%
set CMakeInstallPath=%EnvToolsPath%\cmake set CMakeInstallPath=%EnvToolsPath%\cmake
set TorProjectUrl=https://www.torproject.org set TorProjectUrl=https://www.torproject.org
set TorDownloadIndexUrl=%TorProjectUrl%/download/tor set TorDownloadIndexUrl=%TorProjectUrl%/download/tor
@ -53,7 +53,7 @@ if not exist "%EnvToolsPath%\cecho.exe" (
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
echo Unpack cecho echo Unpack cecho
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%"
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" 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 if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error
%cecho% info "Unpack Dependency Walker" %cecho% info "Unpack Dependency Walker"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%"
copy "%EnvTempPath%\*" "%EnvToolsPath%" copy "%EnvTempPath%\*" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" 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 if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
%cecho% info "Unpack Unix Tools" %cecho% info "Unpack Unix Tools"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%" copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" 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 if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
%cecho% info "Unpack Unix Tools" %cecho% info "Unpack Unix Tools"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%" copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" 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 if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error
%cecho% info "Unpack NSIS" %cecho% info "Unpack NSIS"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%"
if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%" if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%"
xcopy /s "%EnvTempPath%" "%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 if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error
%cecho% info "Unpack MinGit" %cecho% info "Unpack MinGit"
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%"
) )
if not exist "%EnvDownloadPath%\%DoxygenInstall%" call "%ToolsPath%\remove-dir.bat" "%DoxygenInstallPath%" 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 if not exist "%EnvDownloadPath%\%DoxygenInstall%" %cecho% error "Cannot download doxygen installation" & goto error
%cecho% info "Unpack Doxygen" %cecho% info "Unpack Doxygen"
"%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%"
) )
if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%" 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 if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error
%cecho% info "Unpack CMake" %cecho% info "Unpack CMake"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0 "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%"
move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%" move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%"
@ -176,7 +176,7 @@ mkdir "%EnvTempPath%"
call "%ToolsPath%\download-file.bat" "%TorDownloadIndexUrl%" "%EnvTempPath%\index.html" call "%ToolsPath%\download-file.bat" "%TorDownloadIndexUrl%" "%EnvTempPath%\index.html"
if not exist "%EnvTempPath%\index.html" %cecho% error "Cannot download Tor installation" & goto error 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%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
if "%TorInstall%"=="" %cecho% error "Cannot download Tor installation" & goto error if "%TorInstall%"=="" %cecho% error "Cannot download Tor installation" & goto error
if "%TorDownloadUrl%"=="" %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 if not exist "%EnvDownloadPath%\%TorInstall%" %cecho% error "Cannot download Tor installation" & goto error
%cecho% info "Unpack Tor" %cecho% info "Unpack Tor"
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" -y -bso0 "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%"
) )
:exit :exit

View file

@ -247,7 +247,6 @@ Section $(Section_Main) Section_Main
; External binaries ; External binaries
File "${EXTERNAL_LIB_DIR}\bin\miniupnpc.dll" File "${EXTERNAL_LIB_DIR}\bin\miniupnpc.dll"
File "${RELEASEDIR}\supportlibs\librnp\Build\src\lib\librnp.dll"
!if ${ARCHITECTURE} == "x86" !if ${ARCHITECTURE} == "x86"
File "${EXTERNAL_LIB_DIR}\bin\libcrypto-1_1.dll" File "${EXTERNAL_LIB_DIR}\bin\libcrypto-1_1.dll"
File "${EXTERNAL_LIB_DIR}\bin\libssl-1_1.dll" File "${EXTERNAL_LIB_DIR}\bin\libssl-1_1.dll"
@ -319,7 +318,7 @@ SectionEnd
!ifdef TOR_EXISTS !ifdef TOR_EXISTS
Section /o $(Section_Tor) Section_Tor Section /o $(Section_Tor) Section_Tor
SetOutPath "$INSTDIR\tor" SetOutPath "$INSTDIR\tor"
File "${TORDIR}\*" File /r "${TORDIR}\*"
SectionEnd SectionEnd
!endif !endif

View file

@ -1,20 +0,0 @@
#!/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

View file

@ -7,5 +7,5 @@ Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm Icon=/usr/share/pixmaps/retroshare.xpm
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P Categories=Application;Network;P2P;Feed;Chat;InstantMessaging
MimeType=x-scheme-handler/retroshare; MimeType=x-scheme-handler/retroshare;

@ -1 +1 @@
Subproject commit 2ddc86fb575a61170f4c06a00152e3e7dc74c8f4 Subproject commit 659423769541169457c41f71c8a038e2d64ba079

@ -1 +1 @@
Subproject commit ac83e00ea7a26cd6cf57cefef745d6dcfd07e5da Subproject commit 8c02b54e4d16e38b28e77263a0b1570c50df4c99

@ -1 +1 @@
Subproject commit 178aa8ebcef47e3271d5a5ca5c07e45d3b71c81d Subproject commit b41667912751a453e8e5d4733215a0609277a26f

View file

@ -45,7 +45,6 @@ SOURCES = FeedReaderPlugin.cpp \
gui/FeedReaderUserNotify.cpp \ gui/FeedReaderUserNotify.cpp \
gui/FeedReaderFeedItem.cpp \ gui/FeedReaderFeedItem.cpp \
gui/FeedTreeWidget.cpp \ gui/FeedTreeWidget.cpp \
gui/ProxyWidget.cpp \
util/CURLWrapper.cpp \ util/CURLWrapper.cpp \
util/XMLWrapper.cpp \ util/XMLWrapper.cpp \
util/HTMLWrapper.cpp \ util/HTMLWrapper.cpp \
@ -67,7 +66,6 @@ HEADERS = FeedReaderPlugin.h \
gui/FeedReaderUserNotify.h \ gui/FeedReaderUserNotify.h \
gui/FeedReaderFeedItem.h \ gui/FeedReaderFeedItem.h \
gui/FeedTreeWidget.h \ gui/FeedTreeWidget.h \
gui/ProxyWidget.h \
util/CURLWrapper.h \ util/CURLWrapper.h \
util/XMLWrapper.h \ util/XMLWrapper.h \
util/HTMLWrapper.h \ util/HTMLWrapper.h \
@ -78,8 +76,7 @@ FORMS = gui/FeedReaderDialog.ui \
gui/AddFeedDialog.ui \ gui/AddFeedDialog.ui \
gui/PreviewFeedDialog.ui \ gui/PreviewFeedDialog.ui \
gui/FeedReaderConfig.ui \ gui/FeedReaderConfig.ui \
gui/FeedReaderFeedItem.ui \ gui/FeedReaderFeedItem.ui
gui/ProxyWidget.ui
TARGET = FeedReader TARGET = FeedReader
@ -128,7 +125,7 @@ win32 {
isEmpty(QMAKE_SH) { isEmpty(QMAKE_SH) {
# MinGW # MinGW
LIBS += -lcrypt32 -lbcrypt LIBS += -lcrypt32
} }
# Check for msys2 # Check for msys2

View file

@ -28,7 +28,6 @@
#include "FeedReaderStringDefs.h" #include "FeedReaderStringDefs.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "util/DateTime.h"
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
@ -181,7 +180,8 @@ void AddFeedDialog::useStandardUpdateIntervalToggled()
void AddFeedDialog::useStandardProxyToggled() void AddFeedDialog::useStandardProxyToggled()
{ {
bool checked = ui->useStandardProxyCheckBox->isChecked(); bool checked = ui->useStandardProxyCheckBox->isChecked();
ui->proxyWidget->setEnabled(!checked); ui->proxyAddressLineEdit->setEnabled(!checked);
ui->proxyPortSpinBox->setEnabled(!checked);
} }
void AddFeedDialog::typeForumToggled() void AddFeedDialog::typeForumToggled()
@ -335,12 +335,13 @@ bool AddFeedDialog::fillFeed(uint32_t feedId)
ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str())); ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str()));
ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy); ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy);
ui->proxyWidget->setAddress(QString::fromUtf8(feedInfo.proxyAddress.c_str())); ui->proxyAddressLineEdit->setText(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
ui->proxyWidget->setPort(feedInfo.proxyPort); ui->proxyPortSpinBox->setValue(feedInfo.proxyPort);
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval); ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60); ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
QDateTime dateTime = DateTime::DateTimeFromTime_t(feedInfo.lastUpdate); QDateTime dateTime;
dateTime.setTime_t(feedInfo.lastUpdate);
ui->lastUpdate->setText(dateTime.toString()); ui->lastUpdate->setText(dateTime.toString());
ui->useStandardStorageTimeCheckBox->setChecked(feedInfo.flag.standardStorageTime); ui->useStandardStorageTimeCheckBox->setChecked(feedInfo.flag.standardStorageTime);
@ -424,8 +425,8 @@ void AddFeedDialog::getFeedInfo(FeedInfo &feedInfo)
feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData(); feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData();
feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked(); feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked();
feedInfo.proxyAddress = ui->proxyWidget->address().toUtf8().constData(); feedInfo.proxyAddress = ui->proxyAddressLineEdit->text().toUtf8().constData();
feedInfo.proxyPort = ui->proxyWidget->port(); feedInfo.proxyPort = ui->proxyPortSpinBox->value();
feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked(); feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked();
feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60; feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60;

View file

@ -133,16 +133,37 @@
<property name="title"> <property name="title">
<string>Proxy</string> <string>Proxy</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QGridLayout" name="gridLayout_6">
<item> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="useStandardProxyCheckBox"> <widget class="QCheckBox" name="useStandardProxyCheckBox">
<property name="text"> <property name="text">
<string>Use standard proxy</string> <string>Use standard proxy</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="ProxyWidget" name="proxyWidget" native="true"/> <widget class="QLabel" name="serverLabel">
<property name="text">
<string>Server</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="proxyPortSpinBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -444,12 +465,6 @@
<extends>QComboBox</extends> <extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header> <header>gui/common/RSComboBox.h</header>
</customwidget> </customwidget>
<customwidget>
<class>ProxyWidget</class>
<extends>QWidget</extends>
<header>gui/ProxyWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>urlLineEdit</tabstop> <tabstop>urlLineEdit</tabstop>
@ -479,7 +494,8 @@
<tabstop>useStandardUpdateInterval</tabstop> <tabstop>useStandardUpdateInterval</tabstop>
<tabstop>updateIntervalSpinBox</tabstop> <tabstop>updateIntervalSpinBox</tabstop>
<tabstop>useStandardProxyCheckBox</tabstop> <tabstop>useStandardProxyCheckBox</tabstop>
<tabstop>proxyWidget</tabstop> <tabstop>proxyAddressLineEdit</tabstop>
<tabstop>proxyPortSpinBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View file

@ -31,7 +31,8 @@ FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui->setupUi(this); ui->setupUi(this);
ui->proxyWidget->setEnabled(false); ui->proxyAddressLineEdit->setEnabled(false);
ui->proxyPortSpinBox->setEnabled(false);
/* Connect signals */ /* Connect signals */
connect(ui->updateIntervalSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this]() { connect(ui->updateIntervalSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this]() {
@ -50,7 +51,8 @@ FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked()); Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked());
}); });
connect(ui->useProxyCheckBox, &QCheckBox::toggled, this, &FeedReaderConfig::updateProxy); connect(ui->useProxyCheckBox, &QCheckBox::toggled, this, &FeedReaderConfig::updateProxy);
connect(ui->proxyWidget, &ProxyWidget::changed, this, &FeedReaderConfig::updateProxy); connect(ui->proxyAddressLineEdit, &QLineEdit::textChanged, this, &FeedReaderConfig::updateProxy);
connect(ui->proxyPortSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, &FeedReaderConfig::updateProxy);
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled())); connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
} }
@ -73,8 +75,8 @@ void FeedReaderConfig::load()
std::string proxyAddress; std::string proxyAddress;
uint16_t proxyPort; uint16_t proxyPort;
whileBlocking(ui->useProxyCheckBox)->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort)); whileBlocking(ui->useProxyCheckBox)->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
whileBlocking(ui->proxyWidget)->setAddress(QString::fromUtf8(proxyAddress.c_str())); whileBlocking(ui->proxyAddressLineEdit)->setText(QString::fromUtf8(proxyAddress.c_str()));
whileBlocking(ui->proxyWidget)->setPort(proxyPort); whileBlocking(ui->proxyPortSpinBox)->setValue(proxyPort);
loaded = true; loaded = true;
@ -85,10 +87,11 @@ void FeedReaderConfig::useProxyToggled()
{ {
bool enabled = ui->useProxyCheckBox->isChecked(); bool enabled = ui->useProxyCheckBox->isChecked();
ui->proxyWidget->setEnabled(enabled); ui->proxyAddressLineEdit->setEnabled(enabled);
ui->proxyPortSpinBox->setEnabled(enabled);
} }
void FeedReaderConfig::updateProxy() void FeedReaderConfig::updateProxy()
{ {
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyWidget->address().toUtf8().constData(), ui->proxyWidget->port()); rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyAddressLineEdit->text().toUtf8().constData(), ui->proxyPortSpinBox->value());
} }

View file

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

View file

@ -77,16 +77,37 @@
<property name="title"> <property name="title">
<string>Proxy</string> <string>Proxy</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="0" colspan="4">
<widget class="QCheckBox" name="useProxyCheckBox"> <widget class="QCheckBox" name="useProxyCheckBox">
<property name="text"> <property name="text">
<string>Use proxy</string> <string>Use proxy</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="ProxyWidget" name="proxyWidget" native="true"/> <widget class="QLabel" name="serverLabel">
<property name="text">
<string>Server</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="proxyPortSpinBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="potLabel">
<property name="text">
<string>:</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -136,19 +157,12 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ProxyWidget</class>
<extends>QWidget</extends>
<header>gui/ProxyWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>updateIntervalSpinBox</tabstop> <tabstop>updateIntervalSpinBox</tabstop>
<tabstop>storageTimeSpinBox</tabstop> <tabstop>storageTimeSpinBox</tabstop>
<tabstop>useProxyCheckBox</tabstop> <tabstop>useProxyCheckBox</tabstop>
<tabstop>proxyWidget</tabstop> <tabstop>proxyAddressLineEdit</tabstop>
<tabstop>proxyPortSpinBox</tabstop>
<tabstop>saveInBackgroundCheckBox</tabstop> <tabstop>saveInBackgroundCheckBox</tabstop>
<tabstop>setMsgToReadOnActivate</tabstop> <tabstop>setMsgToReadOnActivate</tabstop>
<tabstop>openAllInNewTabCheckBox</tabstop> <tabstop>openAllInNewTabCheckBox</tabstop>

View file

@ -129,8 +129,6 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *n
settingsChanged(); settingsChanged();
feedTreeItemActivated(NULL); feedTreeItemActivated(NULL);
mFontSizeHandler.registerFontSize(ui->feedTreeWidget);
} }
FeedReaderDialog::~FeedReaderDialog() FeedReaderDialog::~FeedReaderDialog()

View file

@ -23,7 +23,6 @@
#include <retroshare-gui/mainpage.h> #include <retroshare-gui/mainpage.h>
#include "interface/rsFeedReader.h" #include "interface/rsFeedReader.h"
#include "util/FontSizeHandler.h"
namespace Ui { namespace Ui {
class FeedReaderDialog; class FeedReaderDialog;
@ -99,8 +98,6 @@ private:
RsFeedReader *mFeedReader; RsFeedReader *mFeedReader;
FeedReaderNotify *mNotify; FeedReaderNotify *mNotify;
FontSizeHandler mFontSizeHandler;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::FeedReaderDialog *ui; Ui::FeedReaderDialog *ui;
}; };

View file

@ -57,10 +57,10 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="toolBarFrame"> <widget class="QFrame" name="toolBarFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin"> <property name="leftMargin">

View file

@ -36,12 +36,11 @@
#include "gui/common/RSTreeWidgetItem.h" #include "gui/common/RSTreeWidgetItem.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include "gui/Posted/PostedCreatePostDialog.h" #include "gui/Posted/PostedCreatePostDialog.h"
#include "gui/gxsforums/CreateGxsForumMsg.h" #include "gui/gxsforums/CreateGxsForumMsg.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "util/imageutil.h" #include "util/imageutil.h"
#include "util/DateTime.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "retroshare/rsgxsforums.h" #include "retroshare/rsgxsforums.h"
@ -155,8 +154,6 @@ FeedReaderMessageWidget::FeedReaderMessageWidget(uint32_t feedId, RsFeedReader *
ui->msgTreeWidget->installEventFilter(this); ui->msgTreeWidget->installEventFilter(this);
setFeedId(feedId); setFeedId(feedId);
mFontSizeHandler.registerFontSize(ui->msgTreeWidget);
} }
FeedReaderMessageWidget::~FeedReaderMessageWidget() FeedReaderMessageWidget::~FeedReaderMessageWidget()
@ -477,7 +474,8 @@ void FeedReaderMessageWidget::calculateMsgIconsAndFonts(QTreeWidgetItem *item)
void FeedReaderMessageWidget::updateMsgItem(QTreeWidgetItem *item, FeedMsgInfo &info) void FeedReaderMessageWidget::updateMsgItem(QTreeWidgetItem *item, FeedMsgInfo &info)
{ {
QString title = QString::fromUtf8(info.title.c_str()); QString title = QString::fromUtf8(info.title.c_str());
QDateTime qdatetime = DateTime::DateTimeFromTime_t(info.pubDate); QDateTime qdatetime;
qdatetime.setTime_t(info.pubDate);
/* add string to all data */ /* add string to all data */
QString sort = QString("%1_%2_%3").arg(title, qdatetime.toString("yyyyMMdd_hhmmss")).arg(info.feedId); QString sort = QString("%1_%2_%3").arg(title, qdatetime.toString("yyyyMMdd_hhmmss")).arg(info.feedId);

View file

@ -24,7 +24,6 @@
#include <QWidget> #include <QWidget>
#include "interface/rsFeedReader.h" #include "interface/rsFeedReader.h"
#include "util/FontSizeHandler.h"
namespace Ui { namespace Ui {
class FeedReaderMessageWidget; class FeedReaderMessageWidget;
@ -108,8 +107,6 @@ private:
RsFeedReader *mFeedReader; RsFeedReader *mFeedReader;
FeedReaderNotify *mNotify; FeedReaderNotify *mNotify;
FontSizeHandler mFontSizeHandler;
Ui::FeedReaderMessageWidget *ui; Ui::FeedReaderMessageWidget *ui;
}; };

View file

@ -1,142 +0,0 @@
#include "ProxyWidget.h"
#include "ui_ProxyWidget.h"
ProxyWidget::ProxyWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::ProxyWidget)
{
ui->setupUi(this);
/* Connect signals */
connectUi(true);
connect(ui->portSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, &ProxyWidget::changed);
/* Initialize types */
ui->schemeComboBox->addItem("", "");
ui->schemeComboBox->addItem("HTTP", "http://");
ui->schemeComboBox->setItemData(ui->schemeComboBox->count() - 1, tr("HTTP Proxy."), Qt::ToolTipRole);
ui->schemeComboBox->addItem("HTTPS", "https://");
ui->schemeComboBox->setItemData(ui->schemeComboBox->count() - 1, tr("HTTPS Proxy."), Qt::ToolTipRole);
ui->schemeComboBox->addItem("SOCKS4", "socks4://");
ui->schemeComboBox->setItemData(ui->schemeComboBox->count() - 1, tr("SOCKS4 Proxy."), Qt::ToolTipRole);
ui->schemeComboBox->addItem("SOCKS4a", "socks4a://");
ui->schemeComboBox->setItemData(ui->schemeComboBox->count() - 1, tr("SOCKS4a Proxy. Proxy resolves URL hostname."), Qt::ToolTipRole);
ui->schemeComboBox->addItem("SOCKS5", "socks5://");
ui->schemeComboBox->setItemData(ui->schemeComboBox->count() - 1, tr("SOCKS5 Proxy."), Qt::ToolTipRole);
ui->schemeComboBox->addItem("SOCKS5h", "socks5h://");
ui->schemeComboBox->setItemData(ui->schemeComboBox->count() - 1, tr("SOCKS5 Proxy. Proxy resolves URL hostname."), Qt::ToolTipRole);
}
ProxyWidget::~ProxyWidget()
{
delete ui;
}
void ProxyWidget::connectUi(bool doConnect)
{
if (doConnect) {
if (!mAddressConnection) {
mAddressConnection = connect(ui->addressLineEdit, &QLineEdit::textChanged, this, &ProxyWidget::addressChanged);
}
if (!mSchemeConnection) {
mSchemeConnection = connect(ui->schemeComboBox, (void(QComboBox::*)(int))&QComboBox::currentIndexChanged, this, &ProxyWidget::changed);
}
} else {
if (mAddressConnection) {
disconnect(mAddressConnection);
}
if (mSchemeConnection) {
disconnect(mSchemeConnection);
}
}
}
QString ProxyWidget::address()
{
QString host = ui->addressLineEdit->text();
if (host.isEmpty()) {
return "";
}
QString value;
QString scheme = ui->schemeComboBox->currentData().toString();
if (!scheme.isEmpty()) {
value = scheme;
}
value += ui->addressLineEdit->text();
return value;
}
void ProxyWidget::setAddress(const QString &value)
{
int schemeIndex;
QString host;
splitAddress(value, schemeIndex, host);
connectUi(false);
ui->schemeComboBox->setCurrentIndex(schemeIndex);
ui->addressLineEdit->setText(host);
connectUi(true);
}
int ProxyWidget::port()
{
return ui->portSpinBox->value();
}
void ProxyWidget::setPort(int value)
{
ui->portSpinBox->setValue(value);
}
void ProxyWidget::addressChanged(const QString &value)
{
int schemeIndex;
QString host;
splitAddress(value, schemeIndex, host);
connectUi(false);
ui->schemeComboBox->setCurrentIndex(schemeIndex);
if (host != ui->addressLineEdit->text()) {
ui->addressLineEdit->setText(host);
}
connectUi(true);
emit changed();
}
void ProxyWidget::splitAddress(const QString &value, int &schemeIndex, QString &host)
{
if (value.isEmpty()) {
schemeIndex = ui->schemeComboBox->currentIndex();
host = value;
return;
}
QString scheme;
int index = value.indexOf("://");
if (index >= 0) {
scheme = value.left(index + 3);
host = value.mid(index + 3);
} else {
if (ui->schemeComboBox->currentIndex() == 0) {
// Default to HTTP
scheme = "http://";
} else {
scheme = ui->schemeComboBox->currentData().toString();
}
host = value;
}
schemeIndex = ui->schemeComboBox->findData(scheme);
if (schemeIndex < 0) {
/* Unknown scheme */
schemeIndex = 0;
host = value;
}
}

View file

@ -1,40 +0,0 @@
#ifndef PROXYWIDGET_H
#define PROXYWIDGET_H
#include <QWidget>
namespace Ui {
class ProxyWidget;
}
class ProxyWidget : public QWidget
{
Q_OBJECT
public:
explicit ProxyWidget(QWidget *parent = nullptr);
~ProxyWidget();
QString address();
void setAddress(const QString &value);
int port();
void setPort(int value);
Q_SIGNALS:
void changed();
private Q_SLOTS:
void addressChanged(const QString &value);
private:
void connectUi(bool doConnect);
void splitAddress(const QString &value, int &schemeIndex, QString &host);
private:
Ui::ProxyWidget *ui;
QMetaObject::Connection mAddressConnection;
QMetaObject::Connection mSchemeConnection;
};
#endif // PROXYWIDGET_H

View file

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProxyWidget</class>
<widget class="QWidget" name="ProxyWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>22</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="schemeComboBox"/>
</item>
<item>
<widget class="QLineEdit" name="addressLineEdit"/>
</item>
<item>
<widget class="QLabel" name="portLabel">
<property name="text">
<string notr="true">:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="portSpinBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -9,7 +9,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+377"/> <location line="+398"/>
<source>Board</source> <source>Board</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -34,7 +34,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-370"/> <location line="-391"/>
<source>Authentication (not yet supported)</source> <source>Authentication (not yet supported)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -59,7 +59,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+29"/> <location line="+50"/>
<source>Update interval</source> <source>Update interval</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -89,7 +89,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-195"/> <location line="-216"/>
<source>Storage time</source> <source>Storage time</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -114,7 +114,17 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+196"/> <location line="+7"/>
<source>Server</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+10"/>
<source>:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+200"/>
<source>Type</source> <source>Type</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -189,7 +199,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+208"/> <location line="+211"/>
<location line="+152"/> <location line="+152"/>
<location line="+15"/> <location line="+15"/>
<source>Edit feed</source> <source>Edit feed</source>
@ -254,7 +264,17 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+13"/> <location line="+7"/>
<source>Server</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+17"/>
<source>:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+10"/>
<source>Misc</source> <source>Misc</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -297,12 +317,12 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../gui/FeedReaderDialog.cpp" line="+105"/> <location filename="../gui/FeedReaderDialog.cpp" line="+101"/>
<source>Message Folders</source> <source>Message Folders</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+199"/> <location line="+197"/>
<source>New</source> <source>New</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -352,7 +372,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+259"/> <location line="+241"/>
<source>Add new folder</source> <source>Add new folder</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -515,7 +535,7 @@
</message> </message>
<message> <message>
<location line="+26"/> <location line="+26"/>
<location filename="../gui/FeedReaderMessageWidget.cpp" line="+126"/> <location filename="../gui/FeedReaderMessageWidget.cpp" line="+117"/>
<source>Title</source> <source>Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -531,11 +551,6 @@
<source>Author</source> <source>Author</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location line="+121"/>
<source>Copy Link Location</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="../gui/FeedReaderMessageWidget.cpp" line="-2"/> <location filename="../gui/FeedReaderMessageWidget.cpp" line="-2"/>
<source>Search Title</source> <source>Search Title</source>
@ -552,7 +567,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+16"/> <location line="+12"/>
<source>Open link in browser</source> <source>Open link in browser</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -562,7 +577,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+131"/> <location line="+127"/>
<source>The messages will be added to the forum</source> <source>The messages will be added to the forum</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -622,7 +637,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+412"/> <location line="+374"/>
<source>Hide</source> <source>Hide</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -942,37 +957,4 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>ProxyWidget</name>
<message>
<location filename="../gui/ProxyWidget.cpp" line="+17"/>
<source>HTTP Proxy.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>HTTPS Proxy.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>SOCKS4 Proxy.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>SOCKS4a Proxy. Proxy resolves URL hostname.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>SOCKS5 Proxy.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>SOCKS5 Proxy. Proxy resolves URL hostname.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS> </TS>

View file

@ -848,22 +848,6 @@ RsFeedReaderErrorState p3FeedReaderThread::process(const RsFeedReaderFeed &feed,
RsFeedReaderErrorState result = RS_FEED_ERRORSTATE_OK; RsFeedReaderErrorState result = RS_FEED_ERRORSTATE_OK;
time_t minimumPubDate = 0;
if (feed.lastUpdate == 0) {
// Get all items on first scan
} else {
// Get storage time
uint32_t storageTime = 0;
if (feed.flag & RS_FEED_FLAG_STANDARD_STORAGE_TIME) {
storageTime = mFeedReader->getStandardStorageTime();
} else {
storageTime = feed.storageTime;
}
if (storageTime > 0) {
minimumPubDate = time(NULL) - storageTime;
}
}
XMLWrapper xml; XMLWrapper xml;
if (xml.readXML(feed.content.c_str())) { if (xml.readXML(feed.content.c_str())) {
xmlNodePtr root = xml.getRootElement(); xmlNodePtr root = xml.getRootElement();
@ -1022,13 +1006,6 @@ RsFeedReaderErrorState p3FeedReaderThread::process(const RsFeedReaderFeed &feed,
} }
} }
if (minimumPubDate) {
if (item->pubDate < minimumPubDate) {
// pubDate is less than storage time, don't add as new item
continue;
}
}
entries.push_back(item); entries.push_back(item);
} }
} else { } else {
@ -1120,7 +1097,7 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
std::string url; std::string url;
if (feed.flag & RS_FEED_FLAG_SAVE_COMPLETE_PAGE) { if (feed.flag & RS_FEED_FLAG_SAVE_COMPLETE_PAGE) {
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") download page " << msg->link << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") download page " << msg->link << std::endl;
#endif #endif
std::string content; std::string content;
CURLWrapper CURL(proxy); CURLWrapper CURL(proxy);
@ -1157,7 +1134,7 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
if (result != RS_FEED_ERRORSTATE_OK) { if (result != RS_FEED_ERRORSTATE_OK) {
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") cannot download page, CURLCode = " << code << ", error = " << errorString << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") cannot download page, CURLCode = " << code << ", error = " << errorString << std::endl;
#endif #endif
return result; return result;
} }
@ -1174,10 +1151,10 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
if (isRunning()) { if (isRunning()) {
/* process description */ /* 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()) { if (!msg->attachmentBinary.empty()) {
/* use attachment as image */ /* use attachment as image */
processPostedFirstImage = false; processPostedFirstImage = FALSE;
} }
//long todo; // encoding //long todo; // encoding
@ -1303,7 +1280,7 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
if (!src.empty()) { if (!src.empty()) {
/* download image */ /* download image */
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") download image " << src << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") download image " << src << std::endl;
#endif #endif
std::vector<unsigned char> data; std::vector<unsigned char> data;
CURLWrapper CURL(proxy); CURLWrapper CURL(proxy);
@ -1371,7 +1348,7 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
if (!html.saveHTML(msg->postedDescriptionWithoutFirstImage)) { if (!html.saveHTML(msg->postedDescriptionWithoutFirstImage)) {
errorString = html.lastError(); errorString = html.lastError();
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") cannot dump html" << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") cannot dump html" << std::endl;
std::cerr << " Error: " << errorString << std::endl; std::cerr << " Error: " << errorString << std::endl;
#endif #endif
result = RS_FEED_ERRORSTATE_PROCESS_INTERNAL_ERROR; result = RS_FEED_ERRORSTATE_PROCESS_INTERNAL_ERROR;
@ -1380,7 +1357,7 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
} else { } else {
errorString = html.lastError(); errorString = html.lastError();
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") cannot dump html" << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") cannot dump html" << std::endl;
std::cerr << " Error: " << errorString << std::endl; std::cerr << " Error: " << errorString << std::endl;
#endif #endif
result = RS_FEED_ERRORSTATE_PROCESS_INTERNAL_ERROR; result = RS_FEED_ERRORSTATE_PROCESS_INTERNAL_ERROR;
@ -1389,14 +1366,14 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe
} }
} else { } else {
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") no root element" << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") no root element" << std::endl;
#endif #endif
result = RS_FEED_ERRORSTATE_PROCESS_HTML_ERROR; result = RS_FEED_ERRORSTATE_PROCESS_HTML_ERROR;
} }
} else { } else {
errorString = html.lastError(); errorString = html.lastError();
#ifdef FEEDREADER_DEBUG #ifdef FEEDREADER_DEBUG
std::cerr << "p3FeedReaderThread::processMsg - feed " << feed.feedId << " (" << feed.name << ") cannot read html" << std::endl; std::cerr << "p3FeedReaderThread::processHTML - feed " << feed.feedId << " (" << feed.name << ") cannot read html" << std::endl;
std::cerr << " Error: " << errorString << std::endl; std::cerr << " Error: " << errorString << std::endl;
#endif #endif
result = RS_FEED_ERRORSTATE_PROCESS_HTML_ERROR; result = RS_FEED_ERRORSTATE_PROCESS_HTML_ERROR;

View file

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

View file

@ -8,11 +8,7 @@
#include "pgp/pgpkeyutil.h" #include "pgp/pgpkeyutil.h"
#include "pgp/rscertificate.h" #include "pgp/rscertificate.h"
#ifdef USE_OPENPGPSDK
#include "pgp/openpgpsdkhandler.h" #include "pgp/openpgpsdkhandler.h"
#else
#include "pgp/rnppgphandler.h"
#endif
#include "friendserver.h" #include "friendserver.h"
#include "friend_server/fsitem.h" #include "friend_server/fsitem.h"
@ -397,11 +393,7 @@ FriendServer::FriendServer(const std::string& base_dir,const std::string& listen
std::string pgp_private_keyring_path = RsDirUtil::makePath(base_dir,"pgp_private_keyring") ; // not used. std::string pgp_private_keyring_path = RsDirUtil::makePath(base_dir,"pgp_private_keyring") ; // not used.
std::string pgp_trustdb_path = RsDirUtil::makePath(base_dir,"pgp_trustdb") ; // not used. std::string pgp_trustdb_path = RsDirUtil::makePath(base_dir,"pgp_trustdb") ; // not used.
#ifdef USE_OPENPGPSDK
mPgpHandler = new OpenPGPSDKHandler(pgp_public_keyring_path,pgp_private_keyring_path,pgp_trustdb_path,pgp_lock_path); mPgpHandler = new OpenPGPSDKHandler(pgp_public_keyring_path,pgp_private_keyring_path,pgp_trustdb_path,pgp_lock_path);
#else
mPgpHandler = new RNPPGPHandler(pgp_public_keyring_path,pgp_private_keyring_path,pgp_trustdb_path,pgp_lock_path);
#endif
// Random bias. Should be cryptographically safe. // Random bias. Should be cryptographically safe.

View file

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

View file

@ -2,14 +2,17 @@
README for RetroShare README for RetroShare
======================================================================================= =======================================================================================
RetroShare web site . . . . https://retroshare.cc/ RetroShare web site . . . . http://retroshare.net/index.html
Developer's blog . . . . . https://retroshareteam.wordpress.com Developer's blog . . . . . https://retroshareteam.wordpress.com
Documentation . . . . . . . https://retrosharedocs.readthedocs.io/en/latest/ Documentation . . . . . . . https://retroshare.readthedocs.io/en/latest/
Support . . . . . . . . . . http://retroshare.net/support.html
Forums . . . . . . . . . . http://retroshare.sourceforge.net/forum/
Wiki . . . . . . . . . . . https://github.com/RetroShare/documentation/wiki Wiki . . . . . . . . . . . https://github.com/RetroShare/documentation/wiki
Old developers site . . . . http://retroshare.sourceforge.net/wiki/index.php/Developers_Corner
Project site . . . . . . . https://github.com/RetroShare/RetroShare Project site . . . . . . . https://github.com/RetroShare/RetroShare
Related projects/plugins . .https://github.com/RetroShare Relted projects/plugins . . https://github.com/RetroShare
Contact: . . . . . . . . . retroshare.project@gmail.com Contact: . . . . . . . . . retroshare@lunamutt.com ,defnax@users.sourceforge.net
========================================================================================= =========================================================================================
Compiling RetroShare Compiling RetroShare
@ -19,9 +22,9 @@ Build Scripts are avaible on GIT:
https://github.com/RetroShare/RetroShare/tree/master/build_scripts https://github.com/RetroShare/RetroShare/tree/master/build_scripts
You can find here instructions howto compile RetroShare: You can find here instructions howto compile RetroShare:
https://retrosharedocs.readthedocs.io/en/latest/developer/compilation/ https://retroshare.readthedocs.io/en/latest/developer/compilation/
You can go on over to our forum or chat room when you have trouble with compiling: You can go on over to our forum or chat lobby when you have trouble with compiling:
retroshare://forum?name=Developers%20Discussions&id=8fd22bd8f99754461e7ba1ca8a727995 retroshare://forum?name=Developers%20Discussions&id=8fd22bd8f99754461e7ba1ca8a727995
retroshare://chat_room?name=Retroshare%20Devel%20%28signed%29&id=L68DB0A1E09BDA3A5 retroshare://chat_room?name=Retroshare%20Devel%20%28signed%29&id=L68DB0A1E09BDA3A5
http://retroshare.sourceforge.net/forum/

View file

@ -142,7 +142,7 @@ void AboutWidget::updateTitle()
{ {
if (tWidget == NULL) if (tWidget == NULL)
{ {
setWindowTitle(QString("%1 %2").arg(tr("About RetroShare"), RsApplication::retroshareVersion(true))); setWindowTitle(QString("%1 %2").arg(tr("About RetroShare"), Rshare::retroshareVersion(true)));
} }
else else
{ {
@ -228,7 +228,7 @@ void AWidget::initImages()
#ifdef RS_ONLYHIDDENNODE #ifdef RS_ONLYHIDDENNODE
p.drawText(QPointF(10, 50), QString("%1 : %2 (With embedded Tor)").arg(tr("Retroshare version"), Rshare::retroshareVersion(true))); p.drawText(QPointF(10, 50), QString("%1 : %2 (With embedded Tor)").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
#else #else
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), RsApplication::retroshareVersion(true))); p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
#endif #endif
/* Draw Qt's version number */ /* Draw Qt's version number */
@ -936,7 +936,7 @@ void AboutWidget::on_copy_button_clicked()
{ {
QString verInfo; QString verInfo;
QString rsVerString = "RetroShare Version: "; QString rsVerString = "RetroShare Version: ";
rsVerString+=RsApplication::retroshareVersion(true); rsVerString+=Rshare::retroshareVersion(true);
verInfo+=rsVerString; verInfo+=rsVerString;
#ifdef RS_ONLYHIDDENNODE #ifdef RS_ONLYHIDDENNODE
verInfo+=" " + tr("Only Hidden Node"); verInfo+=" " + tr("Only Hidden Node");

View file

@ -35,7 +35,7 @@
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
@ -143,28 +143,28 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
QHeaderView_setSectionResizeModeColumn(header, COLUMN_TOPIC, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(header, COLUMN_TOPIC, QHeaderView::Interactive);
privateSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); privateSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
privateSubLobbyItem->setText(COLUMN_NAME, tr("Private Subscribed")); privateSubLobbyItem->setText(COLUMN_NAME, tr("Private Subscribed chat rooms"));
privateSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1"); privateSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1");
// privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE)); // privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
privateSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE); privateSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE);
ui.lobbyTreeWidget->insertTopLevelItem(0, privateSubLobbyItem); ui.lobbyTreeWidget->insertTopLevelItem(0, privateSubLobbyItem);
publicSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); publicSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed")); publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed chat rooms"));
publicSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2"); publicSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2");
// publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC)); // publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
publicSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC); publicSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
ui.lobbyTreeWidget->insertTopLevelItem(1, publicSubLobbyItem); ui.lobbyTreeWidget->insertTopLevelItem(1, publicSubLobbyItem);
privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
privateLobbyItem->setText(COLUMN_NAME, tr("Private")); privateLobbyItem->setText(COLUMN_NAME, tr("Private chat rooms"));
privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "3"); privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "3");
// privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE)); // privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
privateLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE); privateLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE);
ui.lobbyTreeWidget->insertTopLevelItem(2, privateLobbyItem); ui.lobbyTreeWidget->insertTopLevelItem(2, privateLobbyItem);
publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
publicLobbyItem->setText(COLUMN_NAME, tr("Public")); publicLobbyItem->setText(COLUMN_NAME, tr("Public chat rooms"));
publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "4"); publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "4");
// publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC)); // publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC); publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
@ -230,8 +230,6 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height(); int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height();
ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH)); ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH));
mFontSizeHandler.registerFontSize(ui.lobbyTreeWidget);
} }
ChatLobbyWidget::~ChatLobbyWidget() ChatLobbyWidget::~ChatLobbyWidget()
@ -422,7 +420,7 @@ static void updateItem(QTreeWidget *treeWidget, QTreeWidgetItem *item, ChatLobby
if(lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED) if(lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
{ {
tooltipstr += QObject::tr("\nSecurity: no anonymous IDs") ; tooltipstr += QObject::tr("\nSecurity: no anonymous IDs") ;
QColor foreground = QColor(16, 157, 0); // green QColor foreground = QColor(0, 128, 0); // green
for (int column = 0; column < COLUMN_COUNT; ++column) for (int column = 0; column < COLUMN_COUNT; ++column)
item->setData(column, Qt::ForegroundRole, foreground); item->setData(column, Qt::ForegroundRole, foreground);
} }
@ -723,9 +721,9 @@ void ChatLobbyWidget::updateDisplay()
} }
} }
publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0); publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0);
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed")+ QString(" (") + QString::number(publicSubLobbyItem->childCount())+QString(")")); publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed chat rooms")+ QString(" (") + QString::number(publicSubLobbyItem->childCount())+QString(")"));
privateSubLobbyItem->setHidden(privateSubLobbyItem->childCount()==0); privateSubLobbyItem->setHidden(privateSubLobbyItem->childCount()==0);
publicLobbyItem->setText(COLUMN_NAME, tr("Public")+ " (" + QString::number(publicLobbyItem->childCount())+QString(")")); publicLobbyItem->setText(COLUMN_NAME, tr("Public chat rooms")+ " (" + QString::number(publicLobbyItem->childCount())+QString(")"));
} }
void ChatLobbyWidget::createChatLobby() void ChatLobbyWidget::createChatLobby()

View file

@ -25,7 +25,6 @@
#include "chat/ChatLobbyUserNotify.h" #include "chat/ChatLobbyUserNotify.h"
#include "gui/gxs/GxsIdChooser.h" #include "gui/gxs/GxsIdChooser.h"
#include "util/FontSizeHandler.h"
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
@ -147,8 +146,6 @@ private:
QAbstractButton* myInviteYesButton; QAbstractButton* myInviteYesButton;
GxsIdChooser* myInviteIdChooser; GxsIdChooser* myInviteIdChooser;
FontSizeHandler mFontSizeHandler;
/* UI - from Designer */ /* UI - from Designer */
Ui::ChatLobbyWidget ui; Ui::ChatLobbyWidget ui;
}; };

View file

@ -73,7 +73,7 @@
<widget class="QLabel" name="titleBarLabel"> <widget class="QLabel" name="titleBarLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@ -191,6 +191,11 @@
</item> </item>
<item> <item>
<widget class="RSTreeWidget" name="lobbyTreeWidget"> <widget class="RSTreeWidget" name="lobbyTreeWidget">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>16</width> <width>16</width>
@ -459,7 +464,7 @@
<customwidget> <customwidget>
<class>LineEditClear</class> <class>LineEditClear</class>
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header> <header location="global">gui/common/LineEditClear.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>RSTreeWidget</class> <class>RSTreeWidget</class>

View file

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

19
retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp Executable file → Normal file
View file

@ -29,7 +29,6 @@
#include <math.h> #include <math.h>
#include "DLListDelegate.h" #include "DLListDelegate.h"
#include "util/DateTime.h"
Q_DECLARE_METATYPE(FileProgressInfo) Q_DECLARE_METATYPE(FileProgressInfo)
@ -103,7 +102,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_REMAINING: case COLUMN_REMAINING:
remaining = index.data().toLongLong(); remaining = index.data().toLongLong();
@ -122,7 +121,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_COMPLETED: case COLUMN_COMPLETED:
completed = index.data().toLongLong(); completed = index.data().toLongLong();
@ -141,7 +140,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_DLSPEED: case COLUMN_DLSPEED:
dlspeed = index.data().toDouble(); dlspeed = index.data().toDouble();
@ -152,7 +151,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp.sprintf("%.2f", dlspeed/1024.); temp.sprintf("%.2f", dlspeed/1024.);
temp += " KB/s"; temp += " KB/s";
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_PROGRESS: case COLUMN_PROGRESS:
{ {
@ -237,7 +236,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off); pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize)); pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
if (pixmapRect.isValid()){ if (pixmapRect.isValid()){
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter, pixmap.size(), option.rect).topLeft(); QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
p.setX( p.x() + pixOffset); p.setX( p.x() + pixOffset);
painter->drawPixmap(p, pixmap); painter->drawPixmap(p, pixmap);
temp = " " + temp; temp = " " + temp;
@ -248,13 +247,13 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off); pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize)); pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
if (pixmapRect.isValid()){ if (pixmapRect.isValid()){
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter, pixmap.size(), option.rect).topLeft(); QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
p.setX( p.x() + pixOffset); p.setX( p.x() + pixOffset);
painter->drawPixmap(p, pixmap); painter->drawPixmap(p, pixmap);
temp = " " + temp; temp = " " + temp;
pixOffset += pixmap.size().width(); pixOffset += pixmap.size().width();
} }
painter->drawText(option.rect.translated(pixOffset, 0), Qt::AlignLeft | Qt::AlignVCenter, temp); painter->drawText(option.rect.translated(pixOffset, 0), Qt::AlignLeft, temp);
} }
break; break;
case COLUMN_LASTDL: case COLUMN_LASTDL:
@ -262,7 +261,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
break; break;
qi64Value = index.data().value<qint64>(); qi64Value = index.data().value<qint64>();
if (qi64Value < std::numeric_limits<qint64>::max()){ if (qi64Value < std::numeric_limits<qint64>::max()){
QDateTime qdtLastDL = DateTime::DateTimeFromTime_t(qi64Value); QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value);
painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss")); painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss"));
} else { } else {
painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen")); painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen"));
@ -280,7 +279,7 @@ QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModel
{ {
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString()); float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
int S = QFontMetricsF(option.font).height()*1.5 ; int S = QFontMetricsF(option.font).height() ;
return QSize(w,S); return QSize(w,S);
} }

View file

@ -36,7 +36,7 @@ class FileTransferInfoWidget : public RsAutoUpdatePage
Q_OBJECT Q_OBJECT
public: public:
FileTransferInfoWidget(QWidget * parent = 0, Qt::WindowFlags f = Qt::WindowFlags() ); FileTransferInfoWidget(QWidget * parent = 0, Qt::WindowFlags f = 0 );
void setFileHash(const RsFileHash& hash) { _file_hash = hash ; } void setFileHash(const RsFileHash& hash) { _file_hash = hash ; }

View file

@ -30,15 +30,14 @@
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "retroshare-gui/RsAutoUpdatePage.h" #include "retroshare-gui/RsAutoUpdatePage.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/common/RsCollectionDialog.h" #include "gui/common/RsCollection.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/common/RsUrlHandler.h" #include "gui/common/RsUrlHandler.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/advsearch/advancedsearchdialog.h" #include "gui/advsearch/advancedsearchdialog.h"
#include "gui/common/RSTreeWidgetItem.h" #include "gui/common/RSTreeWidgetItem.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "util/misc.h"
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rsturtle.h> #include <retroshare/rsturtle.h>
@ -202,6 +201,10 @@ SearchDialog::SearchDialog(QWidget *parent)
ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder); ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder);
QFontMetricsF fontMetrics(ui.searchResultWidget->font());
int iconHeight = fontMetrics.height() * 1.4;
ui.searchResultWidget->setIconSize(QSize(iconHeight, iconHeight));
/* Set initial size the splitter */ /* Set initial size the splitter */
QList<int> sizes; QList<int> sizes;
sizes << 250 << width(); // Qt calculates the right sizes sizes << 250 << width(); // Qt calculates the right sizes
@ -236,8 +239,6 @@ SearchDialog::SearchDialog(QWidget *parent)
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this ); RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
}, mEventHandlerId, RsEventType::FILE_TRANSFER ); }, mEventHandlerId, RsEventType::FILE_TRANSFER );
mFontSizeHandler.registerFontSize(ui.searchSummaryWidget);
mFontSizeHandler.registerFontSize(ui.searchResultWidget, 1.4f);
} }
SearchDialog::~SearchDialog() SearchDialog::~SearchDialog()
@ -324,7 +325,7 @@ void SearchDialog::checkText(const QString& txt)
ui.searchButton->setDisabled(txt.length() < 3); ui.searchButton->setDisabled(txt.length() < 3);
ui.searchLineFrame->setProperty("valid", (txt.length() >= 3)); ui.searchLineFrame->setProperty("valid", (txt.length() >= 3));
ui.searchLineFrame->style()->unpolish(ui.searchLineFrame); ui.searchLineFrame->style()->unpolish(ui.searchLineFrame);
RsApplication::refreshStyleSheet(ui.searchLineFrame, false); Rshare::refreshStyleSheet(ui.searchLineFrame, false);
} }
void SearchDialog::initialiseFileTypeMappings() void SearchDialog::initialiseFileTypeMappings()
@ -496,23 +497,25 @@ void SearchDialog::collCreate()
int selectedCount = selectedItems.size() ; int selectedCount = selectedItems.size() ;
QTreeWidgetItem * item ; QTreeWidgetItem * item ;
RsFileTree tree; for (int i = 0; i < selectedCount; ++i) {
for (int i = 0; i < selectedCount; ++i)
{
item = selectedItems.at(i) ; item = selectedItems.at(i) ;
if (!item->text(SR_HASH_COL).isEmpty()) if (!item->text(SR_HASH_COL).isEmpty()) {
{
std::string name = item->text(SR_NAME_COL).toUtf8().constData(); std::string name = item->text(SR_NAME_COL).toUtf8().constData();
RsFileHash hash( item->text(SR_HASH_COL).toStdString() ); RsFileHash hash( item->text(SR_HASH_COL).toStdString() );
uint64_t count = item->text(SR_SIZE_COL).toULongLong(); uint64_t count = item->text(SR_SIZE_COL).toULongLong();
tree.addFile(tree.root(),name,hash,count); DirDetails details;
details.name = name;
details.hash = hash;
details.size = count;
details.type = DIR_TYPE_FILE;
dirVec.push_back(details);
} }
} }
RsCollectionDialog::openNewCollection(tree); RsCollection(dirVec,RS_FILE_HINTS_LOCAL).openNewColl(this);
} }
void SearchDialog::collModif() void SearchDialog::collModif()
@ -539,8 +542,12 @@ void SearchDialog::collModif()
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath()); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath());
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists())
} }
void SearchDialog::collView() void SearchDialog::collView()
@ -567,8 +574,12 @@ void SearchDialog::collView()
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath(), true); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath(), true);
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists())
} }
void SearchDialog::collOpen() void SearchDialog::collOpen()
@ -586,35 +597,32 @@ void SearchDialog::collOpen()
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL if (rsFiles->FileDetails(hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL
| RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE
| RS_FILE_HINTS_SPEC_ONLY, info)) | RS_FILE_HINTS_SPEC_ONLY, info)) {
{
/* make path for downloaded files */ /* make path for downloaded files */
std::string path; std::string path;
path = info.path; path = info.path;
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
RsCollection::RsCollectionErrorCode err;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::downloadFiles(RsCollection(qinfo.absoluteFilePath(),err)); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
if (collection.load(qinfo.absoluteFilePath())) {
collection.downloadFiles();
return;
}
}
}
} }
} }
} }
QString fileName; RsCollection collection;
if (!misc::getOpenFileName(nullptr, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")", fileName)) if (collection.load(this)) {
return ; collection.downloadFiles();
}//if (collection.load(this))
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
RsCollection::RsCollectionErrorCode err;
RsCollection collection(fileName, err);
if(err == RsCollection::RsCollectionErrorCode::COLLECTION_NO_ERROR)
RsCollectionDialog::downloadFiles(collection);
else
QMessageBox::information(nullptr,tr("Error open RsCollection file"),RsCollection::errorString(err));
} }
void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base) void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base)
@ -898,7 +906,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
if (keywords.length() < 3) if (keywords.length() < 3)
return ; return ;
QStringList qWords = keywords.split(" ", QtSkipEmptyParts); QStringList qWords = keywords.split(" ", QString::SkipEmptyParts);
std::list<std::string> words; std::list<std::string> words;
QStringListIterator qWordsIter(qWords); QStringListIterator qWordsIter(qWords);
while (qWordsIter.hasNext()) while (qWordsIter.hasNext())
@ -1040,7 +1048,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
child->setText(SR_SOURCES_COL, QString::number(1)); child->setText(SR_SOURCES_COL, QString::number(1));
child->setData(SR_SOURCES_COL, ROLE_SORT, 1); child->setData(SR_SOURCES_COL, ROLE_SORT, 1);
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter ); child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
child->setText(SR_SEARCH_ID_COL, sid_hexa); child->setText(SR_SEARCH_ID_COL, sid_hexa);
setIconAndType(child, QString::fromUtf8(dir.name.c_str())); setIconAndType(child, QString::fromUtf8(dir.name.c_str()));
@ -1065,7 +1073,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight ); child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
child->setText(SR_SOURCES_COL, QString::number(1)); child->setText(SR_SOURCES_COL, QString::number(1));
child->setData(SR_SOURCES_COL, ROLE_SORT, 1); child->setData(SR_SOURCES_COL, ROLE_SORT, 1);
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter ); child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
child->setText(SR_SEARCH_ID_COL, sid_hexa); child->setText(SR_SEARCH_ID_COL, sid_hexa);
child->setText(SR_TYPE_COL, tr("Folder")); child->setText(SR_TYPE_COL, tr("Folder"));
@ -1134,7 +1142,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight ); child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
child->setText(SR_SOURCES_COL, QString::number(1)); child->setText(SR_SOURCES_COL, QString::number(1));
child->setData(SR_SOURCES_COL, ROLE_SORT, 1); child->setData(SR_SOURCES_COL, ROLE_SORT, 1);
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter ); child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
child->setText(SR_SEARCH_ID_COL, sid_hexa); child->setText(SR_SEARCH_ID_COL, sid_hexa);
child->setText(SR_TYPE_COL, tr("Folder")); child->setText(SR_TYPE_COL, tr("Folder"));
@ -1236,7 +1244,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
int friendSource = 0; int friendSource = 0;
int anonymousSource = 0; int anonymousSource = 0;
QString resultCount = it->text(SR_SOURCES_COL); QString resultCount = it->text(SR_SOURCES_COL);
QStringList modifiedResultCount = resultCount.split("/", QtSkipEmptyParts); QStringList modifiedResultCount = resultCount.split("/", QString::SkipEmptyParts);
if(searchType == FRIEND_SEARCH) if(searchType == FRIEND_SEARCH)
{ {
friendSource = modifiedResultCount.at(0).toInt() + 1; friendSource = modifiedResultCount.at(0).toInt() + 1;
@ -1326,11 +1334,9 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
item->setText(SR_SIZE_COL, QString::number(file.size)); item->setText(SR_SIZE_COL, QString::number(file.size));
item->setData(SR_SIZE_COL, ROLE_SORT, (qulonglong) file.size); item->setData(SR_SIZE_COL, ROLE_SORT, (qulonglong) file.size);
item->setText(SR_AGE_COL, QString::number(file.mtime)); item->setText(SR_AGE_COL, QString::number(file.mtime));
item->setData(SR_AGE_COL, ROLE_SORT, file.mtime); item->setData(SR_AGE_COL, ROLE_SORT, file.mtime);
item->setTextAlignment( SR_SIZE_COL, Qt::AlignRight ); item->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
item->setTextAlignment( SR_AGE_COL, Qt::AlignCenter );
int friendSource = 0; int friendSource = 0;
int anonymousSource = 0; int anonymousSource = 0;
if(searchType == FRIEND_SEARCH) if(searchType == FRIEND_SEARCH)
@ -1349,7 +1355,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
item->setText(SR_SOURCES_COL,modifiedResult); item->setText(SR_SOURCES_COL,modifiedResult);
item->setToolTip(SR_SOURCES_COL, tr("Obtained via ")+QString::fromStdString(rsPeers->getPeerName(file.id)) ); item->setToolTip(SR_SOURCES_COL, tr("Obtained via ")+QString::fromStdString(rsPeers->getPeerName(file.id)) );
item->setData(SR_SOURCES_COL, ROLE_SORT, fltRes); item->setData(SR_SOURCES_COL, ROLE_SORT, fltRes);
item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter ); item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
item->setText(SR_SEARCH_ID_COL, sid_hexa); item->setText(SR_SEARCH_ID_COL, sid_hexa);
QColor foreground; QColor foreground;

View file

@ -25,7 +25,6 @@
#include "retroshare/rsevents.h" #include "retroshare/rsevents.h"
#include "ui_SearchDialog.h" #include "ui_SearchDialog.h"
#include "retroshare-gui/mainpage.h" #include "retroshare-gui/mainpage.h"
#include "util/FontSizeHandler.h"
class AdvancedSearchDialog; class AdvancedSearchDialog;
class RSTreeWidgetItemCompareRole; class RSTreeWidgetItemCompareRole;
@ -174,8 +173,6 @@ private:
QAction *collViewAct; QAction *collViewAct;
QAction *collOpenAct; QAction *collOpenAct;
FontSizeHandler mFontSizeHandler;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::SearchDialog ui; Ui::SearchDialog ui;

View file

@ -27,13 +27,13 @@
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/ShareManager.h" #include "gui/ShareManager.h"
#include "gui/common/PeerDefs.h" #include "gui/common/PeerDefs.h"
#include "gui/common/RsCollectionDialog.h" #include "gui/common/RsCollection.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxschannels/GxsChannelDialog.h"
#include "gui/gxsforums/GxsForumsDialog.h" #include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/settings/AddFileAssociationDialog.h" #include "gui/settings/AddFileAssociationDialog.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include "util/RsAction.h" #include "util/RsAction.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/rstime.h" #include "util/rstime.h"
@ -652,7 +652,7 @@ void SharedFilesDialog::copyLinks(const QModelIndexList& lst, bool remote,QList<
QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName(); QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
RetroShareLink link = RetroShareLink::createFileTree(dir_name,ft->totalFileSize(),ft->numFiles(),QString::fromStdString(ft->toRadix64())) ; RetroShareLink link = RetroShareLink::createFileTree(dir_name,ft->mTotalSize,ft->mTotalFiles,QString::fromStdString(ft->toRadix64())) ;
if(link.valid()) if(link.valid())
urls.push_back(link) ; urls.push_back(link) ;
@ -734,32 +734,7 @@ void SharedFilesDialog::sendLinkTo()
void SharedFilesDialog::collCreate() void SharedFilesDialog::collCreate()
{ {
QModelIndexList lst = getSelected(); QModelIndexList lst = getSelected();
model->createCollectionFile(this, lst);
std::vector <DirDetails> dirVec;
model->getDirDetailsFromSelect(lst, dirVec);
auto RemoteMode = isRemote();
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
QString dir_name;
if(!RemoteMode)
{
if(!dirVec.empty())
{
const DirDetails& details = dirVec[0];
dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
}
}
RsFileTree tree;
for(uint32_t i=0;i<dirVec.size();++i)
tree.addFileTree(tree.root(),*RsFileTree::fromDirDetails(dirVec[i],RemoteMode,true));
RsCollectionDialog::openNewCollection(tree);
//auto ft = RsFileTree::fromDirDetails(details,remote);
} }
void SharedFilesDialog::collModif() void SharedFilesDialog::collModif()
@ -784,8 +759,12 @@ void SharedFilesDialog::collModif()
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::editExistingCollection(qinfo.absoluteFilePath()); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath());
}
}
} }
void SharedFilesDialog::collView() void SharedFilesDialog::collView()
@ -810,8 +789,12 @@ void SharedFilesDialog::collView()
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath(), true); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath(), true);
}
}
} }
void SharedFilesDialog::collOpen() void SharedFilesDialog::collOpen()
@ -838,24 +821,20 @@ void SharedFilesDialog::collOpen()
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath(),true); if (collection.load(qinfo.absoluteFilePath())) {
collection.downloadFiles();
return;
}
} }
} }
} }
} }
QString fileName; RsCollection collection;
if (!misc::getOpenFileName(nullptr, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")", fileName)) if (collection.load(this)) {
return ; collection.downloadFiles();
}
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
RsCollection::RsCollectionErrorCode err;
RsCollection collection(fileName,err);
if(err == RsCollection::RsCollectionErrorCode::COLLECTION_NO_ERROR)
RsCollectionDialog::downloadFiles(collection);
} }
void LocalSharedFilesDialog::playselectedfiles() void LocalSharedFilesDialog::playselectedfiles()
@ -1166,14 +1145,12 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
collViewAct->setEnabled(bIsRsColl); collViewAct->setEnabled(bIsRsColl);
collOpenAct->setEnabled(true); collOpenAct->setEnabled(true);
QMenu collectionMenu(tr("Retroshare Collection"), this); QMenu collectionMenu(tr("Collection"), this);
collectionMenu.setIcon(QIcon(IMAGE_LIBRARY)); collectionMenu.setIcon(QIcon(IMAGE_LIBRARY));
collectionMenu.addAction(collCreateAct); collectionMenu.addAction(collCreateAct);
collectionMenu.addAction(collModifAct);
if(bIsRsColl) collectionMenu.addAction(collViewAct);
collectionMenu.addAction(collModifAct); collectionMenu.addAction(collOpenAct);
//collectionMenu.addAction(collViewAct);
//collectionMenu.addAction(collOpenAct);
switch (type) { switch (type) {
case DIR_TYPE_DIR : case DIR_TYPE_DIR :
@ -1619,7 +1596,7 @@ void SharedFilesDialog::FilterItems()
return ; return ;
//FileSearchFlags flags = isRemote()?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL; //FileSearchFlags flags = isRemote()?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
QStringList lst = text.split(" ",QtSkipEmptyParts) ; QStringList lst = text.split(" ",QString::SkipEmptyParts) ;
std::list<std::string> keywords ; std::list<std::string> keywords ;
for(auto it(lst.begin());it!=lst.end();++it) for(auto it(lst.begin());it!=lst.end();++it)
@ -1711,16 +1688,12 @@ bool SharedFilesDialog::tree_FilterItem(const QModelIndex &index, const QString
void SharedFilesDialog::updateFontSize() void SharedFilesDialog::updateFontSize()
{ {
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt(); int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui.dirTreeView->font(); QFont newFont = ui.dirTreeView->font();
if (newFont.pointSize() != customFontSize) { if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize); newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont); QFontMetricsF fontMetrics(newFont);
int iconHeight = fontMetrics.height()*1.5; int iconHeight = fontMetrics.height();
ui.dirTreeView->setFont(newFont); ui.dirTreeView->setFont(newFont);
ui.dirTreeView->setIconSize(QSize(iconHeight, iconHeight)); ui.dirTreeView->setIconSize(QSize(iconHeight, iconHeight));
} }

View file

@ -23,10 +23,10 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin"> <property name="leftMargin">
@ -399,8 +399,8 @@ border-image: url(:/images/closepressed.png)
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -24,7 +24,7 @@
#include "gui/SoundManager.h" #include "gui/SoundManager.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/common/RsCollectionDialog.h" #include "gui/common/RsCollection.h"
#include "gui/common/RSTreeView.h" #include "gui/common/RSTreeView.h"
#include "gui/common/RsUrlHandler.h" #include "gui/common/RsUrlHandler.h"
#include "gui/FileTransfer/DetailsDialog.h" #include "gui/FileTransfer/DetailsDialog.h"
@ -37,7 +37,7 @@
#include "gui/FileTransfer/xprogressbar.h" #include "gui/FileTransfer/xprogressbar.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include "util/RsFile.h" #include "util/RsFile.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
@ -1975,7 +1975,7 @@ void TransfersDialog::pasteLink()
for(auto &it : links) for(auto &it : links)
col.merge_in(it.name(),it.size(),RsFileHash(it.hash().toStdString())) ; col.merge_in(it.name(),it.size(),RsFileHash(it.hash().toStdString())) ;
RsCollectionDialog::downloadFiles(col); col.downloadFiles();
} }
void TransfersDialog::getDLSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows) void TransfersDialog::getDLSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows)
@ -2466,17 +2466,21 @@ void TransfersDialog::collCreate()
std::set<RsFileHash>::iterator it ; std::set<RsFileHash>::iterator it ;
getDLSelectedItems(&items, NULL); getDLSelectedItems(&items, NULL);
RsFileTree tree;
for (it = items.begin(); it != items.end(); ++it) for (it = items.begin(); it != items.end(); ++it)
{ {
FileInfo info; FileInfo info;
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, info)) continue; if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, info)) continue;
tree.addFile(tree.root(),info.fname,info.hash,info.size); DirDetails details;
details.name = info.fname;
details.hash = info.hash;
details.size = info.size;
details.type = DIR_TYPE_FILE;
dirVec.push_back(details);
} }
RsCollectionDialog::openNewCollection(tree); RsCollection(dirVec,RS_FILE_HINTS_LOCAL).openNewColl(this);
} }
void TransfersDialog::collModif() void TransfersDialog::collModif()
@ -2500,8 +2504,12 @@ void TransfersDialog::collModif()
/* open collection */ /* open collection */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath()); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath());
}
}
} }
} }
@ -2526,8 +2534,12 @@ void TransfersDialog::collView()
/* open collection */ /* open collection */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath(), true); if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath(), true);
}
}
} }
} }
@ -2552,29 +2564,23 @@ void TransfersDialog::collOpen()
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) if (qinfo.exists()) {
{ if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection::RsCollectionErrorCode code; RsCollection collection;
RsCollectionDialog::downloadFiles(RsCollection(qinfo.absoluteFilePath(),code)); if (collection.load(qinfo.absoluteFilePath())) {
return; collection.downloadFiles();
} return;
}
}
}
} }
} }
} }
QString fileName; RsCollection collection;
if (!misc::getOpenFileName(nullptr, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")", fileName)) if (collection.load(this)) {
return ; collection.downloadFiles();
}
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
RsCollection::RsCollectionErrorCode code;
RsCollection collection(fileName,code);
if(code == RsCollection::RsCollectionErrorCode::COLLECTION_NO_ERROR)
RsCollectionDialog::downloadFiles(collection);
else
QMessageBox::information(nullptr,tr("Error openning collection file"),RsCollection::errorString(code));
} }
void TransfersDialog::collAutoOpen(const QString &fileHash) void TransfersDialog::collAutoOpen(const QString &fileHash)
@ -2586,18 +2592,21 @@ void TransfersDialog::collAutoOpen(const QString &fileHash)
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) { if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
/* make path for downloaded files */ /* make path for downloaded files */
if (info.downloadStatus == FT_STATE_COMPLETE) if (info.downloadStatus == FT_STATE_COMPLETE) {
{
std::string path; std::string path;
path = info.path + "/" + info.fname; path = info.path + "/" + info.fname;
/* open file with a suitable application */ /* open file with a suitable application */
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
RsCollection::RsCollectionErrorCode err; if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) RsCollection collection;
RsCollectionDialog::downloadFiles(RsCollection(qinfo.absoluteFilePath(),err)); if (collection.load(qinfo.absoluteFilePath(), false)) {
collection.autoDownloadFiles();
}
}
}
} }
} }
} }

12
retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp Executable file → Normal file
View file

@ -101,7 +101,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_UTRANSFERRED: case COLUMN_UTRANSFERRED:
transferred = index.data().toLongLong(); transferred = index.data().toLongLong();
@ -120,7 +120,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_ULSPEED: case COLUMN_ULSPEED:
ulspeed = index.data().toDouble(); ulspeed = index.data().toDouble();
@ -131,7 +131,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp.sprintf("%.2f", ulspeed/1024.); temp.sprintf("%.2f", ulspeed/1024.);
temp += " KB/s"; temp += " KB/s";
} }
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_UPROGRESS: case COLUMN_UPROGRESS:
{ {
@ -164,10 +164,10 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off); pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize)); pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
if (pixmapRect.isValid()){ if (pixmapRect.isValid()){
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter, pixmap.size(), option.rect).topLeft(); QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
painter->drawPixmap(p, pixmap); painter->drawPixmap(p, pixmap);
} }
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft | Qt::AlignVCenter, index.data().toString()); painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
break; break;
default: default:
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString()); painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
@ -181,7 +181,7 @@ QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModel
{ {
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString()); float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
int S = QFontMetricsF(option.font).height()*1.5 ; int S = QFontMetricsF(option.font).height() ;
return QSize(w,S); return QSize(w,S);
} }

View file

@ -202,8 +202,8 @@ void FriendsDialog::chatMessageReceived(const ChatMessage &msg)
{ {
if(msg.chat_id.isBroadcast()) if(msg.chat_id.isBroadcast())
{ {
QDateTime sendTime = DateTime::DateTimeFromTime_t(msg.sendTime); QDateTime sendTime = QDateTime::fromTime_t(msg.sendTime);
QDateTime recvTime = DateTime::DateTimeFromTime_t(msg.recvTime); QDateTime recvTime = QDateTime::fromTime_t(msg.recvTime);
QString message = QString::fromUtf8(msg.msg.c_str()); QString message = QString::fromUtf8(msg.msg.c_str());
QString name = QString::fromUtf8(rsPeers->getPeerName(msg.broadcast_peer_id).c_str()); QString name = QString::fromUtf8(rsPeers->getPeerName(msg.broadcast_peer_id).c_str());

View file

@ -102,7 +102,7 @@
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="icons.qrc"> <iconset resource="images.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset> <normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
@ -132,10 +132,10 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout" name="headerBFrame_GL"> <layout class="QGridLayout" name="headerBFrame_GL">
<property name="leftMargin"> <property name="leftMargin">
@ -401,8 +401,8 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="icons.qrc"/>
<include location="images.qrc"/> <include location="images.qrc"/>
<include location="icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -251,7 +251,7 @@ void GenCertDialog::initKeyList()
void GenCertDialog::mouseMoveEvent(QMouseEvent *e) void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
{ {
//std::cerr << "Mouse : " << e->x() << ", " << e->y() << std::endl; std::cerr << "Mouse : " << e->x() << ", " << e->y() << std::endl;
QDialog::mouseMoveEvent(e) ; QDialog::mouseMoveEvent(e) ;
} }
@ -609,9 +609,7 @@ void GenCertDialog::genPerson()
QCoreApplication::processEvents(); QCoreApplication::processEvents();
QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance(); QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance();
#ifdef DEBUG_GENCERTDIALOG std::cout << "Waiting ed->processEvents()" << std::endl;
std::cout << "Waiting ed->processEvents()" << std::endl;
#endif
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
if (ed->hasPendingEvents()) if (ed->hasPendingEvents())
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd)); while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));
@ -649,7 +647,7 @@ void GenCertDialog::genPerson()
{ {
/* complete the process */ /* complete the process */
RsInit::LoadPassword(sslPasswd); RsInit::LoadPassword(sslPasswd);
if (RsApplication::loadCertificate(sslId, false)) { if (Rshare::loadCertificate(sslId, false)) {
// Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start. // Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start.
// (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this. // (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this.

View file

@ -421,7 +421,7 @@ void GetStartedDialog::emailSupport()
sysVersion = "Linux"; sysVersion = "Linux";
#endif #endif
#endif #endif
text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(RsApplication::retroshareVersion(true) text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(Rshare::retroshareVersion(true)
, sysVersion , sysVersion
).arg(static_cast<typename std::underlying_type<RsConfigUserLvl>::type>(userLevel)) + "\n"; ).arg(static_cast<typename std::underlying_type<RsConfigUserLvl>::type>(userLevel)) + "\n";
text += "\n"; text += "\n";

View file

@ -80,7 +80,7 @@ HelpDialog::HelpDialog(QWidget *parent) :
ui->thanks->setHtml(in.readAll()); ui->thanks->setHtml(in.readAll());
} }
ui->version->setText(RsApplication::retroshareVersion(true)); ui->version->setText(Rshare::retroshareVersion(true));
/* Add version numbers of libretroshare */ /* Add version numbers of libretroshare */
std::list<RsLibraryInfo> libraries; std::list<RsLibraryInfo> libraries;

View file

@ -27,13 +27,11 @@
#include "util/misc.h" #include "util/misc.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/common/FilesDefs.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "gui/connect/ConfCertDialog.h" #include "gui/connect/ConfCertDialog.h"
#include <gui/QuickStartWizard.h> #include <gui/QuickStartWizard.h>
#include "gui/connect/FriendRecommendDialog.h" #include "gui/connect/FriendRecommendDialog.h"
#include "settings/rsharesettings.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QUrlQuery> #include <QUrlQuery>
@ -65,9 +63,6 @@ HomePage::HomePage(QWidget *parent) :
QAction *RecAction = new QAction(QIcon(),tr("Recommend friends to each others"), this); QAction *RecAction = new QAction(QIcon(),tr("Recommend friends to each others"), this);
connect(RecAction, SIGNAL(triggered()), this, SLOT(recommendFriends())); connect(RecAction, SIGNAL(triggered()), this, SLOT(recommendFriends()));
QAction *SaveAction = new QAction(QIcon(),tr("Save to File"), this);
connect(SaveAction, SIGNAL(triggered()), this, SLOT(saveCert()));
QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this); QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this);
connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient())); connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient()));
@ -78,7 +73,6 @@ HomePage::HomePage(QWidget *parent) :
menu->addAction(CopyIdAction); menu->addAction(CopyIdAction);
menu->addSeparator(); menu->addSeparator();
menu->addAction(SaveAction);
menu->addAction(SendAction); menu->addAction(SendAction);
menu->addAction(WebMailAction); menu->addAction(WebMailAction);
menu->addAction(RecAction); menu->addAction(RecAction);
@ -141,8 +135,6 @@ HomePage::HomePage(QWidget *parent) :
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK ); rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
updateOwnCert(); updateOwnCert();
updateHomeLogo();
} }
void HomePage::handleEvent(std::shared_ptr<const RsEvent> e) void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
@ -385,18 +377,3 @@ void HomePage::openWebHelp()
{ {
QDesktopServices::openUrl(QUrl(QString("https://retrosharedocs.readthedocs.io/en/latest/"))); QDesktopServices::openUrl(QUrl(QString("https://retrosharedocs.readthedocs.io/en/latest/")));
} }
void HomePage::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateHomeLogo();
}
}
void HomePage::updateHomeLogo()
{
if (Settings->getSheetName() == ":Standard_Dark")
ui->label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/logo/logo_web_nobackground_black.png"));
else
ui->label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/logo/logo_web_nobackground.png"));
}

View file

@ -51,8 +51,6 @@ public:
void getOwnCert(QString& invite,QString& description) const; void getOwnCert(QString& invite,QString& description) const;
RetroshareInviteFlags currentInviteFlags() const ; RetroshareInviteFlags currentInviteFlags() const ;
virtual void showEvent(QShowEvent *) override;
private slots: private slots:
#ifdef DEAD_CODE #ifdef DEAD_CODE
void certContextMenu(QPoint); void certContextMenu(QPoint);
@ -65,8 +63,7 @@ private slots:
void addFriend(); void addFriend();
void webMail(); void webMail();
void openWebHelp() ; void openWebHelp() ;
void recommendFriends(); void recommendFriends();
void updateHomeLogo();
private: private:
Ui::HomePage *ui; Ui::HomePage *ui;

View file

@ -43,6 +43,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>Courier New</family> <family>Courier New</family>
<pointsize>10</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@ -87,6 +88,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>11</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@ -105,7 +107,7 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="icons.qrc"> <iconset resource="images.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset> <normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
@ -231,6 +233,11 @@
</item> </item>
<item row="1" column="0" colspan="5"> <item row="1" column="0" colspan="5">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text"> <property name="text">
<string>Open Source cross-platform, <string>Open Source cross-platform,
private and secure decentralized communication platform. private and secure decentralized communication platform.
@ -310,6 +317,11 @@ private and secure decentralized communication platform.
</item> </item>
<item row="0" column="0" colspan="3"> <item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
@ -393,6 +405,11 @@ private and secure decentralized communication platform.
</item> </item>
<item row="0" column="0" colspan="3"> <item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text"> <property name="text">
<string>Do you need help with Retroshare?</string> <string>Do you need help with Retroshare?</string>
</property> </property>
@ -407,8 +424,8 @@ private and secure decentralized communication platform.
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="icons.qrc"/>
<include location="images.qrc"/> <include location="images.qrc"/>
<include location="icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

File diff suppressed because it is too large Load diff

View file

@ -22,10 +22,8 @@
#define IDENTITYDIALOG_H #define IDENTITYDIALOG_H
#include "gui/gxs/RsGxsUpdateBroadcastPage.h" #include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "util/FontSizeHandler.h"
#include "retroshare/rsidentity.h" #include <retroshare/rsidentity.h>
#include "IdentityListModel.h"
#include <QTimer> #include <QTimer>
@ -36,11 +34,7 @@ class IdDialog;
} }
class UIStateHelper; class UIStateHelper;
class QStyledItemDelegate;
class QTreeWidgetItem; class QTreeWidgetItem;
class RsIdentityListModel;
class IdListSortFilterProxyModel;
class QItemSelection;
class IdDialog : public MainPage class IdDialog : public MainPage
{ {
@ -64,7 +58,6 @@ protected:
void loadIdentity(RsGxsIdGroup id_data); void loadIdentity(RsGxsIdGroup id_data);
void loadCircles(const std::list<RsGroupMetaData>& circle_metas); void loadCircles(const std::list<RsGroupMetaData>& circle_metas);
void updateIdListRequest();
//void requestCircleGroupData(const RsGxsCircleId& circle_id); //void requestCircleGroupData(const RsGxsCircleId& circle_id);
bool getItemCircleId(QTreeWidgetItem *item,RsGxsCircleId& id) ; bool getItemCircleId(QTreeWidgetItem *item,RsGxsCircleId& id) ;
@ -73,13 +66,13 @@ protected:
private slots: private slots:
void updateIdList(); void updateIdList();
void updateCircles(); void updateCircles();
void createExternalCircle();
void createExternalCircle();
void showEditExistingCircle(); void showEditExistingCircle();
void updateCirclesDisplay(); void updateCirclesDisplay();
void toggleAutoBanIdentities(bool b); void toggleAutoBanIdentities(bool b);
void sortColumn(int col,Qt::SortOrder so);
void acceptCircleSubscription() ; void acceptCircleSubscription() ;
void cancelCircleSubscription() ; void cancelCircleSubscription() ;
@ -93,20 +86,17 @@ private slots:
void removeIdentity(); void removeIdentity();
void editIdentity(); void editIdentity();
void chatIdentity(); void chatIdentity();
void chatIdentityItem(const QModelIndex &indx); void chatIdentityItem(QTreeWidgetItem* item);
void chatIdentity(const RsGxsId& toGxsId); void sendMsg();
void sendMsg();
void copyRetroshareLink(); void copyRetroshareLink();
void on_closeInfoFrameButton_Invite_clicked(); void on_closeInfoFrameButton_Invite_clicked();
void updateSelection(const QItemSelection &new_sel, const QItemSelection &old_sel); void updateSelection();
void modifyReputation(); void modifyReputation();
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void IdListCustomPopupMenu( QPoint point ); void IdListCustomPopupMenu( QPoint point );
void headerContextMenuRequested(QPoint);
void toggleColumnVisible();
void CircleListCustomPopupMenu(QPoint point) ; void CircleListCustomPopupMenu(QPoint point) ;
#ifdef SUSPENDED #ifdef SUSPENDED
@ -127,12 +117,7 @@ private:
void processSettings(bool load); void processSettings(bool load);
QString createUsageString(const RsIdentityUsage& u) const; QString createUsageString(const RsIdentityUsage& u) const;
void saveExpandedPathsAndSelection_idTreeView(std::set<QStringList> &expanded, std::set<QStringList> &selected); void requestIdData(std::list<RsGxsGroupId> &ids);
void restoreExpandedPathsAndSelection_idTreeView(const std::set<QStringList>& expanded, const std::set<QStringList>& selelected);
void recursSaveExpandedItems_idTreeView(const QModelIndex& index, const QStringList& parent_path, std::set<QStringList>& expanded, std::set<QStringList>& selected);
void recursRestoreExpandedItems_idTreeView(const QModelIndex& index,const QStringList& parent_path,const std::set<QStringList>& expanded,const std::set<QStringList>& selected);
void requestIdData(std::list<RsGxsGroupId> &ids);
bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept); bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept);
void insertIdList(uint32_t token); void insertIdList(uint32_t token);
void filterIds(); void filterIds();
@ -149,32 +134,20 @@ private:
private: private:
UIStateHelper *mStateHelper; UIStateHelper *mStateHelper;
QTreeWidgetItem *contactsItem;
QTreeWidgetItem *allItem;
QTreeWidgetItem *ownItem;
QTreeWidgetItem *mExternalBelongingCircleItem; QTreeWidgetItem *mExternalBelongingCircleItem;
QTreeWidgetItem *mExternalOtherCircleItem; QTreeWidgetItem *mExternalOtherCircleItem;
QTreeWidgetItem *mMyCircleItem; QTreeWidgetItem *mMyCircleItem;
RsGxsUpdateBroadcastBase *mCirclesBroadcastBase ; RsGxsUpdateBroadcastBase *mCirclesBroadcastBase ;
int mLastSortColumn; void saveExpandedCircleItems(std::vector<bool> &expanded_root_items, std::set<RsGxsCircleId>& expanded_circle_items) const;
Qt::SortOrder mLastSortOrder;
void saveExpandedCircleItems(std::vector<bool> &expanded_root_items, std::set<RsGxsCircleId>& expanded_circle_items) const;
void restoreExpandedCircleItems(const std::vector<bool>& expanded_root_items,const std::set<RsGxsCircleId>& expanded_circle_items); void restoreExpandedCircleItems(const std::vector<bool>& expanded_root_items,const std::set<RsGxsCircleId>& expanded_circle_items);
void applyWhileKeepingTree(std::function<void()> predicate); RsGxsGroupId mId;
RsGxsId getSelectedIdentity() const;
std::list<RsGxsId> getSelectedIdentities() const;
RsGxsGroupId mId;
RsGxsGroupId mIdToNavigate; RsGxsGroupId mIdToNavigate;
int filter; int filter;
bool mColumnSizeAlreadySet; // remembers if we already did some size set. If not, automatically stretch to content.
QStyledItemDelegate *mElidedLabelDelegate;
QStyledItemDelegate *mReputationDelegate;
RsIdentityListModel *mIdListModel;
IdListSortFilterProxyModel *mProxyModel;
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
RsEventsHandlerId_t mEventHandlerId_identity; RsEventsHandlerId_t mEventHandlerId_identity;
@ -184,8 +157,6 @@ private:
bool needUpdateIdsOnNextShow; bool needUpdateIdsOnNextShow;
bool needUpdateCirclesOnNextShow; bool needUpdateCirclesOnNextShow;
FontSizeHandler mFontSizeHandler;
/* UI - Designer */ /* UI - Designer */
Ui::IdDialog *ui; Ui::IdDialog *ui;
}; };

File diff suppressed because it is too large Load diff

View file

@ -700,10 +700,10 @@ void IdEditDialog::removeAvatar()
void IdEditDialog::updateInterface() void IdEditDialog::updateInterface()
{ {
QPixmap pixmap = ui->avatarLabel->pixmap(Qt::ReturnByValue); const QPixmap *pixmap = ui->avatarLabel->pixmap();
if (!pixmap.isNull()) { if (pixmap && !pixmap->isNull()) {
ui->removeButton->setEnabled(true); ui->removeButton->setEnabled(true);
} else if (mEditGroup.mImage.mSize > 0) { } else if (mEditGroup.mImage.mSize != NULL) {
ui->removeButton->setEnabled(true); ui->removeButton->setEnabled(true);
} else { } else {
ui->removeButton->setEnabled(false); ui->removeButton->setEnabled(false);

View file

@ -1,968 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/msgs/RsFriendListModel.cpp *
* *
* Copyright 2019 by Cyril Soler <csoler@users.sourceforge.net> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <list>
#include <QApplication>
#include <QDateTime>
#include <QFontMetrics>
#include <QModelIndex>
#include <QTreeView>
#include <QPainter>
#include <QIcon>
#include "gui/common/AvatarDefs.h"
#include "util/qtthreadsutils.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "gui/gxs/GxsIdDetails.h"
#include "retroshare/rsexpr.h"
#include "IdentityListModel.h"
//#define DEBUG_MODEL
//#define DEBUG_MODEL_INDEX
std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsewhere
const QString RsIdentityListModel::FilterString("filtered");
const uint32_t MAX_INTERNAL_DATA_UPDATE_DELAY = 300 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes.
const uint32_t MAX_NODE_UPDATE_DELAY = 10 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes.
static const uint32_t ID_DETAILS_UPDATE_DELAY = 5; // update each node every 5 secs.
RsIdentityListModel::RsIdentityListModel(QObject *parent)
: QAbstractItemModel(parent)
, mLastInternalDataUpdate(0), mLastNodeUpdate(0)
{
mFontSize = QApplication::font().pointSize();
mFilterStrings.clear();
mIdentityUpdateTimer = new QTimer();
connect(mIdentityUpdateTimer,SIGNAL(timeout()),this,SLOT(timerUpdate()));
}
void RsIdentityListModel::timerUpdate()
{
emit dataChanged(index(0,0,QModelIndex()),index(2,0,QModelIndex()));
}
RsIdentityListModel::EntryIndex::EntryIndex()
: type(ENTRY_TYPE_INVALID),category_index(0),identity_index(0)
{
}
// The index encodes the whole hierarchy of parents. This allows to very efficiently compute indices of the parent of an index.
//
// On 32 bits and 64 bits architectures the format is the following:
//
// 0x [2 bits] 00000 [24 bits] [2 bits]
// | | |
// | | +-------------- type (0=top level, 1=category, 2=identity)
// | +----------------------- identity index
// +-------------------------------------- category index
//
bool RsIdentityListModel::convertIndexToInternalId(const EntryIndex& e,quintptr& id)
{
// the internal id is set to the place in the table of items. We simply shift to allow 0 to mean something special.
if(e.type == ENTRY_TYPE_INVALID)
{
RsErr() << "ERROR: asked for the internal id of an invalid EntryIndex" ;
id = 0;
return true;
}
if(bool(e.identity_index >> 24))
{
RsErr() << "Cannot encode more than 2^24 identities. Somthing's wrong. e.identity_index = " << std::hex << e.identity_index << std::dec ;
id = 0;
return false;
}
id = ((0x3 & (uint32_t)e.category_index) << 30) + ((uint32_t)e.identity_index << 2) + (0x3 & (uint32_t)e.type);
return true;
}
bool RsIdentityListModel::convertInternalIdToIndex(quintptr ref,EntryIndex& e)
{
// Compatible with ref=0 since it will cause type=TOP_LEVEL
e.type = static_cast<RsIdentityListModel::EntryType>((ref >> 0) & 0x3) ;// 2 bits
e.identity_index = (ref >> 2) & 0xffffff;// 24 bits
e.category_index = (ref >> 30) & 0x3 ;// 2 bits
return true;
}
static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
{
int avatarWidth = avatar.width();
int avatarHeight = avatar.height();
QPixmap pixmap(avatar);
int overlaySize = (avatarWidth > avatarHeight) ? (avatarWidth/2.5) : (avatarHeight/2.5);
int overlayX = avatarWidth - overlaySize;
int overlayY = avatarHeight - overlaySize;
QPainter painter(&pixmap);
painter.drawPixmap(overlayX, overlayY, overlaySize, overlaySize, overlay);
QIcon icon;
icon.addPixmap(pixmap);
return icon;
}
void RsIdentityListModel::preMods()
{
emit layoutAboutToBeChanged();
}
void RsIdentityListModel::postMods()
{
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,columnCount()-1,(void*)NULL));
emit layoutChanged();
}
int RsIdentityListModel::rowCount(const QModelIndex& parent) const
{
if(parent.column() >= COLUMN_THREAD_NB_COLUMNS)
return 0;
EntryIndex index;
if(!parent.isValid() || !convertInternalIdToIndex(parent.internalId(),index))
return mCategories.size();
switch(index.type)
{
case ENTRY_TYPE_CATEGORY: return mCategories[index.category_index].child_identity_indices.size();
case ENTRY_TYPE_TOP_LEVEL: return mCategories.size();
default:
return 0;
}
}
int RsIdentityListModel::columnCount(const QModelIndex &/*parent*/) const
{
return COLUMN_THREAD_NB_COLUMNS ;
}
bool RsIdentityListModel::hasChildren(const QModelIndex &parent) const
{
if(!parent.isValid())
return true;
EntryIndex parent_index ;
convertInternalIdToIndex(parent.internalId(),parent_index);
if(parent_index.type == ENTRY_TYPE_TOP_LEVEL)
return true;
if(parent_index.type == ENTRY_TYPE_IDENTITY)
return false;
if(parent_index.type == ENTRY_TYPE_CATEGORY)
return !mCategories[parent_index.category_index].child_identity_indices.empty();
return false;
}
RsIdentityListModel::EntryIndex RsIdentityListModel::EntryIndex::parent() const
{
EntryIndex i(*this);
switch(type)
{
case ENTRY_TYPE_CATEGORY: i.type = ENTRY_TYPE_TOP_LEVEL;
i.category_index = 0;
i.identity_index = 0;
break;
case ENTRY_TYPE_IDENTITY: i.type = ENTRY_TYPE_CATEGORY;
i.identity_index = 0;
break;
case ENTRY_TYPE_TOP_LEVEL:
std::cerr << "ERROR: calling parent() on entryindex with no parent!" << std::endl;
default:
//Can be when request root index.
break;
}
return i;
}
RsIdentityListModel::EntryIndex RsIdentityListModel::EntryIndex::child(int row) const
{
EntryIndex i;
switch(type)
{
case ENTRY_TYPE_TOP_LEVEL:
i.type = ENTRY_TYPE_CATEGORY;
i.category_index = row;
i.identity_index = 0;
break;
case ENTRY_TYPE_CATEGORY: i.type = ENTRY_TYPE_IDENTITY;
i.category_index = category_index;
i.identity_index = row;
break;
case ENTRY_TYPE_IDENTITY: i = EntryIndex();
std::cerr << "ERROR: calling child() on entryindex with no children!" << std::endl;
default:
break;
}
return i;
}
uint32_t RsIdentityListModel::EntryIndex::parentRow() const
{
switch(type)
{
default:
case ENTRY_TYPE_TOP_LEVEL: return -1;
case ENTRY_TYPE_CATEGORY : return -1;
case ENTRY_TYPE_IDENTITY : return category_index;
}
}
QModelIndex RsIdentityListModel::index(int row, int column, const QModelIndex& parent) const
{
if(row < 0 || column < 0 || column >= columnCount(parent) || row >= rowCount(parent))
return QModelIndex();
EntryIndex parent_index ;
convertInternalIdToIndex(parent.internalId(),parent_index);
#ifdef DEBUG_MODEL_INDEX
RsDbg() << "Index row=" << row << " col=" << column << " parent=" << parent << std::endl;
#endif
quintptr ref;
EntryIndex new_index = parent_index.child(row);
convertIndexToInternalId(new_index,ref);
#ifdef DEBUG_MODEL_INDEX
RsDbg() << " returning " << createIndex(row,column,ref) << std::endl;
#endif
return createIndex(row,column,ref);
}
QModelIndex RsIdentityListModel::parent(const QModelIndex& index) const
{
if(!index.isValid())
return QModelIndex();
EntryIndex I ;
convertInternalIdToIndex(index.internalId(),I);
EntryIndex p = I.parent();
if(p.type == ENTRY_TYPE_TOP_LEVEL)
return QModelIndex();
quintptr i;
convertIndexToInternalId(p,i);
return createIndex(I.parentRow(),0,i);
}
Qt::ItemFlags RsIdentityListModel::flags(const QModelIndex& index) const
{
if (!index.isValid())
return Qt::ItemFlags();
return QAbstractItemModel::flags(index);
}
QVariant RsIdentityListModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
{
if(role == Qt::DisplayRole)
switch(section)
{
case COLUMN_THREAD_NAME: return tr("Name");
case COLUMN_THREAD_ID: return tr("Id");
case COLUMN_THREAD_REPUTATION: return QVariant();
case COLUMN_THREAD_OWNER_ID: return tr("Owner Id");
case COLUMN_THREAD_OWNER_NAME: return tr("Owner");
default:
return QVariant();
}
if(role == Qt::DecorationRole && section == COLUMN_THREAD_REPUTATION)
return QIcon(":/icons/flag-green.png");
return QVariant();
}
QVariant RsIdentityListModel::data(const QModelIndex &index, int role) const
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "calling data(" << index << ") role=" << role << std::endl;
#endif
if(!index.isValid())
return QVariant();
quintptr ref = (index.isValid())?index.internalId():0 ;
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "data(" << index << ")" ;
#endif
if(!ref)
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << " [empty]" << std::endl;
#endif
return QVariant() ;
}
EntryIndex entry;
if(!convertInternalIdToIndex(ref,entry))
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "Bad pointer: " << (void*)ref << std::endl;
#endif
return QVariant() ;
}
switch(role)
{
case Qt::SizeHintRole: return sizeHintRole(entry,index.column()) ;
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
case Qt::FontRole: return fontRole(entry,index.column()) ;
case Qt::ForegroundRole: return foregroundRole(entry,index.column()) ;
case Qt::DecorationRole: return decorationRole(entry,index.column()) ;
case FilterRole: return filterRole(entry,index.column()) ;
case SortRole: return sortRole(entry,index.column()) ;
case TreePathRole: return treePathRole(entry,index.column()) ;
default:
return QVariant();
}
}
bool RsIdentityListModel::passesFilter(const EntryIndex& e,int /*column*/) const
{
QString s ;
if(mFilterStrings.empty() || e.type != ENTRY_TYPE_IDENTITY)
return true;
auto passes_strings = [&](const QString& s) -> bool {
bool res = true;
for(auto iter(mFilterStrings.begin()); iter != mFilterStrings.end(); ++iter)
res = res && s.contains(*iter,Qt::CaseInsensitive);
return res;
};
if((mFilterType & FilterType::FILTER_TYPE_ID) && passes_strings(displayRole(e,COLUMN_THREAD_ID ).toString())) return true;
if((mFilterType & FilterType::FILTER_TYPE_NAME) && passes_strings(displayRole(e,COLUMN_THREAD_NAME ).toString())) return true;
if((mFilterType & FilterType::FILTER_TYPE_OWNER_ID) && passes_strings(displayRole(e,COLUMN_THREAD_OWNER_ID ).toString())) return true;
if((mFilterType & FilterType::FILTER_TYPE_OWNER_NAME) && passes_strings(displayRole(e,COLUMN_THREAD_OWNER_NAME).toString())) return true;
return false;
}
QVariant RsIdentityListModel::filterRole(const EntryIndex& e,int column) const
{
if(passesFilter(e,column))
return QVariant(FilterString);
return QVariant(QString());
}
uint32_t RsIdentityListModel::updateFilterStatus(ForumModelIndex /*i*/,int /*column*/,const QStringList& /*strings*/)
{
return 0;
}
void RsIdentityListModel::setFilter(uint8_t filter_type, const QStringList& strings)
{
#ifdef DEBUG_MODEL
std::cerr << "Setting filter to filter_type=" << int(filter_type) << " and strings to " ;
foreach(const QString& str,strings)
std::cerr << "\"" << str.toStdString() << "\" " ;
std::cerr << std::endl;
#endif
preMods();
mFilterType = filter_type;
mFilterStrings = strings;
postMods();
}
QVariant RsIdentityListModel::toolTipRole(const EntryIndex& fmpe,int /*column*/) const
{
switch(fmpe.type)
{
case ENTRY_TYPE_IDENTITY:
{
auto id_info = getIdentityInfo(fmpe);
if(!id_info)
return QVariant();
if(id_info->flags & RS_IDENTITY_FLAGS_IS_DEPRECATED)
return QVariant( tr("\nThis identity has a insecure fingerprint (It's probably quite old).\nYou should get rid of it now and use a new one.\nThese identities are not supported anymore.") ) ;
if(rsIdentity->isOwnId(id_info->id))
return QVariant(tr("This identity is owned by you"));
if(id_info->owner.isNull())
return QVariant("Anonymous identity");
else
{
RsPeerDetails dd;
if(rsPeers->getGPGDetails(id_info->owner,dd))
return QVariant(tr("Identity owned by profile")+" \""+ QString::fromUtf8(dd.name.c_str()) +"\" ("+QString::fromStdString(id_info->owner.toStdString()));
else
return QVariant(tr("Identity possibly owned by unknown profile")+" \""+ QString::fromUtf8(dd.name.c_str()) +"\" ("+QString::fromStdString(id_info->owner.toStdString()));
}
}
break;
case ENTRY_TYPE_CATEGORY: ; // fallthrough
default:
return QVariant();
}
}
QVariant RsIdentityListModel::sizeHintRole(const EntryIndex& e,int col) const
{
float x_factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
float y_factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
if(e.type == ENTRY_TYPE_IDENTITY)
y_factor *= 1.0;
if(e.type == ENTRY_TYPE_CATEGORY)
y_factor *= 1.5;
std::cerr << "sizeHintRole()" << std::endl;
switch(col)
{
default:
case COLUMN_THREAD_REPUTATION: return QVariant( QSize(x_factor * 14 , y_factor*14*1.1f ));
case COLUMN_THREAD_NAME:
case COLUMN_THREAD_ID:
case COLUMN_THREAD_OWNER_NAME:
case COLUMN_THREAD_OWNER_ID: return QFontMetricsF(QApplication::font()).boundingRect(displayRole(e,col).toString()).size();
}
}
QString RsIdentityListModel::indexIdentifier(QModelIndex index)
{
quintptr ref = (index.isValid())?index.internalId():0 ;
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "data(" << index << ")" ;
#endif
if(!ref)
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << " [empty]" << std::endl;
#endif
return QString();
}
EntryIndex entry;
if(!convertInternalIdToIndex(ref,entry))
return QString();
return treePathRole(entry,0).toString();
}
QVariant RsIdentityListModel::treePathRole(const EntryIndex& entry,int /*column*/) const
{
if(entry.type == ENTRY_TYPE_CATEGORY)
return QString::number((int)entry.category_index);
else
return QString::fromStdString(mIdentities[mCategories[entry.category_index].child_identity_indices[entry.identity_index]].id.toStdString());
}
QVariant RsIdentityListModel::sortRole(const EntryIndex& entry,int column) const
{
switch(column)
{
case COLUMN_THREAD_REPUTATION: return decorationRole(entry,column);
case COLUMN_THREAD_ID:
case COLUMN_THREAD_OWNER_ID:
case COLUMN_THREAD_OWNER_NAME:
case COLUMN_THREAD_NAME: [[__fallthrough__]];
default:
return displayRole(entry,column);
}
}
QModelIndex RsIdentityListModel::getIndexOfIdentity(const RsGxsId& id) const
{
for(uint i=0;i<mCategories.size();++i)
for(uint j=0;j<mCategories[i].child_identity_indices.size();++j)
if(mIdentities[mCategories[i].child_identity_indices[j]].id == id)
{
EntryIndex e;
e.category_index = i;
e.identity_index = j;
e.type = ENTRY_TYPE_IDENTITY;
quintptr idx;
convertIndexToInternalId(e,idx);
return createIndex(j,0,idx);
}
return QModelIndex();
}
QModelIndex RsIdentityListModel::getIndexOfCategory(Category id) const
{
EntryIndex e;
e.category_index = id;
e.type = ENTRY_TYPE_CATEGORY;
quintptr idx;
convertIndexToInternalId(e,idx);
return createIndex((int)id,0,idx);
}
QVariant RsIdentityListModel::foregroundRole(const EntryIndex& e, int /*col*/) const
{
auto it = getIdentityInfo(e);
if(!it)
return QVariant();
if(it->flags & RS_IDENTITY_FLAGS_IS_DEPRECATED)
return QVariant(QColor(Qt::red));
return QVariant();
}
QVariant RsIdentityListModel::fontRole(const EntryIndex& e, int /*col*/) const
{
QFont f;
f.setPointSize(mFontSize);
auto it = getIdentityInfo(e);
if(it)
{
RsGxsId id(it->id);
if(rsIdentity->isOwnId(id))
f.setBold(true);
}
return QVariant(f);
}
void RsIdentityListModel::setFontSize(int s)
{
if(s != mFontSize)
{
mFontSize = s;
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}
}
#ifdef DEBUG_MODEL_INDEX
std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl;
#endif
#ifdef TODO
int status = onlineRole(e,col).toInt();
switch (status)
{
case RS_STATUS_INACTIVE:
{
QFont font ;
QTreeView* myParent = dynamic_cast<QTreeView*>(QAbstractItemModel::parent());
if (myParent)
font = myParent->font();
font.setBold(true);
return QVariant(font);
}
default:
return QVariant();
}
#endif
QVariant RsIdentityListModel::displayRole(const EntryIndex& e, int col) const
{
#ifdef DEBUG_MODEL_INDEX
std::cerr << " Display role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": ";
#endif
switch(e.type)
{
case ENTRY_TYPE_CATEGORY:
{
const HierarchicalCategoryInformation *cat = getCategoryInfo(e);
if(!cat)
return QVariant();
switch(col)
{
case COLUMN_THREAD_NAME:
#ifdef DEBUG_MODEL_INDEX
std::cerr << group->group_info.name.c_str() ;
#endif
if(!cat->child_identity_indices.empty())
return QVariant(cat->category_name+" (" + QString::number(cat->child_identity_indices.size()) + ")");
else
return QVariant(cat->category_name);
default:
return QVariant();
}
}
break;
case ENTRY_TYPE_IDENTITY:
{
const HierarchicalIdentityInformation *idinfo = getIdentityInfo(e);
const QString loading_string = "["+tr("Loading...")+"]";
#ifdef DEBUG_MODEL_INDEX
std::cerr << profile->profile_info.name.c_str() ;
#endif
if(col == COLUMN_THREAD_ID) return QVariant(QString::fromStdString(idinfo->id.toStdString()) );
if(col == COLUMN_THREAD_REPUTATION) return QVariant();
if(idinfo->nickname.empty())
return loading_string;
switch(col)
{
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(idinfo->nickname.c_str()));
case COLUMN_THREAD_OWNER_NAME: if(idinfo->owner.isNull())
return QVariant();
else
return QVariant(QString::fromStdString(rsPeers->getGPGName(idinfo->owner)) );
case COLUMN_THREAD_OWNER_ID: if(idinfo->owner.isNull())
return QVariant();
else
return QVariant(QString::fromStdString(idinfo->owner.toStdString()) );
default:
return QVariant();
}
}
break;
default: //ENTRY_TYPE
return QVariant();
}
}
// This function makes sure that the internal data gets updated. They are situations where the notification system cannot
// send the information about changes, such as when the computer is put on sleep.
void RsIdentityListModel::checkInternalData(bool force)
{
rstime_t now = time(NULL);
if( (mLastInternalDataUpdate + MAX_INTERNAL_DATA_UPDATE_DELAY < now) || force)
updateIdentityList();
}
const RsIdentityListModel::HierarchicalCategoryInformation *RsIdentityListModel::getCategoryInfo(const EntryIndex& e) const
{
if(e.category_index >= mCategories.size())
return NULL ;
else
return &mCategories[e.category_index];
}
const RsIdentityListModel::HierarchicalIdentityInformation *RsIdentityListModel::getIdentityInfo(const EntryIndex& e) const
{
// First look into the relevant group, then for the correct profile in this group.
if(e.type != ENTRY_TYPE_IDENTITY)
return nullptr ;
if(e.category_index >= mCategories.size())
return nullptr ;
if(e.identity_index < mCategories[e.category_index].child_identity_indices.size())
{
auto& it(mIdentities[mCategories[e.category_index].child_identity_indices[e.identity_index]]);
rstime_t now = time(nullptr);
if(now > it.last_update_TS + ID_DETAILS_UPDATE_DELAY)
{
RsIdentityDetails det;
if(rsIdentity->getIdDetails(it.id,det))
{
it.nickname = det.mNickname;
it.owner = det.mPgpId;
it.flags = det.mFlags;
it.last_update_TS = now;
}
}
return &it;
}
else
{
RsErr() << "Inconsistent identity index!" ;
return nullptr;
}
}
QVariant RsIdentityListModel::decorationRole(const EntryIndex& entry,int col) const
{
switch(entry.type)
{
case ENTRY_TYPE_CATEGORY:
return QVariant();
case ENTRY_TYPE_IDENTITY:
{
const HierarchicalIdentityInformation *hn = getIdentityInfo(entry);
if(!hn)
return QVariant();
if(col == COLUMN_THREAD_REPUTATION)
return QVariant( static_cast<uint8_t>(rsReputations->overallReputationLevel(hn->id)) );
else if(col == COLUMN_THREAD_NAME)
{
QPixmap sslAvatar;
RsIdentityDetails details ;
if(!rsIdentity->getIdDetails(hn->id, details))
{
mIdentityUpdateTimer->stop();
mIdentityUpdateTimer->setSingleShot(true);
mIdentityUpdateTimer->start(500);
return QVariant();
}
else if(details.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(details.mAvatar.mData, details.mAvatar.mSize, sslAvatar,GxsIdDetails::LARGE))
return QVariant(QIcon(GxsIdDetails::makeDefaultIcon(hn->id,GxsIdDetails::SMALL)));
else
return QVariant(QIcon(sslAvatar));
}
else
return QVariant();
}
break;
default:
return QVariant();
}
}
void RsIdentityListModel::clear()
{
preMods();
mIdentities.clear();
mCategories.clear();
mCategories.resize(3);
mCategories[0].category_name = tr("My own identities");
mCategories[1].category_name = tr("My contacts");
mCategories[2].category_name = tr("All");
postMods();
emit friendListChanged();
}
void RsIdentityListModel::debug_dump() const
{
std::cerr << "==== IdentityListModel Debug dump ====" << std::endl;
std::cerr << "Invalid index : " << QModelIndex() << std::endl;
EntryIndex top_level;
top_level.type = ENTRY_TYPE_TOP_LEVEL;
quintptr id;
convertIndexToInternalId(top_level,id);
std::cerr << "Top level index: " << createIndex(0,0,id) << std::endl;
EntryIndex tei;
convertInternalIdToIndex(0,tei);
std::cerr << "Top level entry index: " << tei << std::endl;
for(uint32_t j=0;j<mCategories.size();++j)
{
std::cerr << mCategories[j].category_name.toStdString() << " (" << mCategories[j].child_identity_indices.size() << ")" << std::endl;
const auto& hg(mCategories[j].child_identity_indices);
for(uint32_t i=0;i<hg.size();++i)
{
auto idx = getIndexOfIdentity(mIdentities[hg[i]].id);
auto parent = idx.parent();
EntryIndex index;
EntryIndex index_parent;
convertInternalIdToIndex(idx.internalId(),index);
convertInternalIdToIndex(parent.internalId(),index_parent);
std::cerr << " " << mIdentities[hg[i]].id << " index = " << idx << " parent = " << idx.parent() << " EntryIndex: " << index << " Parent index: " << index_parent << std::endl;
}
}
std::cerr << "====================================" << std::endl;
}
RsGxsId RsIdentityListModel::getIdentity(const QModelIndex& i) const
{
if(!i.isValid())
return RsGxsId();
EntryIndex e;
if(!convertInternalIdToIndex(i.internalId(),e) || e.type != ENTRY_TYPE_IDENTITY)
return RsGxsId();
const HierarchicalIdentityInformation *gnode = getIdentityInfo(e);
if(gnode)
return gnode->id;
else
return RsGxsId();
}
RsIdentityListModel::EntryType RsIdentityListModel::getType(const QModelIndex& i) const
{
if(!i.isValid())
return ENTRY_TYPE_TOP_LEVEL;
EntryIndex e;
if(!convertInternalIdToIndex(i.internalId(),e))
return ENTRY_TYPE_TOP_LEVEL;
return e.type;
}
int RsIdentityListModel::getCategory(const QModelIndex& i) const
{
if(!i.isValid())
return CATEGORY_ALL;
EntryIndex e;
if(!convertInternalIdToIndex(i.internalId(),e))
return CATEGORY_ALL;
return e.category_index;
}
void RsIdentityListModel::setIdentities(const std::list<RsGroupMetaData>& identities_meta)
{
preMods();
beginResetModel();
clear();
for(auto id:identities_meta)
{
HierarchicalIdentityInformation idinfo;
idinfo.id = RsGxsId(id.mGroupId);
idinfo.last_update_TS = 0;// forces update
if(rsIdentity->isOwnId(idinfo.id))
mCategories[CATEGORY_OWN].child_identity_indices.push_back(mIdentities.size());
else if(rsIdentity->isARegularContact(RsGxsId(id.mGroupId)))
mCategories[CATEGORY_CTS].child_identity_indices.push_back(mIdentities.size());
else
mCategories[CATEGORY_ALL].child_identity_indices.push_back(mIdentities.size());
mIdentities.push_back(idinfo);
}
if (mCategories.size()>0)
{
beginInsertRows(QModelIndex(),0,mCategories.size()-1);
endInsertRows();
}
endResetModel();
postMods();
mLastInternalDataUpdate = time(NULL);
}
void RsIdentityListModel::updateIdentityList()
{
std::cerr << "Updating identity list" << std::endl;
std::list<RsGroupMetaData> ids ;
if(!rsIdentity->getIdentitiesSummaries(ids))
{
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve identity metadata." << std::endl;
return;
}
setIdentities(ids) ;
debug_dump();
}
void RsIdentityListModel::collapseItem(const QModelIndex& index)
{
if(getType(index) != ENTRY_TYPE_CATEGORY)
return;
EntryIndex entry;
if(!convertInternalIdToIndex(index.internalId(),entry))
return;
mExpandedCategories[entry.category_index] = false;
// apparently we cannot be subtle here.
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}
void RsIdentityListModel::expandItem(const QModelIndex& index)
{
if(getType(index) != ENTRY_TYPE_CATEGORY)
return;
EntryIndex entry;
if(!convertInternalIdToIndex(index.internalId(),entry))
return;
mExpandedCategories[entry.category_index] = true;
// apparently we cannot be subtle here.
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}

View file

@ -1,252 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/msgs/RsFriendListModel.h *
* *
* Copyright 2019 by Cyril Soler <csoler@users.sourceforge.net> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#pragma once
#include <QModelIndex>
#include <QColor>
#include "retroshare/rsstatus.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsidentity.h"
typedef uint32_t ForumModelIndex;
// This class is the item model used by Qt to display the information
class QTimer;
class RsIdentityListModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit RsIdentityListModel(QObject *parent = NULL);
~RsIdentityListModel(){}
enum Columns {
COLUMN_THREAD_NAME = 0x00,
COLUMN_THREAD_ID = 0x01,
COLUMN_THREAD_OWNER_NAME = 0x02,
COLUMN_THREAD_OWNER_ID = 0x03,
COLUMN_THREAD_REPUTATION = 0x04,
COLUMN_THREAD_NB_COLUMNS = 0x05
};
enum Roles{ SortRole = Qt::UserRole+1,
StatusRole = Qt::UserRole+2,
UnreadRole = Qt::UserRole+3,
FilterRole = Qt::UserRole+4,
TreePathRole = Qt::UserRole+5,
};
enum FilterType{ FILTER_TYPE_NONE = 0x00,
FILTER_TYPE_ID = 0x01,
FILTER_TYPE_NAME = 0x02,
FILTER_TYPE_OWNER_NAME = 0x04,
FILTER_TYPE_OWNER_ID = 0x08
};
enum EntryType{ ENTRY_TYPE_TOP_LEVEL = 0x00,
ENTRY_TYPE_CATEGORY = 0x01,
ENTRY_TYPE_IDENTITY = 0x02,
ENTRY_TYPE_INVALID = 0x03
};
enum Category{ CATEGORY_OWN = 0x00,
CATEGORY_CTS = 0x01,
CATEGORY_ALL = 0x02
};
struct HierarchicalCategoryInformation
{
QString category_name;
std::vector<uint32_t> child_identity_indices; // index in the array of hierarchical profiles
};
// This stores all the info that is useful avoiding a call to the more expensive getIdDetails()
//
struct HierarchicalIdentityInformation
{
rstime_t last_update_TS;
RsGxsId id;
RsPgpId owner;
uint32_t flags;
std::string nickname;
};
// This structure encodes the position of a node in the hierarchy. The type tells which of the index fields are valid.
struct EntryIndex
{
public:
EntryIndex();
EntryType type; // type of the entry (group,profile,location)
friend std::ostream& operator<<(std::ostream& o, const EntryIndex& e)
{
o << "[" ;
switch(e.type)
{
case RsIdentityListModel::ENTRY_TYPE_INVALID: o << "Invalid," ; break;
case RsIdentityListModel::ENTRY_TYPE_CATEGORY: o << "Category," ; break;
case RsIdentityListModel::ENTRY_TYPE_IDENTITY: o << "Identity," ; break;
case RsIdentityListModel::ENTRY_TYPE_TOP_LEVEL: o << "Toplevel," ; break;
}
o << " CI: " << e.category_index << ", ";
o << " II: " << e.identity_index << "]";
return o;
}
// Indices w.r.t. parent. The set of indices entirely determines the position of the entry in the hierarchy.
// An index of 0xff means "undefined"
uint16_t category_index; // index of the category in the mCategory array
uint16_t identity_index; // index of the identity in its own category
EntryIndex parent() const;
EntryIndex child(int row) const;
uint32_t parentRow() const;
};
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
QModelIndex getIndexOfIdentity(const RsGxsId& id) const;
QModelIndex getIndexOfCategory(Category id) const;
void updateIdentityList();
int count() const { return mIdentities.size() ; } // total number of identities
static const QString FilterString ;
// This method will asynchroneously update the data
EntryType getType(const QModelIndex&) const;
RsGxsId getIdentity(const QModelIndex&) const;
int getCategory(const QModelIndex&) const;
void setFontSize(int s);
void setFilter(uint8_t filter_type, const QStringList& strings) ;
void expandItem(const QModelIndex&) ;
void collapseItem(const QModelIndex&) ;
// Overloaded methods from QAbstractItemModel
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& child) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void clear() ;
QString indexIdentifier(QModelIndex i);
/* Color definitions (for standard see default.qss) */
QColor mTextColorGroup;
QColor mTextColorStatus[RS_STATUS_COUNT];
void setIdentities(const std::list<RsGroupMetaData>& identities_meta);
private:
const HierarchicalCategoryInformation *getCategoryInfo (const EntryIndex&) const;
const HierarchicalIdentityInformation *getIdentityInfo(const EntryIndex&) const;
void checkIdentity(HierarchicalIdentityInformation& node);
QVariant sizeHintRole (const EntryIndex& e, int col) const;
QVariant displayRole (const EntryIndex& e, int col) const;
QVariant decorationRole(const EntryIndex& e, int col) const;
QVariant toolTipRole (const EntryIndex& e, int col) const;
QVariant statusRole (const EntryIndex& e, int col) const;
QVariant sortRole (const EntryIndex& e, int col) const;
QVariant fontRole (const EntryIndex& e, int col) const;
QVariant foregroundRole(const EntryIndex& e, int col) const;
QVariant textColorRole (const EntryIndex& e, int col) const;
QVariant filterRole (const EntryIndex& e, int col) const;
QVariant treePathRole (const EntryIndex& entry,int column) const;
/*!
* \brief debug_dump
* Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct.
*/
public slots:
void checkInternalData(bool force);
void debug_dump() const;
void timerUpdate();
signals:
void dataLoaded(); // emitted after the messages have been set. Can be used to updated the UI.
void friendListChanged(); // emitted after the messages have been set. Can be used to updated the UI.
void dataAboutToLoad();
private:
bool passesFilter(const EntryIndex &e, int column) const;
void preMods() ;
void postMods() ;
void *getParentRef(void *ref,int& row) const;
void *getChildRef(void *ref,int row) const;
int getChildrenCount(void *ref) const;
static bool convertIndexToInternalId(const EntryIndex& e,quintptr& ref);
static bool convertInternalIdToIndex(quintptr ref, EntryIndex& e);
uint32_t updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings);
QStringList mFilterStrings;
uint8_t mFilterType;
int mFontSize;
rstime_t mLastInternalDataUpdate;
rstime_t mLastNodeUpdate;;
// The 3 vectors below store thehierarchical information for groups, profiles and locations,
// meaning which is the child/parent of which. The actual group/profile/node data are also stored in the
// structure.
mutable std::vector<HierarchicalCategoryInformation> mCategories;
mutable std::vector<HierarchicalIdentityInformation> mIdentities;
// The top level list contains all nodes to display, which type depends on the option to display groups or not.
// Idices in the list may be profile indices or group indices. In the former case the profile child index refers to
// the inde in the mProfiles tab, whereas in the the later case, the child index refers to the index of the profile in the
// group it belows to.
std::vector<EntryIndex> mTopLevel;
// keeps track of expanded/collapsed items, so as to only show icon for collapsed profiles
std::vector<bool> mExpandedCategories;
// List of identities for which getIdDetails() failed, to be requested again.
mutable QTimer *mIdentityUpdateTimer;
};

View file

@ -28,16 +28,9 @@
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <QtDebug> #include <QtDebug>
#include <QMenuBar>
#include <QActionGroup>
#include <retroshare/rsplugin.h> #include <retroshare/rsplugin.h>
#include <retroshare/rsconfig.h> #include <retroshare/rsconfig.h>
#include <util/argstream.h>
#if defined(Q_OS_DARWIN)
#include "gui/common/MacDockIconHandler.h"
#endif
#ifdef MESSENGER_WINDOW #ifdef MESSENGER_WINDOW
#include "MessengerWindow.h" #include "MessengerWindow.h"
@ -121,7 +114,7 @@
#include "gui/statistics/StatisticsWindow.h" #include "gui/statistics/StatisticsWindow.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "gui/common/RsCollectionDialog.h" #include "gui/common/RsCollection.h"
#include "settings/rsettingswin.h" #include "settings/rsettingswin.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "common/StatusDefs.h" #include "common/StatusDefs.h"
@ -213,7 +206,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
hiddenmode = true; hiddenmode = true;
} }
setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(RsApplication::retroshareVersion(true)) + " - " + nameAndLocation); setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(Rshare::retroshareVersion(true)) + " - " + nameAndLocation);
connect(rApp, SIGNAL(newArgsReceived(QStringList)), this, SLOT(receiveNewArgs(QStringList))); connect(rApp, SIGNAL(newArgsReceived(QStringList)), this, SLOT(receiveNewArgs(QStringList)));
/* add url handler for RetroShare links */ /* add url handler for RetroShare links */
@ -361,8 +354,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged(); settingsChanged();
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);
} }
/** Destructor. */ /** Destructor. */
@ -386,11 +377,6 @@ MainWindow::~MainWindow()
delete sysTrayStatus; delete sysTrayStatus;
delete trayIcon; delete trayIcon;
delete trayMenu; delete trayMenu;
#if defined(Q_OS_DARWIN)
delete menuBar;
delete dockMenu;
MacDockIconHandler::cleanup();
#endif
// delete notifyMenu; // already deleted by the deletion of trayMenu // delete notifyMenu; // already deleted by the deletion of trayMenu
StatisticsWindow::releaseInstance(); StatisticsWindow::releaseInstance();
@ -567,11 +553,6 @@ void MainWindow::addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage
QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName()) ; QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName()) ;
ui->listWidget->addItem(item) ; ui->listWidget->addItem(item) ;
#if defined(Q_OS_DARWIN)
QFont f = ui->toolBarPage->font();
action->setFont(f);
#endif
if (notify) if (notify)
{ {
QPair<QAction*, QListWidgetItem*> pair = QPair<QAction*, QListWidgetItem*>( action, item); QPair<QAction*, QListWidgetItem*> pair = QPair<QAction*, QListWidgetItem*>( action, item);
@ -670,75 +651,10 @@ void MainWindow::createTrayIcon()
trayIcon->setContextMenu(trayMenu); trayIcon->setContextMenu(trayMenu);
trayIcon->setIcon(QIcon(IMAGE_NOONLINE)); trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
#if defined(Q_OS_DARWIN)
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
MacDockIconHandler* dockIconHandler = MacDockIconHandler::instance();
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, [this] {
show();
activateWindow();
});
#endif
#if defined(Q_OS_DARWIN)
createMenuBar();
#endif
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason))); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason)));
trayIcon->show(); trayIcon->show();
} }
#if defined(Q_OS_DARWIN)
/** Creates a new menubar for macOS */
void MainWindow::createMenuBar()
{
/* Mac users sure like their shortcuts. */
actionMinimize = new QAction(tr("Minimize"),this);
actionMinimize->setShortcutContext(Qt::ApplicationShortcut);
actionMinimize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
actionMinimize->setShortcutVisibleInContextMenu(true);
connect(actionMinimize,SIGNAL(triggered()),this,SLOT(minimizeWindow())) ;
actionCloseWindow = new QAction(tr("Close window"),this);
actionCloseWindow->setShortcutContext(Qt::ApplicationShortcut);
actionCloseWindow->setShortcut(QKeySequence::Close);
actionCloseWindow->setShortcutVisibleInContextMenu(true);
connect(actionCloseWindow,SIGNAL(triggered()),this,SLOT(closeWindow())) ;
menuBar = new QMenuBar(this);
QMenu *fileMenu = menuBar->addMenu("");
fileMenu->addAction(actionMinimize);
fileMenu->addAction(actionCloseWindow);
dockMenu = new QMenu(this);
dockMenu->setAsDockMenu();
dockMenu->addAction(tr("Open Messages"), this, SLOT(showMess()));
dockMenu->addAction(tr("Bandwidth Graph"), this, SLOT(showBandwidthGraph()));
dockMenu->addAction(tr("Statistics"), this, SLOT(showStatisticsWindow()));
dockMenu->addAction(tr("Options"), this, SLOT(showSettings()));
dockMenu->addAction(tr("Help"), this, SLOT(showHelpDialog()));
dockMenu->addSeparator();
QMenu *statusMenu = dockMenu->addMenu(tr("Status"));
initializeStatusObject(statusMenu, true);
}
#endif
#if defined(Q_OS_DARWIN)
void MainWindow::minimizeWindow()
{
setWindowState(windowState() | Qt::WindowMinimized);
}
#endif
#if defined(Q_OS_DARWIN)
void MainWindow::closeWindow()
{
// On macOS window close is basically equivalent to window hide.
close();
}
#endif
void MainWindow::showBandwidthGraph() void MainWindow::showBandwidthGraph()
{ {
if(_bandwidthGraph == NULL) if(_bandwidthGraph == NULL)
@ -1030,7 +946,6 @@ void SetForegroundWindowInternal(HWND hWnd)
/* Show the dialog. */ /* Show the dialog. */
raiseWindow(); raiseWindow();
/* Set the focus to the specified page. */ /* Set the focus to the specified page. */
_instance->ui->stackPages->setCurrentPage(page); _instance->ui->stackPages->setCurrentPage(page);
} }
@ -1263,91 +1178,10 @@ void MainWindow::doQuit()
rApp->quit(); rApp->quit();
} }
// This method parses arguments passed by the operating system. All arguments
// except -r, -f, -o and lists of rscollection files and rslinks are discarded.
//
void MainWindow::receiveNewArgs(QStringList args) void MainWindow::receiveNewArgs(QStringList args)
{ {
RsInfo() << "Received new arguments from operating system call."; Rshare::parseArguments(args, false);
processLastArgs();
std::string argstring = RsApplication::applicationFilePath().toStdString() ;
for(auto l:args)
argstring += " " + l.toStdString();
// This class does all the job at once: validate arguments, and parses them.
std::vector<std::string> links_and_files;
argstream as(argstring.c_str());
QString omValues = QString(";full;noturtle;gaming;minimal;");
std::string opModeStr;
std::string retroshare_link_url;
std::string rscollection_file;
as >> parameter('r',"rslink",retroshare_link_url,"Retroshare:// link","Retroshare link to open in Downloads " ,false)
>> parameter('f',"rsfile",rscollection_file,"file","File to open " ,false)
>> parameter('o',"opmode",opModeStr,"opmode","Set mode (Full, NoTurtle, Gaming, Minimal) " ,false)
>> values<std::string>(back_inserter(links_and_files),"links and files");
if(!as.isOk())
{
RsErr() << "Error while parsing arguments:" ;
RsErr() << as.errorLog() ;
return;
}
if(!opModeStr.empty() && omValues.contains(";"+QString::fromStdString(opModeStr).toLower()+";"))
{
QString opmode = QString::fromStdString(opModeStr).toLower();
//RsApplication::setOpMode(opModeStr.toLower()); // Do we need this??
RsInfo() << "Setting new operating mode to \"" << opmode.toStdString() << "\"";
if (opmode == "noturtle")
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::NOTURTLE) - 1);
else if (opmode == "gaming")
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::GAMING) - 1);
else if (opmode == "minimal")
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::MINIMAL) - 1);
else if (opmode != "")
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::FULL) - 1);
opModeStatus->setOpMode();
}
// Sort all collected arguments into rscollection files and retroshare links, accordingly
QStringList rscollection_files;
QList<RetroShareLink> rslinks;
auto sort = [&](const QString s) {
if(QFile(s).exists() && s.endsWith(".rscollection"))
rscollection_files.append(QString::fromUtf8(rscollection_file.c_str()));
else if(s.startsWith("retroshare://"))
{
RetroShareLink link(s);
if(link.valid())
rslinks.push_back(link);
}
};
sort(QString::fromUtf8(rscollection_file.c_str()));
sort(QString::fromUtf8(retroshare_link_url.c_str()));
for(auto s:links_and_files)
sort(QString::fromUtf8(s.c_str()));
// Now handle links and rscollection files.
for(auto file:rscollection_files)
if(file.endsWith(".rscollection"))
openRsCollection(file);
for(auto link:rslinks)
retroshareLinkActivated(link.toUrl());
} }
void MainWindow::displayErrorMessage(int /*a*/,int /*b*/,const QString& error_msg) void MainWindow::displayErrorMessage(int /*a*/,int /*b*/,const QString& error_msg)
@ -1386,11 +1220,7 @@ void MainWindow::updateMenu()
void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
{ {
#if defined(Q_OS_DARWIN)
if (e == QSystemTrayIcon::DoubleClick) {
#else
if (e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) { if (e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
#endif
if (isHidden() || isMinimized()) { if (isHidden() || isMinimized()) {
show(); show();
if (isMinimized()) { if (isMinimized()) {
@ -1714,9 +1544,45 @@ void MainWindow::retroshareLinkActivated(const QUrl &url)
void MainWindow::openRsCollection(const QString &filename) void MainWindow::openRsCollection(const QString &filename)
{ {
QFileInfo qinfo(filename); QFileInfo qinfo(filename);
if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
RsCollection collection;
collection.openColl(qinfo.absoluteFilePath());
}
}
}
void MainWindow::processLastArgs()
{
while (!Rshare::links()->isEmpty()) {
std::cerr << "MainWindow::processLastArgs() : " << Rshare::links()->count() << std::endl;
/* Now use links from the command line, because no RetroShare was running */
RetroShareLink link(Rshare::links()->takeFirst());
if (link.valid()) {
retroshareLinkActivated(link.toUrl());
}
}
while (!Rshare::files()->isEmpty()) {
/* Now use files from the command line, because no RetroShare was running */
openRsCollection(Rshare::files()->takeFirst());
}
/* Handle the -opmode options. */
if (opModeStatus) {
QString opmode = Rshare::opmode().toLower();
if (opmode == "noturtle") {
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::NOTURTLE) - 1);
} else if (opmode == "gaming") {
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::GAMING) - 1);
} else if (opmode == "minimal") {
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::MINIMAL) - 1);
} else if (opmode != "") {
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::FULL) - 1);
}
opModeStatus->setOpMode();
} else {
std::cerr << "ERR: MainWindow::processLastArgs opModeStatus is not initialized.";
}
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString))
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath());
} }
void MainWindow::switchVisibilityStatus(StatusElement e,bool b) void MainWindow::switchVisibilityStatus(StatusElement e,bool b)

View file

@ -27,7 +27,6 @@
#include "gui/common/rwindow.h" #include "gui/common/rwindow.h"
#include "gui/common/RSComboBox.h" #include "gui/common/RSComboBox.h"
#include "util/FontSizeHandler.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@ -215,6 +214,7 @@ public slots:
void externalLinkActivated(const QUrl &url); void externalLinkActivated(const QUrl &url);
void retroshareLinkActivated(const QUrl &url); void retroshareLinkActivated(const QUrl &url);
void openRsCollection(const QString &filename); void openRsCollection(const QString &filename);
void processLastArgs();
//! Go to a specific part of the control panel. //! Go to a specific part of the control panel.
void setNewPage(int page); void setNewPage(int page);
void setCompactStatusMode(bool compact); void setCompactStatusMode(bool compact);
@ -265,11 +265,6 @@ private slots:
void toggleVisibility(QSystemTrayIcon::ActivationReason e); void toggleVisibility(QSystemTrayIcon::ActivationReason e);
void toggleVisibilitycontextmenu(); void toggleVisibilitycontextmenu();
#if defined(Q_OS_DARWIN)
void minimizeWindow();
void closeWindow();
#endif
/** Toolbar fns. */ /** Toolbar fns. */
void addFriend(); void addFriend();
//void newRsCollection(); //void newRsCollection();
@ -313,10 +308,6 @@ private:
void initStackedPage(); void initStackedPage();
void addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage *, QPair<QAction *, QListWidgetItem *> > > *notify); void addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage *, QPair<QAction *, QListWidgetItem *> > > *notify);
void createTrayIcon(); void createTrayIcon();
#if defined(Q_OS_DARWIN)
/** Creates a default menubar on Mac */
void createMenuBar();
#endif
void createNotifyIcons(); void createNotifyIcons();
static MainWindow *_instance; static MainWindow *_instance;
@ -333,14 +324,6 @@ private:
QString nameAndLocation; QString nameAndLocation;
#if defined(Q_OS_DARWIN)
/** The menubar (Mac OS X only). */
QMenuBar *menuBar;
QMenu *dockMenu;
QAction* actionMinimize;
QAction* actionCloseWindow;
#endif
QSystemTrayIcon *trayIcon; QSystemTrayIcon *trayIcon;
QMenu *notifyMenu; QMenu *notifyMenu;
QMenu *trayMenu; QMenu *trayMenu;
@ -372,8 +355,6 @@ private:
void setIdle(bool Idle); void setIdle(bool Idle);
bool isIdle; bool isIdle;
FontSizeHandler mFontSizeHandler;
Ui::MainWindow *ui ; Ui::MainWindow *ui ;
}; };

View file

@ -33,6 +33,11 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
@ -152,7 +157,7 @@
</action> </action>
<action name="actionOptions"> <action name="actionOptions">
<property name="icon"> <property name="icon">
<iconset> <iconset resource="images.qrc">
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset> <normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
</property> </property>
<property name="text"> <property name="text">

View file

@ -39,7 +39,7 @@ public slots:
protected: protected:
/** Default Constructor */ /** Default Constructor */
MessengerWindow(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()); MessengerWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
/** Default Destructor */ /** Default Destructor */
~MessengerWindow(); ~MessengerWindow();

View file

@ -42,7 +42,7 @@
#include "connect/PGPKeyDialog.h" #include "connect/PGPKeyDialog.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include <time.h> #include <time.h>
@ -83,7 +83,7 @@ NetworkDialog::NetworkDialog(QWidget */*parent*/)
ui.connectTreeWidget->setUpdatesEnabled(true); ui.connectTreeWidget->setUpdatesEnabled(true);
ui.connectTreeWidget->setSortingEnabled(true); ui.connectTreeWidget->setSortingEnabled(true);
ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui.connectTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); ui.connectTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) ); connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails())); connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails()));
@ -117,12 +117,24 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
{ {
return; return;
} }
QMenu *contextMnu = new QMenu; 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->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails()));
contextMnu->addSeparator() ; contextMnu->addSeparator() ;
contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys())); contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys()));
contextMnu->addAction(QIcon(), tr("Remove this key"), this, SLOT(removeSelectedKeys())); contextMnu->addAction(QIcon(), tr("Remove this key"), this, SLOT(removeSelectedKeys()));
contextMnu->exec(QCursor::pos()); contextMnu->exec(QCursor::pos());
} }
@ -165,34 +177,11 @@ void NetworkDialog::removeSelectedKeys()
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes(); QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
if(l.empty()) if(l.empty())
return; return;
std::set<RsPgpId> selected; 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()));
std::set<RsPgpId> friends; removeKeys(selected);
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) void NetworkDialog::removeKeys(std::set<RsPgpId> selected)

View file

@ -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)); addFeedItem(new GxsChannelPostItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId, false, true));
break; break;
case RsChannelEventCode::NEW_COMMENT: case RsChannelEventCode::NEW_COMMENT:
addFeedItem(new ChannelsCommentsItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId,pe->mChannelThreadId, false, true)); addFeedItem(new ChannelsCommentsItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId, false, true));
break; break;
case RsChannelEventCode::RECEIVED_PUBLISH_KEY: case RsChannelEventCode::RECEIVED_PUBLISH_KEY:
addFeedItem(new GxsChannelGroupItem(this, NEWSFEED_CHANNELPUBKEYLIST, pe->mChannelGroupId, false, true)); addFeedItem(new GxsChannelGroupItem(this, NEWSFEED_CHANNELPUBKEYLIST, pe->mChannelGroupId, false, true));

View file

@ -70,8 +70,8 @@
<widget class="QLabel" name="titleBarLabel"> <widget class="QLabel" name="titleBarLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>

View file

@ -41,7 +41,7 @@
PluginManager::PluginManager() PluginManager::PluginManager()
{ {
baseFolder = //qApp->applicationDirPath()+"///plugins" ; baseFolder = //qApp->applicationDirPath()+"///plugins" ;
RsApplication::dataDirectory() + "/plugins" ; Rshare::dataDirectory() + "/plugins" ;
lastError = "No error."; lastError = "No error.";
viewWidget = 0; viewWidget = 0;

View file

@ -22,6 +22,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>MS Sans Serif</family> <family>MS Sans Serif</family>
<pointsize>11</pointsize>
<weight>75</weight> <weight>75</weight>
<italic>true</italic> <italic>true</italic>
<bold>true</bold> <bold>true</bold>
@ -102,6 +103,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>MS Sans Serif</family> <family>MS Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
@ -112,7 +114,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AvatarWidget" name="avatarWidget"> <widget class="AvatarWidget" name="avatarWidget" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
@ -132,6 +134,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>MS Sans Serif</family> <family>MS Sans Serif</family>
<pointsize>11</pointsize>
<weight>75</weight> <weight>75</weight>
<italic>true</italic> <italic>true</italic>
<bold>true</bold> <bold>true</bold>
@ -147,6 +150,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>MS Sans Serif</family> <family>MS Sans Serif</family>
<pointsize>9</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
@ -159,6 +163,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>MS Sans Serif</family> <family>MS Sans Serif</family>
<pointsize>9</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
@ -204,17 +209,17 @@
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>AvatarWidget</class>
<extends>QLabel</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>GxsIdLabel</class> <class>GxsIdLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header> <header>gui/gxs/GxsIdLabel.h</header>
</customwidget> </customwidget>
<customwidget>
<class>AvatarWidget</class>
<extends>QWidget</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>AspectRatioPixmapLabel</class> <class>AspectRatioPixmapLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>

View file

@ -44,10 +44,10 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout" name="feedFrame_GL"> <layout class="QGridLayout" name="feedFrame_GL">
<property name="leftMargin"> <property name="leftMargin">
@ -262,6 +262,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>11</pointsize>
<weight>75</weight> <weight>75</weight>
<italic>true</italic> <italic>true</italic>
<bold>true</bold> <bold>true</bold>

View file

@ -45,7 +45,6 @@
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "util/RsQtVersion.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
@ -418,7 +417,7 @@ void PostedListWidgetWithModel::updateShowLabel()
void PostedListWidgetWithModel::filterItems(QString text) void PostedListWidgetWithModel::filterItems(QString text)
{ {
QStringList lst = text.split(" ",QtSkipEmptyParts) ; QStringList lst = text.split(" ",QString::SkipEmptyParts) ;
uint32_t count; uint32_t count;
mPostedPostsModel->setFilter(lst,count) ; mPostedPostsModel->setFilter(lst,count) ;
@ -620,13 +619,12 @@ void PostedListWidgetWithModel::updateGroupData()
void PostedListWidgetWithModel::postPostLoad() void PostedListWidgetWithModel::postPostLoad()
{ {
#ifdef DEBUG_POSTED
std::cerr << "Post channel load..." << std::endl; std::cerr << "Post channel load..." << std::endl;
#endif
whileBlocking(ui->filter_LE)->setText(QString()); //Clear it before navigate, as it will update it. whileBlocking(ui->filter_LE)->setText(QString()); //Clear it before navigate, as it will update it.
if (!mNavigatePendingMsgId.isNull()) if (!mNavigatePendingMsgId.isNull())
navigate(mNavigatePendingMsgId); navigate(mNavigatePendingMsgId);
#ifdef TO_REMOVE #ifdef TO_REMOVE
else if( (mLastSelectedPosts.count(groupId()) > 0) else if( (mLastSelectedPosts.count(groupId()) > 0)
&& !mLastSelectedPosts[groupId()].isNull()) && !mLastSelectedPosts[groupId()].isNull())
@ -641,10 +639,8 @@ void PostedListWidgetWithModel::postPostLoad()
ui->postsTree->setFocus(); ui->postsTree->setFocus();
} }
#endif #endif
#ifdef DEBUG_POSTED
else else
std::cerr << "No pre-selected channel post." << std::endl; std::cerr << "No pre-selected channel post." << std::endl;
#endif
updateShowLabel(); updateShowLabel();
} }
@ -1023,7 +1019,7 @@ void PostedListWidget::createPostItemFromMetaData(const RsGxsMsgMetaData& meta,b
post.mOlderVersions.insert(post.mMeta.mMsgId); post.mOlderVersions.insert(post.mMeta.mMsgId);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions); GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, DateTime::DateTimeFromTime_t(post.mMeta.mPublishTs)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
return ; return ;
} }
@ -1037,12 +1033,12 @@ void PostedListWidget::createPostItemFromMetaData(const RsGxsMsgMetaData& meta,b
if (item) if (item)
{ {
item->setPost(post); item->setPost(post);
ui->feedWidget->setSort(item, ROLE_PUBLISH, DateTime::DateTimeFromTime_t(meta.mPublishTs)); ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
} }
else else
{ {
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true); GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, DateTime::DateTimeFromTime_t(post.mMeta.mPublishTs)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
} }
#ifdef TODO #ifdef TODO
ui->fileWidget->addFiles(post, related); ui->fileWidget->addFiles(post, related);
@ -1068,7 +1064,7 @@ void PostedListWidget::createPostItem(const RsGxsChannelPost& post, bool related
older_versions.insert(meta.mMsgId); older_versions.insert(meta.mMsgId);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, false,older_versions); GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, false,older_versions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, DateTime::DateTimeFromTime_t(meta.mPublishTs)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
return ; return ;
} }
@ -1082,12 +1078,12 @@ void PostedListWidget::createPostItem(const RsGxsChannelPost& post, bool related
if (item) if (item)
{ {
item->setPost(post); item->setPost(post);
ui->feedWidget->setSort(item, ROLE_PUBLISH, DateTime::DateTimeFromTime_t(meta.mPublishTs)); ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
} }
else else
{ {
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, true); GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, true);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, DateTime::DateTimeFromTime_t(meta.mPublishTs)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
} }
ui->fileWidget->addFiles(post, related); ui->fileWidget->addFiles(post, related);

View file

@ -54,7 +54,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
@ -355,10 +355,10 @@ p, li { white-space: pre-wrap; }
<item> <item>
<widget class="QFrame" name="toolBarFrame"> <widget class="QFrame" name="toolBarFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin"> <property name="leftMargin">
@ -576,10 +576,37 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>LineEditClear</class> <class>LineEditClear</class>
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header> <header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>RSTabWidget</class>
<extends>QTabWidget</extends>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>RSTreeView</class> <class>RSTreeView</class>
@ -587,42 +614,15 @@ p, li { white-space: pre-wrap; }
<header>gui/common/RSTreeView.h</header> <header>gui/common/RSTreeView.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>SubscribeToolButton</class> <class>SubscribeToolButton</class>
<extends>QToolButton</extends> <extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header> <header>gui/common/SubscribeToolButton.h</header>
</customwidget> </customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>RSTabWidget</class>
<extends>QTabWidget</extends>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/>
<include location="Posted_images.qrc"/> <include location="Posted_images.qrc"/>
<include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

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

View file

@ -88,16 +88,11 @@ class RSHumanReadableAgeDelegate: public RSHumanReadableDelegate
public: public:
virtual void paint(QPainter *painter,const QStyleOptionViewItem & option, const QModelIndex & index) const virtual void paint(QPainter *painter,const QStyleOptionViewItem & option, const QModelIndex & index) const
{ {
painter->save();
QStyleOptionViewItem opt(option) ; QStyleOptionViewItem opt(option) ;
setPainterOptions(painter,opt,index) ; setPainterOptions(painter,opt,index) ;
if(index.data().toLongLong() > 0) { // no date is present. if(index.data().toLongLong() > 0) // no date is present.
painter->setFont(opt.font); painter->drawText(opt.rect, Qt::AlignCenter, misc::timeRelativeToNow(index.data().toLongLong())) ;
painter->drawText(opt.rect, opt.displayAlignment, misc::timeRelativeToNow(index.data().toLongLong())) ;
}
painter->restore();
} }
}; };
@ -106,14 +101,10 @@ class RSHumanReadableSizeDelegate: public RSHumanReadableDelegate
public: public:
virtual void paint(QPainter *painter,const QStyleOptionViewItem & option, const QModelIndex & index) const virtual void paint(QPainter *painter,const QStyleOptionViewItem & option, const QModelIndex & index) const
{ {
painter->save();
QStyleOptionViewItem opt(option) ; QStyleOptionViewItem opt(option) ;
setPainterOptions(painter,opt,index) ; setPainterOptions(painter,opt,index) ;
painter->setFont(opt.font); painter->drawText(opt.rect, Qt::AlignRight, misc::friendlyUnit(index.data().toULongLong()));
painter->drawText(opt.rect, opt.displayAlignment, misc::friendlyUnit(index.data().toULongLong()));
painter->restore();
} }
}; };

View file

@ -24,7 +24,7 @@
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/common/GroupDefs.h" #include "gui/common/GroupDefs.h"
#include "gui/common/RsCollectionDialog.h" #include "gui/common/RsCollection.h"
#include "gui/common/RsUrlHandler.h" #include "gui/common/RsUrlHandler.h"
#include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdDetails.h"
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
@ -1233,6 +1233,31 @@ bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d)
return false ; return false ;
} }
void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndexList &list)
{
/* if(RemoteMode)
{
std::cerr << "Cannot create a collection file from remote" << std::endl;
return ;
}*/
std::vector <DirDetails> dirVec;
getDirDetailsFromSelect(list, dirVec);
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
QString dir_name;
if(!RemoteMode)
{
if(!dirVec.empty())
{
const DirDetails& details = dirVec[0];
dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
}
}
RsCollection(dirVec,f).openNewColl(parent,dir_name);
}
void RetroshareDirModel::downloadSelected(const QModelIndexList &list,bool interactive) void RetroshareDirModel::downloadSelected(const QModelIndexList &list,bool interactive)
{ {
if (!RemoteMode) if (!RemoteMode)
@ -1253,7 +1278,7 @@ void RetroshareDirModel::downloadSelected(const QModelIndexList &list,bool inter
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ; FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
if(interactive) if(interactive)
RsCollectionDialog::downloadFiles(RsCollection(dirVec,f)) ; RsCollection(dirVec,f).downloadFiles() ;
else /* Fire off requests */ else /* Fire off requests */
for (int i = 0, n = dirVec.size(); i < n; ++i) for (int i = 0, n = dirVec.size(); i < n; ++i)
{ {

View file

@ -68,6 +68,8 @@ class RetroshareDirModel : public QAbstractItemModel
/* Callback from GUI */ /* Callback from GUI */
void downloadSelected(const QModelIndexList &list, bool interactive); void downloadSelected(const QModelIndexList &list, bool interactive);
void createCollectionFile(QWidget *parent, const QModelIndexList &list);
void getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec); void getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec);
int getType ( const QModelIndex & index ) const ; int getType ( const QModelIndex & index ) const ;

View file

@ -25,7 +25,7 @@
#include "HomePage.h" #include "HomePage.h"
#include "chat/ChatDialog.h" #include "chat/ChatDialog.h"
#include "common/PeerDefs.h" #include "common/PeerDefs.h"
#include "common/RsCollectionDialog.h" #include "common/RsCollection.h"
#include "common/RsUrlHandler.h" #include "common/RsUrlHandler.h"
#include "connect/ConfCertDialog.h" #include "connect/ConfCertDialog.h"
#include "connect/ConnectFriendWizard.h" #include "connect/ConnectFriendWizard.h"
@ -1143,13 +1143,11 @@ QString RetroShareLink::toHtmlSize() const
if (type() == TYPE_FILE && RsCollection::isCollectionFile(name())) { if (type() == TYPE_FILE && RsCollection::isCollectionFile(name())) {
FileInfo finfo; FileInfo finfo;
if (rsFiles->FileDetails(RsFileHash(hash().toStdString()), RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, finfo)) if (rsFiles->FileDetails(RsFileHash(hash().toStdString()), RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, finfo)) {
{ RsCollection collection;
RsCollection::RsCollectionErrorCode code; if (collection.load(QString::fromUtf8(finfo.path.c_str()), false)) {
RsCollection collection(QString::fromUtf8(finfo.path.c_str()), code) ;
if(code == RsCollection::RsCollectionErrorCode::COLLECTION_NO_ERROR)
size += QString(" [%1]").arg(misc::friendlyUnit(collection.size())); size += QString(" [%1]").arg(misc::friendlyUnit(collection.size()));
}
} }
} }
QString link = QString("<a href=\"%1\">%2</a> <font color=\"blue\">%3</font>").arg(toString()).arg(name()).arg(size); QString link = QString("<a href=\"%1\">%2</a> <font color=\"blue\">%3</font>").arg(toString()).arg(name()).arg(size);
@ -1724,9 +1722,10 @@ static void processList(const QStringList &list, const QString &textSingular, co
case TYPE_FILE_TREE: case TYPE_FILE_TREE:
{ {
auto ft = RsFileTree::fromRadix64(link.radix().toStdString() ); auto ft = RsFileTree::fromRadix64(
RsCollectionDialog::downloadFiles(RsCollection(*ft)); link.radix().toStdString() );
break; RsCollection(*ft).downloadFiles();
break;
} }
case TYPE_CHAT_ROOM: case TYPE_CHAT_ROOM:
@ -1777,7 +1776,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
// were single file links found? // were single file links found?
if (fileLinkFound) if (fileLinkFound)
RsCollectionDialog::downloadFiles(col); col.downloadFiles();
int countProcessed = 0; int countProcessed = 0;
int countError = 0; int countError = 0;
@ -1920,9 +1919,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links) void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links)
{ {
QString res ; QString res ;
if(links.size() == 1) for (int i = 0; i < links.size(); ++i)
res += links[0].toString();
else for(int i = 0; i < links.size(); ++i)
res += links[i].toString() + "\n" ; res += links[i].toString() + "\n" ;
QApplication::clipboard()->setText(res) ; QApplication::clipboard()->setText(res) ;
@ -2038,3 +2035,4 @@ void RSLinkClipboard::parseText(QString text, QList<RetroShareLink> &links,Retro
pos += rx.matchedLength(); pos += rx.matchedLength();
} }
} }

View file

@ -36,7 +36,7 @@
#include "gui/common/GroupSelectionBox.h" #include "gui/common/GroupSelectionBox.h"
#include "gui/common/GroupDefs.h" #include "gui/common/GroupDefs.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "util/RsQtVersion.h" #include "util/QtVersion.h"
#include "util/misc.h" #include "util/misc.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"

View file

@ -29,6 +29,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopWidget>
#include <iostream> #include <iostream>
@ -48,7 +49,7 @@ StartDialog::StartDialog(QWidget *parent)
Settings->loadWidgetInformation(this); Settings->loadWidgetInformation(this);
/* Put the Login dialog in the screen center */ /* Put the Login dialog in the screen center */
const QRect screen = RsApplication::primaryScreenGeometry(); const QRect screen = QApplication::desktop()->screenGeometry();
this->move( screen.center() - this->rect().center() ); this->move( screen.center() - this->rect().center() );
/* get all available pgp private certificates.... /* get all available pgp private certificates....
@ -122,7 +123,7 @@ void StartDialog::loadPerson()
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ; rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
rsNotify->setDisableAskPassword(true); rsNotify->setDisableAskPassword(true);
bool res = RsApplication::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ; bool res = Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
rsNotify->setDisableAskPassword(false); rsNotify->setDisableAskPassword(false);
rsNotify->clearPgpPassphrase(); rsNotify->clearPgpPassphrase();
@ -160,7 +161,7 @@ void StartDialog::notSecureWarning()
QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your Keychain. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok); QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your Keychain. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#else #else
// this handles all linux systems at once. // this handles all linux systems at once.
QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your desktop's keyring. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok); QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your Gnome Keyring. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#endif #endif
#endif #endif
} }

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