mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-24 03:58:49 +03:00
Update to SingleApplication 3.3.2 proper
This commit is contained in:
parent
cce5d0534f
commit
57d1dffdbd
31 changed files with 112 additions and 62 deletions
|
@ -509,7 +509,7 @@ endif()
|
||||||
|
|
||||||
# single instance functionality
|
# single instance functionality
|
||||||
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
||||||
add_subdirectory(third_party/SingleApplication-3.3.0/)
|
add_subdirectory(third_party/SingleApplication-3.3.2/)
|
||||||
|
|
||||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||||
|
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
name: "CI: Build Test"
|
|
||||||
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
qt_version: [5.12.6, 5.13.2, 5.14.0, 5.15.0, 6.0.0]
|
|
||||||
platform: [ubuntu-20.04, windows-latest, macos-latest]
|
|
||||||
include:
|
|
||||||
- qt_version: 6.0.0
|
|
||||||
additional_arguments: -D QT_DEFAULT_MAJOR_VERSION=6
|
|
||||||
- platform: ubuntu-20.04
|
|
||||||
CXXFLAGS: -Wall -Wextra -pedantic -Werror
|
|
||||||
- platform: macos-latest
|
|
||||||
CXXFLAGS: -Wall -Wextra -pedantic -Werror
|
|
||||||
- platform: windows-latest
|
|
||||||
CXXFLAGS: /W4 /WX
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform }}
|
|
||||||
env:
|
|
||||||
CXXFLAGS: ${{ matrix.CXXFLAGS }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2.3.4
|
|
||||||
|
|
||||||
- name: Install Qt
|
|
||||||
uses: jurplel/install-qt-action@v2.11.1
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.qt_version }}
|
|
||||||
|
|
||||||
- name: cmake
|
|
||||||
run: cmake . ${{ matrix.additional_arguments }}
|
|
||||||
|
|
||||||
- name: cmake build
|
|
||||||
run: cmake --build .
|
|
||||||
|
|
||||||
- name: Build example - basic (cmake)
|
|
||||||
working-directory: examples/basic/
|
|
||||||
run: |
|
|
||||||
cmake . ${{ matrix.additional_arguments }}
|
|
||||||
cmake --build .
|
|
||||||
|
|
||||||
- name: Build example - calculator (cmake)
|
|
||||||
working-directory: examples/calculator/
|
|
||||||
run: |
|
|
||||||
cmake . ${{ matrix.additional_arguments }}
|
|
||||||
cmake --build .
|
|
||||||
|
|
||||||
- name: Build example - sending_arguments (cmake)
|
|
||||||
working-directory: examples/sending_arguments/
|
|
||||||
run: |
|
|
||||||
cmake . ${{ matrix.additional_arguments }}
|
|
||||||
cmake --build .
|
|
87
third_party/SingleApplication-3.3.2/.github/workflows/build.yml
vendored
Normal file
87
third_party/SingleApplication-3.3.2/.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
name: "CI: Build Test"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- "releases/**"
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
qt_version: [5.12.6, 5.13.2, 5.14.0, 5.15.0, 6.0.0]
|
||||||
|
platform: [ubuntu-20.04, windows-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- qt_version: 6.0.0
|
||||||
|
additional_arguments: -D QT_DEFAULT_MAJOR_VERSION=6
|
||||||
|
- platform: ubuntu-20.04
|
||||||
|
make: make
|
||||||
|
CXXFLAGS: -Wall -Wextra -pedantic -Werror
|
||||||
|
MAKEFLAGS: -j2
|
||||||
|
- platform: macos-latest
|
||||||
|
make: make
|
||||||
|
CXXFLAGS: -Wall -Wextra -pedantic -Werror
|
||||||
|
MAKEFLAGS: -j3
|
||||||
|
- platform: windows-latest
|
||||||
|
make: nmake
|
||||||
|
CXXFLAGS: /W4 /WX /MP
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
env:
|
||||||
|
CXXFLAGS: ${{ matrix.CXXFLAGS }}
|
||||||
|
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2.14.0
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.qt_version }}
|
||||||
|
|
||||||
|
- name: Build library with CMake
|
||||||
|
run: |
|
||||||
|
cmake . ${{ matrix.additional_arguments }}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Build basic example with CMake
|
||||||
|
working-directory: examples/basic/
|
||||||
|
run: |
|
||||||
|
cmake . ${{ matrix.additional_arguments }}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Build calculator example CMake
|
||||||
|
working-directory: examples/calculator/
|
||||||
|
run: |
|
||||||
|
cmake . ${{ matrix.additional_arguments }}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Build sending_arguments example with CMake
|
||||||
|
working-directory: examples/sending_arguments/
|
||||||
|
run: |
|
||||||
|
cmake . ${{ matrix.additional_arguments }}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Setup MSVC environment for QMake
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
|
- name: Build basic example with QMake
|
||||||
|
working-directory: examples/basic/
|
||||||
|
run: |
|
||||||
|
qmake
|
||||||
|
${{ matrix.make }}
|
||||||
|
|
||||||
|
- name: Build calculator example QMake
|
||||||
|
working-directory: examples/calculator/
|
||||||
|
run: |
|
||||||
|
qmake
|
||||||
|
${{ matrix.make }}
|
||||||
|
|
||||||
|
- name: Build sending_arguments example with QMake
|
||||||
|
working-directory: examples/sending_arguments/
|
||||||
|
run: |
|
||||||
|
qmake
|
||||||
|
${{ matrix.make }}
|
|
@ -3,11 +3,20 @@ Changelog
|
||||||
|
|
||||||
If by accident I have forgotten to credit someone in the CHANGELOG, email me and I will fix it.
|
If by accident I have forgotten to credit someone in the CHANGELOG, email me and I will fix it.
|
||||||
|
|
||||||
|
__3.3.2__
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fixed crash caused by sending a `writeAck` on a removed connection. - _Nicolas Werner_
|
||||||
|
|
||||||
|
__3.3.1__
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Added support for _AppImage_ dynamic executable paths. - _Michael Klein_
|
||||||
|
|
||||||
__3.3.0__
|
__3.3.0__
|
||||||
---------
|
---------
|
||||||
|
|
||||||
* Fixed message fragmentation issue causing crashes and incorrectly and inconsistently received messages. - _Nils Jeisecke_
|
* Fixed message fragmentation issue causing crashes and incorrectly / inconsistently received messages. - _Nils Jeisecke_
|
||||||
|
|
||||||
__3.2.0__
|
__3.2.0__
|
||||||
---------
|
---------
|
|
@ -182,7 +182,8 @@ bool SingleApplication::sendMessage( QByteArray message, int timeout = 100 )
|
||||||
```
|
```
|
||||||
|
|
||||||
Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout
|
Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout
|
||||||
in milliseconds for blocking functions
|
in milliseconds for blocking functions. Returns `true` if the message has been sent
|
||||||
|
successfully. If the message can't be sent or the function timeouts - returns `false`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -144,8 +144,17 @@ void SingleApplicationPrivate::genBlockServerName()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! (options & SingleApplication::Mode::ExcludeAppPath) ){
|
if( ! (options & SingleApplication::Mode::ExcludeAppPath) ){
|
||||||
#ifdef Q_OS_WIN
|
#if defined(Q_OS_WIN)
|
||||||
appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() );
|
appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() );
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
// If the application is running as an AppImage then the APPIMAGE env var should be used
|
||||||
|
// instead of applicationPath() as each instance is launched with its own executable path
|
||||||
|
const QByteArray appImagePath = qgetenv( "APPIMAGE" );
|
||||||
|
if( appImagePath.isEmpty() ){ // Not running as AppImage: use path to executable file
|
||||||
|
appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() );
|
||||||
|
} else { // Running as AppImage: Use absolute path to AppImage file
|
||||||
|
appData.addData( appImagePath );
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() );
|
appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() );
|
||||||
#endif
|
#endif
|
||||||
|
@ -494,14 +503,14 @@ void SingleApplicationPrivate::slotDataAvailable( QLocalSocket *dataSocket, quin
|
||||||
if ( !isFrameComplete( dataSocket ) )
|
if ( !isFrameComplete( dataSocket ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto message = dataSocket->readAll();
|
const QByteArray message = dataSocket->readAll();
|
||||||
|
|
||||||
writeAck( dataSocket );
|
writeAck( dataSocket );
|
||||||
|
|
||||||
ConnectionInfo &info = connectionMap[dataSocket];
|
ConnectionInfo &info = connectionMap[dataSocket];
|
||||||
info.stage = StageConnectedHeader;
|
info.stage = StageConnectedHeader;
|
||||||
|
|
||||||
Q_EMIT q->receivedMessage(instanceId, message);
|
Q_EMIT q->receivedMessage( instanceId, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId )
|
void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId )
|
Loading…
Reference in a new issue