commit
04c85c2bb7
@ -144,41 +144,33 @@ commands:
|
||||
name: Install Dependencies
|
||||
command: >
|
||||
apt-get update && apt-get install -y
|
||||
build-essential
|
||||
cmake
|
||||
fakeroot
|
||||
gettext
|
||||
git
|
||||
libasound2-dev
|
||||
libboost-dev
|
||||
libboost-serialization-dev
|
||||
libcdio-cdda2
|
||||
libcdio-dev
|
||||
libchromaprint-dev
|
||||
libcrypto++-dev
|
||||
libdbus-1-dev
|
||||
libfftw3-dev
|
||||
libglew1.5-dev
|
||||
libglib2.0-dev
|
||||
libgpod-dev
|
||||
libgstreamer-plugins-base1.0-dev
|
||||
libgstreamer1.0-dev
|
||||
liblastfm-dev
|
||||
libmtp-dev
|
||||
libmygpo-qt-dev
|
||||
libplist-dev
|
||||
libprotobuf-dev
|
||||
libpulse-dev
|
||||
libqca2-dev
|
||||
libqca2-plugins
|
||||
libqjson-dev
|
||||
libqt4-dev
|
||||
libqt4-opengl-dev
|
||||
libqtwebkit-dev
|
||||
libsparsehash-dev
|
||||
libqt5x11extras5-dev
|
||||
libsqlite3-dev
|
||||
libtag1-dev
|
||||
libusbmuxd-dev
|
||||
pkg-config
|
||||
protobuf-compiler
|
||||
qt4-dev-tools
|
||||
qtbase5-dev
|
||||
qttools5-dev-tools
|
||||
qttools5-dev
|
||||
libsparsehash-dev
|
||||
ssh
|
||||
install_disco_dependencies:
|
||||
description: Install Disco dependencies
|
||||
@ -450,11 +442,11 @@ jobs:
|
||||
- run:
|
||||
name: Setup PATH
|
||||
command: |
|
||||
echo 'export Qt5_DIR=/usr/local/opt/qt5/lib/cmake' >> $BASH_ENV
|
||||
echo 'export Qt5LinguistTools_DIR=/usr/local/Cellar/qt/5.11.2/lib/cmake/Qt5LinguistTools' >> $BASH_ENV
|
||||
echo 'export GST_SCANNER_PATH=/usr/local/Cellar/gstreamer/1.14.4/libexec/gstreamer-1.0/gst-plugin-scanner' >> $BASH_ENV
|
||||
echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig' >> $BASH_ENV
|
||||
echo 'export Qt5_DIR=/usr/local/Cellar/qt/5.13.1/lib/cmake/Qt5' >> $BASH_ENV
|
||||
echo 'export Qt5LinguistTools_DIR=/usr/local/Cellar/qt/5.13.1/lib/cmake/Qt5LinguistTools' >> $BASH_ENV
|
||||
echo 'export GST_SCANNER_PATH=/usr/local/Cellar/gstreamer/1.16.1/libexec/gstreamer-1.0/gst-plugin-scanner' >> $BASH_ENV
|
||||
echo 'export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0' >> $BASH_ENV
|
||||
echo 'export PATH=/usr/local/opt/gettext/bin:$PATH' >> $BASH_ENV
|
||||
source $BASH_ENV
|
||||
- run:
|
||||
name: Install dependencies from homebrew
|
||||
@ -464,39 +456,38 @@ jobs:
|
||||
chromaprint
|
||||
cmake
|
||||
cryptopp
|
||||
fftw
|
||||
gettext
|
||||
glew
|
||||
glib
|
||||
liblastfm
|
||||
google-sparsehash
|
||||
gst-libav
|
||||
gst-plugins-bad
|
||||
gst-plugins-base
|
||||
gst-plugins-good
|
||||
gst-plugins-ugly
|
||||
gstreamer
|
||||
pkgconfig
|
||||
protobuf
|
||||
protobuf-c
|
||||
qt
|
||||
- run:
|
||||
name: Install sqlite
|
||||
command: brew install sqlite --with-fts
|
||||
- run:
|
||||
name: Install gstreamer
|
||||
command: brew install gstreamer gst-plugins-base
|
||||
- run:
|
||||
name: Install gst-plugins-good
|
||||
command: brew install gst-plugins-good --with-flac
|
||||
- run:
|
||||
name: Install gst-plugins
|
||||
command: brew install gst-plugins-bad gst-plugins-ugly
|
||||
- run:
|
||||
name: Install other dependencies
|
||||
command: brew install chromaprint liblastfm
|
||||
sqlite
|
||||
- checkout
|
||||
- run:
|
||||
name: Checkout qt5 branch
|
||||
command: git checkout qt5
|
||||
- run:
|
||||
name: cmake
|
||||
command: cmake .. -DUSE_VISUALISATIONS=OFF
|
||||
command: >
|
||||
cmake
|
||||
..
|
||||
-Wno-dev
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||
-DGETTEXT_MSGMERGE_EXECUTABLE=/usr/local/Cellar/gettext/0.20.1/bin/msgmerge
|
||||
-DGETTEXT_MSGFMT_EXECUTABLE=/usr/local/Cellar/gettext/0.20.1/bin/msgfmt
|
||||
-DGETTEXT_XGETTEXT_EXECUTABLE=/usr/local/Cellar/gettext/0.20.1/bin/xgettext
|
||||
working_directory: bin
|
||||
- run:
|
||||
name: make
|
||||
command: make
|
||||
command: make -j2
|
||||
working_directory: bin
|
||||
- run:
|
||||
name: Copy icon file and resources
|
||||
@ -516,6 +507,10 @@ jobs:
|
||||
root: /tmp/artifacts
|
||||
paths:
|
||||
- mac/*
|
||||
- store_artifacts:
|
||||
path: bin/CMakeCache.txt
|
||||
- store_artifacts:
|
||||
path: bin/src/CMakeFiles/clementine.dir
|
||||
- store_artifacts:
|
||||
path: /tmp/artifacts/mac
|
||||
|
||||
@ -538,30 +533,13 @@ workflows:
|
||||
version: 2
|
||||
build_all:
|
||||
jobs:
|
||||
- build_xenial_32
|
||||
- build_xenial_64
|
||||
- build_bionic_32
|
||||
- build_bionic_64
|
||||
- build_disco_32
|
||||
- build_disco_64
|
||||
- build_fedora_29_64
|
||||
- build_fedora_30_64
|
||||
- build_buster_64
|
||||
- build_stretch_64
|
||||
|
||||
- build_mac
|
||||
- upload_artifacts:
|
||||
context: gcp
|
||||
requires:
|
||||
- build_xenial_32
|
||||
- build_xenial_64
|
||||
- build_bionic_32
|
||||
- build_bionic_64
|
||||
- build_disco_32
|
||||
- build_disco_64
|
||||
- build_fedora_29_64
|
||||
- build_fedora_30_64
|
||||
- build_buster_64
|
||||
- build_stretch_64
|
||||
- build_mac
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
only: qt5
|
||||
|
3
3rdparty/libmygpo-qt5/AUTHORS
vendored
Normal file
3
3rdparty/libmygpo-qt5/AUTHORS
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
Stefan Derkits <stefan@derkits.at>
|
||||
Christian Wagner <christian.wagner86@gmx.at>
|
||||
Felix Winter <ixos01@gmail.com>
|
50
3rdparty/libmygpo-qt5/CMakeLists.txt
vendored
Normal file
50
3rdparty/libmygpo-qt5/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
cmake_minimum_required( VERSION 2.8.11 FATAL_ERROR )
|
||||
|
||||
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII" )
|
||||
|
||||
set(MYGPO_QT_VERSION_SUFFIX 5)
|
||||
|
||||
macro(qt_wrap_cpp)
|
||||
qt5_wrap_cpp(${ARGN})
|
||||
endmacro()
|
||||
|
||||
# pkg-config names of QtCore and QtNetwork are Qt5Core and Qt5Network for
|
||||
# Qt5
|
||||
set(MYGPO_QT_MAJOR_VERSION "5")
|
||||
set(MYGPO_QT4_QJSON_DEP "")
|
||||
|
||||
# Don't use absolute path in Mygpo-qtTargets-$buildType.cmake
|
||||
# (This will have no effect with CMake < 2.8)
|
||||
# set(QT_USE_IMPORTED_TARGETS TRUE)
|
||||
|
||||
set( MYGPO_QT_VERSION_MAJOR "1" )
|
||||
set( MYGPO_QT_VERSION_MINOR "0" )
|
||||
set( MYGPO_QT_VERSION_PATCH "8" )
|
||||
set( MYGPO_QT_VERSION "${MYGPO_QT_VERSION_MAJOR}.${MYGPO_QT_VERSION_MINOR}.${MYGPO_QT_VERSION_PATCH}" )
|
||||
|
||||
#Configure Version.h.in with the actual version number
|
||||
configure_file( src/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Version.h )
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
ADD_DEFINITIONS( -Wcast-align -Wchar-subscripts -Wpointer-arith
|
||||
-Wwrite-strings -Wpacked -Wformat-security -Wmissing-format-attribute
|
||||
-Wold-style-cast -Woverloaded-virtual -Wnon-virtual-dtor -Wall -Wextra
|
||||
-Wformat=2 -Wundef -Wstack-protector -Wmissing-include-dirs
|
||||
-Winit-self -Wunsafe-loop-optimizations -ggdb3 -fno-inline -DQT_STRICT_ITERATORS )
|
||||
if ( NOT WIN32 )
|
||||
add_definitions( -fvisibility=hidden )
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag( -Wlogical-op GNUCXX_HAS_WLOGICAL_OP )
|
||||
if ( GNUCXX_HAS_WLOGICAL_OP )
|
||||
add_definitions( -Wlogical-op )
|
||||
endif()
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
|
||||
set(MYGPO_QT_TARGET_NAME mygpo-qt${MYGPO_QT_VERSION_SUFFIX} CACHE INTERNAL "" FORCE )
|
||||
|
||||
add_subdirectory( src )
|
502
3rdparty/libmygpo-qt5/LICENSE
vendored
Normal file
502
3rdparty/libmygpo-qt5/LICENSE
vendored
Normal file
@ -0,0 +1,502 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
18
3rdparty/libmygpo-qt5/Mygpo-qtConfig.cmake.in
vendored
Normal file
18
3rdparty/libmygpo-qt5/Mygpo-qtConfig.cmake.in
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
get_filename_component(myDir ${CMAKE_CURRENT_LIST_FILE} PATH) # get the directory where I myself am
|
||||
get_filename_component(rootDir ${myDir}/@relInstallDir@ ABSOLUTE) # get the chosen install prefix
|
||||
|
||||
# set the version of myself
|
||||
set(MYGPO_QT_VERSION_MAJOR @MYGPO_QT_VERSION_MAJOR@)
|
||||
set(MYGPO_QT_VERSION_MINOR @MYGPO_QT_VERSION_MINOR@)
|
||||
set(MYGPO_QT_VERSION_PATCH @MYGPO_QT_VERSION_PATCH@)
|
||||
set(MYGPO_QT_VERSION ${MYGPO_QT_VERSION_MAJOR}.${MYGPO_QT_VERSION_MINOR}.${MYGPO_QT_VERSION_PATCH} )
|
||||
|
||||
# what is my include directory
|
||||
set(LIBMYGPO_QT_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@")
|
||||
|
||||
# import the exported targets
|
||||
include(${myDir}/Mygpo-qtTargets.cmake)
|
||||
|
||||
# set the expected library variable
|
||||
set(LIBMYGPO_QT_LIBRARIES mygpo-qt )
|
||||
set(LIBMYGPO_QT_FOUND "True")
|
10
3rdparty/libmygpo-qt5/Mygpo-qtConfigVersion.cmake.in
vendored
Normal file
10
3rdparty/libmygpo-qt5/Mygpo-qtConfigVersion.cmake.in
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
set(PACKAGE_VERSION @MYGPO_QT_VERSION_MAJOR@.@MYGPO_QT_VERSION_MINOR@.@MYGPO_QT_VERSION_PATCH@)
|
||||
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
52
3rdparty/libmygpo-qt5/README
vendored
Normal file
52
3rdparty/libmygpo-qt5/README
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
========== README ==========
|
||||
|
||||
=== What is libmygpo-qt ===
|
||||
|
||||
libmygpo-qt is a Qt Library that wraps the gpodder.net Web API (http://wiki.gpodder.org/wiki/Web_Services/API_2)
|
||||
|
||||
=== Copyright & License ===
|
||||
|
||||
Copyright 2010 - 2014 Stefan Derkits (stefan@derkits.at) , Christian Wagner (christian.wagner86@gmx.at) & Felix Winter (ixos01@gmail.com)
|
||||
|
||||
See COPYING File for License
|
||||
|
||||
=== Maintainer ===
|
||||
|
||||
Current Maintainer: Stefan Derkits (HorusHorrendus @ irc.freenode.net)
|
||||
|
||||
=== Requirements ===
|
||||
|
||||
-) Qt 4.6 or higher
|
||||
-) Cmake 2.6 or higher
|
||||
-) QJson
|
||||
|
||||
=== Qt5 Support ===
|
||||
|
||||
libmygpo-qt version 1.0.8 supports also building the library with Qt5. The API is the same as in the Qt4 library. To build the library with Qt5 add "-DBUILD_WITH_QT4=OFF" to your CMake
|
||||
command line. Please note that Qt5 support is still experimental. If you find anything to not work with Qt5, please report a bug.
|
||||
|
||||
==== Qt5 Requirements ===
|
||||
|
||||
-) CMake 2.8.9 or higher
|
||||
-) Qt 5.2 or higher
|
||||
|
||||
=== Links ===
|
||||
|
||||
Homepage: http://wiki.gpodder.org/wiki/Libmygpo-qt
|
||||
Git Repo: https://github.com/gpodder/libmygpo-qt
|
||||
Doxygen Documentation: http://stefan.derkits.at/libmygpo-doc/
|
||||
Bugreports: http://bugs.gpodder.org
|
||||
Contact: gpodder@freelists.org
|
||||
IRC Channel: #gpodder on FreeNode (irc.freenode.net)
|
||||
|
||||
=== How to Install ===
|
||||
|
||||
-) Create Directory "build"
|
||||
-) change into build and run "cmake .. -DCMAKE_BUILD_TYPE=Debug"
|
||||
-) make
|
||||
-) make install (might need root)
|
||||
|
||||
To use libmygpo-qt include the Header "ApiRequest.h" into your Code. You can find the cflags & linker flags for libmygpo-qt either via pkg-config (.pc file will be installed to your System)
|
||||
or via cmake (Mygpo-qtConfig.cmake will be installed to your system).
|
||||
|
||||
You can check the Example Application to see how you can use libmygpo-qt in your Application
|
50
3rdparty/libmygpo-qt5/cmake/modules/FindQJSON.cmake
vendored
Normal file
50
3rdparty/libmygpo-qt5/cmake/modules/FindQJSON.cmake
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# Find QJSON - JSON handling library for Qt
|
||||
#
|
||||
# This module defines
|
||||
# QJSON_FOUND - whether the qsjon library was found
|
||||
# QJSON_LIBRARIES - the qjson library
|
||||
# QJSON_INCLUDE_DIR - the include path of the qjson library
|
||||
#
|
||||
|
||||
if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
|
||||
|
||||
# Already in cache
|
||||
set (QJSON_FOUND TRUE)
|
||||
|
||||
else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
|
||||
|
||||
if (NOT WIN32)
|
||||
# use pkg-config to get the values of QJSON_INCLUDE_DIRS
|
||||
# and QJSON_LIBRARY_DIRS to add as hints to the find commands.
|
||||
include (FindPkgConfig)
|
||||
pkg_check_modules (QJSON REQUIRED QJson>=0.5)
|
||||
endif (NOT WIN32)
|
||||
|
||||
find_library (QJSON_LIBRARIES
|
||||
NAMES
|
||||
qjson
|
||||
PATHS
|
||||
${QJSON_LIBRARY_DIRS}
|
||||
${LIB_INSTALL_DIR}
|
||||
${KDE4_LIB_DIR}
|
||||
)
|
||||
|
||||
find_path (QJSON_INCLUDE_DIR
|
||||
NAMES
|
||||
parser.h
|
||||
PATH_SUFFIXES
|
||||
qjson
|
||||
PATHS
|
||||
${QJSON_INCLUDE_DIRS}
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
${KDE4_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR)
|
||||
|
||||
if ( UNIX AND NOT APPLE )
|
||||
set ( QJSON_LIBRARIES "${QJSON_LIBRARIES} ${QJSON_LDFLAGS}" CACHE INTERNAL "")
|
||||
endif ()
|
||||
|
||||
endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
|
@ -3,9 +3,8 @@ set( MYGPO_QT_VERSION_MAJOR "1" )
|
||||
set( MYGPO_QT_VERSION_MINOR "0" )
|
||||
set( MYGPO_QT_VERSION_PATCH "9" )
|
||||
configure_file( Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/Version.h )
|
||||
include_directories("${QJSON_INCLUDEDIR}/qjson")
|
||||
|
||||
include_directories( ${QT_INCLUDES} ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
|
||||
set ( LIBMYGPO_QT_SRC
|
||||
Config.cpp
|
||||
@ -81,9 +80,8 @@ set ( LIBMYGPO_QT_INSTALL_H
|
||||
AddRemoveResult.h
|
||||
)
|
||||
|
||||
QT4_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} )
|
||||
QT_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} )
|
||||
|
||||
add_library( mygpo-qt STATIC ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} )
|
||||
add_library( ${MYGPO_QT_TARGET_NAME} STATIC ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} )
|
||||
|
||||
target_link_libraries( mygpo-qt ${QJSON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
|
||||
set_target_properties( mygpo-qt PROPERTIES VERSION ${MYGPO_QT_VERSION} SOVERSION ${MYGPO_QT_SONAME} DEFINE_SYMBOL MYGPO_MAKEDLL)
|
||||
target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QJSON_LIBRARIES} Qt5::Core Qt5::Network )
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef MYGPO_EXPORT
|
||||
#ifndef MYGPO_STATIC
|
||||
# if defined(MYGPO_MAKEDLL)
|
||||
/* We are building this library */
|
||||
# define MYGPO_EXPORT Q_DECL_EXPORT
|
||||
@ -33,6 +33,8 @@
|
||||
/* We are using this library */
|
||||
# define MYGPO_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define MYGPO_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // MYGPO_EXPORT_H
|
123
3rdparty/libmygpo-qt5/src/qjsonwrapper/Json.cpp
vendored
Normal file
123
3rdparty/libmygpo-qt5/src/qjsonwrapper/Json.cpp
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Json.h"
|
||||
|
||||
// Qt version specific includes
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
#include <QJsonDocument>
|
||||
#include <QMetaProperty>
|
||||
#else
|
||||
#include <qjson/parser.h>
|
||||
#include <qjson/qobjecthelper.h>
|
||||
#include <qjson/serializer.h>
|
||||
#endif
|
||||
|
||||
namespace QJsonWrapper
|
||||
{
|
||||
|
||||
QVariantMap
|
||||
qobject2qvariant( const QObject* object )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
QVariantMap map;
|
||||
if ( object == NULL )
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
const QMetaObject* metaObject = object->metaObject();
|
||||
for ( int i = 0; i < metaObject->propertyCount(); ++i )
|
||||
{
|
||||
QMetaProperty metaproperty = metaObject->property( i );
|
||||
if ( metaproperty.isReadable() )
|
||||
{
|
||||
map[ QLatin1String( metaproperty.name() ) ] = object->property( metaproperty.name() );
|
||||
}
|
||||
}
|
||||
return map;
|
||||
#else
|
||||
return QJson::QObjectHelper::qobject2qvariant( object );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qvariant2qobject( const QVariantMap& variant, QObject* object )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
for ( QVariantMap::const_iterator iter = variant.begin(); iter != variant.end(); ++iter )
|
||||
{
|
||||
QVariant property = object->property( iter.key().toLatin1() );
|
||||
Q_ASSERT( property.isValid() );
|
||||
if ( property.isValid() )
|
||||
{
|
||||
QVariant value = iter.value();
|
||||
if ( value.canConvert( property.type() ) )
|
||||
{
|
||||
value.convert( property.type() );
|
||||
object->setProperty( iter.key().toLatin1(), value );
|
||||
} else if ( QString( QLatin1String("QVariant") ).compare( QLatin1String( property.typeName() ) ) == 0 ) {
|
||||
object->setProperty( iter.key().toLatin1(), value );
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
QJson::QObjectHelper::qvariant2qobject( variant, object );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QVariant
|
||||
parseJson( const QByteArray& jsonData, bool* ok )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error );
|
||||
if ( ok != NULL )
|
||||
{
|
||||
*ok = ( error.error == QJsonParseError::NoError );
|
||||
}
|
||||
return doc.toVariant();
|
||||
#else
|
||||
QJson::Parser p;
|
||||
return p.parse( jsonData, ok );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QByteArray
|
||||
toJson( const QVariant &variant, bool* ok )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
QJsonDocument doc = QJsonDocument::fromVariant( variant );
|
||||
if ( ok != NULL )
|
||||
{
|
||||
*ok = !doc.isNull();
|
||||
}
|
||||
return doc.toJson( QJsonDocument::Compact );
|
||||
#else
|
||||
QJson::Serializer serializer;
|
||||
return serializer.serialize( variant, ok );
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
36
3rdparty/libmygpo-qt5/src/qjsonwrapper/Json.h
vendored
Normal file
36
3rdparty/libmygpo-qt5/src/qjsonwrapper/Json.h
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef QJSONWRAPPER_JSON_H
|
||||
#define QJSONWRAPPER_JSON_H
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
namespace QJsonWrapper
|
||||
{
|
||||
QVariantMap qobject2qvariant( const QObject* object );
|
||||
void qvariant2qobject( const QVariantMap& variant, QObject* object );
|
||||
QVariant parseJson( const QByteArray& jsonData, bool* ok = 0 );
|
||||
QByteArray toJson( const QVariant &variant, bool* ok = 0 );
|
||||
}
|
||||
|
||||
#endif // QJSONWRAPPER_JSON_H
|
11
3rdparty/qocoa/CMakeLists.txt
vendored
11
3rdparty/qocoa/CMakeLists.txt
vendored
@ -6,7 +6,7 @@ set(HEADERS
|
||||
qprogressindicatorspinning.h
|
||||
)
|
||||
|
||||
qt4_wrap_cpp(MOC_SOURCES ${HEADERS})
|
||||
qt5_wrap_cpp(MOC_SOURCES ${HEADERS})
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND SOURCES
|
||||
@ -23,10 +23,15 @@ else()
|
||||
set(RESOURCES
|
||||
qprogressindicatorspinning_nonmac.qrc
|
||||
)
|
||||
qt4_add_resources(RESOURCES_SOURCES ${RESOURCES})
|
||||
qt5_add_resources(RESOURCES_SOURCES ${RESOURCES})
|
||||
endif()
|
||||
|
||||
add_library(Qocoa STATIC
|
||||
${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES}
|
||||
)
|
||||
target_link_libraries(Qocoa ${QT_LIBRARIES})
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(Qocoa Qt5::Widgets Qt5::MacExtras)
|
||||
else()
|
||||
target_link_libraries(Qocoa Qt5::Widgets)
|
||||
endif()
|
||||
|
8
3rdparty/qocoa/qbutton_mac.mm
vendored
8
3rdparty/qocoa/qbutton_mac.mm
vendored
@ -37,7 +37,9 @@ public:
|
||||
switch(bezelStyle) {
|
||||
case QButton::Disclosure:
|
||||
case QButton::Circular:
|
||||
#ifdef __MAC_10_7
|
||||
case QButton::Inline:
|
||||
#endif
|
||||
case QButton::RoundedDisclosure:
|
||||
case QButton::HelpButton:
|
||||
[nsButton setTitle:@""];
|
||||
@ -55,7 +57,7 @@ public:
|
||||
font = [NSFont fontWithName:@"Lucida Grande Bold" size:12];
|
||||
break;
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_7
|
||||
#ifdef __MAC_10_7
|
||||
case QButton::Inline:
|
||||
font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
|
||||
break;
|
||||
@ -112,7 +114,7 @@ public:
|
||||
qButton->setFixedHeight(22);
|
||||
qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
break;
|
||||
#ifdef MAC_OS_X_VERSION_10_7
|
||||
#ifdef __MAC_10_7
|
||||
case QButton::Inline:
|
||||
qButton->setMinimumWidth(10);
|
||||
qButton->setFixedHeight(16);
|
||||
@ -130,7 +132,7 @@ public:
|
||||
[nsButton setButtonType:NSMomentaryPushInButton];
|
||||
}
|
||||
|
||||
[nsButton setBezelStyle:bezelStyle];
|
||||
[nsButton setBezelStyle:(__bridge NSBezelStyle)bezelStyle];
|
||||
}
|
||||
|
||||
void clicked()
|
||||
|
19
3rdparty/qocoa/qocoa_mac.h
vendored
19
3rdparty/qocoa/qocoa_mac.h
vendored
@ -20,10 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <QMacCocoaViewContainer>
|
||||
#include <QString>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMacCocoaViewContainer>
|
||||
#include <QtMacExtras>
|
||||
|
||||
static inline NSString* fromQString(const QString &string)
|
||||
{
|
||||
@ -41,14 +43,13 @@ static inline QString toQString(NSString *string)
|
||||
|
||||
static inline NSImage* fromQPixmap(const QPixmap &pixmap)
|
||||
{
|
||||
CGImageRef cgImage = pixmap.toMacCGImageRef();
|
||||
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
|
||||
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
|
||||
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
|
||||
}
|
||||
|
||||
static inline void setupLayout(void *cocoaView, QWidget *parent)
|
||||
{
|
||||
parent->setAttribute(Qt::WA_NativeWindow);
|
||||
QVBoxLayout *layout = new QVBoxLayout(parent);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
|
||||
static inline void setupLayout(NSView* cocoaView, QWidget* parent) {
|
||||
parent->setAttribute(Qt::WA_NativeWindow);
|
||||
QVBoxLayout* layout = new QVBoxLayout(parent);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
|
||||
}
|
||||
|
12
3rdparty/qsqlite/CMakeLists.txt
vendored
12
3rdparty/qsqlite/CMakeLists.txt
vendored
@ -1,22 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
add_definitions(-DQT_STATICPLUGIN)
|
||||
|
||||
# Source files
|
||||
set(SQLITE-SOURCES
|
||||
qsql_sqlite.cpp
|
||||
smain.cpp
|
||||
clementinesqlcachedresult.cpp
|
||||
smain.cpp
|
||||
)
|
||||
|
||||
# Header files that have Q_OBJECT in
|
||||
set(SQLITE-MOC-HEADERS
|
||||
qsql_sqlite.h
|
||||
smain.h
|
||||
)
|
||||
|
||||
set(SQLITE-WIN32-RESOURCES qsqlite_resource.rc)
|
||||
|
||||
qt4_wrap_cpp(SQLITE-SOURCES-MOC ${SQLITE-MOC-HEADERS})
|
||||
qt5_wrap_cpp(SQLITE-SOURCES-MOC ${SQLITE-MOC-HEADERS})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
@ -40,7 +41,10 @@ add_library(qsqlite STATIC
|
||||
${SQLITE-SOURCES-MOC}
|
||||
${SQLITE-WIN32-RESOURCES}
|
||||
)
|
||||
|
||||
set_property(TARGET qsqlite PROPERTY QT_STATICPLUGIN 1)
|
||||
|
||||
target_link_libraries(qsqlite
|
||||
Qt5::Core Qt5::Sql
|
||||
${SQLITE_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
65
3rdparty/qsqlite/clementinesqlcachedresult.cpp
vendored
65
3rdparty/qsqlite/clementinesqlcachedresult.cpp
vendored
@ -1,17 +1,18 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtSql module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
@ -21,30 +22,31 @@
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clementinesqlcachedresult.h"
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qvector.h>
|
||||
|
||||
#include "clementinesqlcachedresult.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*
|
||||
ClementineSqlCachedResult is a convenience class for databases that only allow
|
||||
forward only fetching. It will cache all the results so we can iterate
|
||||
@ -302,12 +304,19 @@ ClementineSqlCachedResult::ValueCache &ClementineSqlCachedResult::cache()
|
||||
|
||||
void ClementineSqlCachedResult::virtual_hook(int id, void *data)
|
||||
{
|
||||
switch (id) {
|
||||
case QSqlResult::DetachFromResultSet:
|
||||
case QSqlResult::SetNumericalPrecision:
|
||||
cleanup();
|
||||
break;
|
||||
default:
|
||||
QSqlResult::virtual_hook(id, data);
|
||||
}
|
||||
QSqlResult::virtual_hook(id, data);
|
||||
}
|
||||
|
||||
void ClementineSqlCachedResult::detachFromResultSet()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void ClementineSqlCachedResult::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy)
|
||||
{
|
||||
QSqlResult::setNumericalPrecisionPolicy(policy);
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
61
3rdparty/qsqlite/clementinesqlcachedresult.h
vendored
61
3rdparty/qsqlite/clementinesqlcachedresult.h
vendored
@ -1,17 +1,18 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtSql module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
@ -21,28 +22,40 @@
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLEMENTINECACHEDRESULT_P_H
|
||||
#define CLEMENTINECACHEDRESULT_P_H
|
||||
#ifndef QSQLCACHEDRESULT_P_H
|
||||
#define QSQLCACHEDRESULT_P_H
|
||||
|
||||
#include <QSqlResult>
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of other Qt classes. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtSql/qsqlresult.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVariant;
|
||||
template <typename T> class QVector;
|
||||
@ -77,9 +90,13 @@ protected:
|
||||
ValueCache &cache();
|
||||
|
||||
void virtual_hook(int id, void *data);
|
||||
void detachFromResultSet();
|
||||
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy);
|
||||
private:
|
||||
bool cacheNext();
|
||||
ClementineSqlCachedResultPrivate *d;
|
||||
};
|
||||
|
||||
#endif // CLEMENTINESQLCACHEDRESULT_P_H
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QSQLCACHEDRESULT_P_H
|
||||
|
171
3rdparty/qsqlite/qsql_sqlite.cpp
vendored
171
3rdparty/qsqlite/qsql_sqlite.cpp
vendored
@ -1,17 +1,18 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtSql module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
@ -21,8 +22,8 @@
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
@ -33,8 +34,7 @@
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
@ -59,7 +59,10 @@
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
Q_DECLARE_OPAQUE_POINTER(sqlite3*)
|
||||
Q_DECLARE_METATYPE(sqlite3*)
|
||||
|
||||
Q_DECLARE_OPAQUE_POINTER(sqlite3_stmt*)
|
||||
Q_DECLARE_METATYPE(sqlite3_stmt*)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -84,10 +87,14 @@ static QVariant::Type qGetColumnType(const QString &tpName)
|
||||
return QVariant::Int;
|
||||
if (typeName == QLatin1String("double")
|
||||
|| typeName == QLatin1String("float")
|
||||
|| typeName == QLatin1String("real")
|
||||
|| typeName.startsWith(QLatin1String("numeric")))
|
||||
return QVariant::Double;
|
||||
if (typeName == QLatin1String("blob"))
|
||||
return QVariant::ByteArray;
|
||||
if (typeName == QLatin1String("boolean")
|
||||
|| typeName == QLatin1String("bool"))
|
||||
return QVariant::Bool;
|
||||
return QVariant::String;
|
||||
}
|
||||
|
||||
@ -95,7 +102,7 @@ static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::Er
|
||||
int errorCode = -1)
|
||||
{
|
||||
return QSqlError(descr,
|
||||
QString::fromUtf16(static_cast<const ushort *>(sqlite3_errmsg16(access))),
|
||||
QString(reinterpret_cast<const QChar *>(sqlite3_errmsg16(access))),
|
||||
type, errorCode);
|
||||
}
|
||||
|
||||
@ -104,6 +111,7 @@ class QSQLiteDriverPrivate
|
||||
public:
|
||||
inline QSQLiteDriverPrivate() : access(0) {}
|
||||
sqlite3 *access;
|
||||
QList <QSQLiteResult *> results;
|
||||
};
|
||||
|
||||
|
||||
@ -162,19 +170,44 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
|
||||
q->init(nCols);
|
||||
|
||||
for (int i = 0; i < nCols; ++i) {
|
||||
QString colName = QString::fromUtf16(
|
||||
static_cast<const ushort *>(sqlite3_column_name16(stmt, i))
|
||||
QString colName = QString(reinterpret_cast<const QChar *>(
|
||||
sqlite3_column_name16(stmt, i))
|
||||
).remove(QLatin1Char('"'));
|
||||
|
||||
// must use typeName for resolving the type to match QSqliteDriver::record
|
||||
QString typeName = QString::fromUtf16(
|
||||
static_cast<const ushort *>(sqlite3_column_decltype16(stmt, i)));
|
||||
|
||||
int dotIdx = colName.lastIndexOf(QLatin1Char('.'));
|
||||
QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(typeName));
|
||||
|
||||
QString typeName = QString(reinterpret_cast<const QChar *>(
|
||||
sqlite3_column_decltype16(stmt, i)));
|
||||
// sqlite3_column_type is documented to have undefined behavior if the result set is empty
|
||||
int stp = emptyResultset ? -1 : sqlite3_column_type(stmt, i);
|
||||
|
||||
QVariant::Type fieldType;
|
||||
|
||||
if (!typeName.isEmpty()) {
|
||||
fieldType = qGetColumnType(typeName);
|
||||
} else {
|
||||
// Get the proper type for the field based on stp value
|
||||
switch (stp) {
|
||||
case SQLITE_INTEGER:
|
||||
fieldType = QVariant::Int;
|
||||
break;
|
||||
case SQLITE_FLOAT:
|
||||
fieldType = QVariant::Double;
|
||||
break;
|
||||
case SQLITE_BLOB:
|
||||
fieldType = QVariant::ByteArray;
|
||||
break;
|
||||
case SQLITE_TEXT:
|
||||
fieldType = QVariant::String;
|
||||
break;
|
||||
case SQLITE_NULL:
|
||||
default:
|
||||
fieldType = QVariant::Invalid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int dotIdx = colName.lastIndexOf(QLatin1Char('.'));
|
||||
QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), fieldType);
|
||||
fld.setSqlType(stp);
|
||||
rInf.append(fld);
|
||||
}
|
||||
@ -245,9 +278,9 @@ bool QSQLiteResultPrivate::fetchNext(ClementineSqlCachedResult::ValueCache &valu
|
||||
values[i + idx] = QVariant(QVariant::String);
|
||||
break;
|
||||
default:
|
||||
values[i + idx] = QString::fromUtf16(static_cast<const ushort *>(
|
||||
values[i + idx] = QString(reinterpret_cast<const QChar *>(
|
||||
sqlite3_column_text16(stmt, i)),
|
||||
sqlite3_column_bytes16(stmt, i) / sizeof(ushort));
|
||||
sqlite3_column_bytes16(stmt, i) / sizeof(QChar));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -259,6 +292,7 @@ bool QSQLiteResultPrivate::fetchNext(ClementineSqlCachedResult::ValueCache &valu
|
||||
q->setAt(QSql::AfterLastRow);
|
||||
sqlite3_reset(stmt);
|
||||
return false;
|
||||
case SQLITE_CONSTRAINT:
|
||||
case SQLITE_ERROR:
|
||||
// SQLITE_ERROR is a generic error code and we must call sqlite3_reset()
|
||||
// to get the specific error message.
|
||||
@ -285,24 +319,21 @@ QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
|
||||
{
|
||||
d = new QSQLiteResultPrivate(this);
|
||||
d->access = db->d->access;
|
||||
db->d->results.append(this);
|
||||
}
|
||||
|
||||
QSQLiteResult::~QSQLiteResult()
|
||||
{
|
||||
const QSqlDriver *sqlDriver = driver();
|
||||
if (sqlDriver)
|
||||
qobject_cast<const QSQLiteDriver *>(sqlDriver)->d->results.removeOne(this);
|
||||
d->cleanup();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QSQLiteResult::virtual_hook(int id, void *data)
|
||||
{
|
||||
switch (id) {
|
||||
case QSqlResult::DetachFromResultSet:
|
||||
if (d->stmt)
|
||||
sqlite3_reset(d->stmt);
|
||||
break;
|
||||
default:
|
||||
ClementineSqlCachedResult::virtual_hook(id, data);
|
||||
}
|
||||
ClementineSqlCachedResult::virtual_hook(id, data);
|
||||
}
|
||||
|
||||
bool QSQLiteResult::reset(const QString &query)
|
||||
@ -321,12 +352,14 @@ bool QSQLiteResult::prepare(const QString &query)
|
||||
|
||||
setSelect(false);
|
||||
|
||||
const void *pzTail = NULL;
|
||||
|
||||
#if (SQLITE_VERSION_NUMBER >= 3003011)
|
||||
int res = sqlite3_prepare16_v2(d->access, query.constData(), (query.size() + 1) * sizeof(QChar),
|
||||
&d->stmt, 0);
|
||||
&d->stmt, &pzTail);
|
||||
#else
|
||||
int res = sqlite3_prepare16(d->access, query.constData(), (query.size() + 1) * sizeof(QChar),
|
||||
&d->stmt, 0);
|
||||
&d->stmt, &pzTail);
|
||||
#endif
|
||||
|
||||
if (res != SQLITE_OK) {
|
||||
@ -334,6 +367,11 @@ bool QSQLiteResult::prepare(const QString &query)
|
||||
"Unable to execute statement"), QSqlError::StatementError, res));
|
||||
d->finalize();
|
||||
return false;
|
||||
} else if (pzTail && !QString(reinterpret_cast<const QChar *>(pzTail)).trimmed().isEmpty()) {
|
||||
setLastError(qMakeError(d->access, QCoreApplication::translate("QSQLiteResult",
|
||||
"Unable to execute multiple statements at a time"), QSqlError::StatementError, SQLITE_MISUSE));
|
||||
d->finalize();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -371,6 +409,7 @@ bool QSQLiteResult::exec()
|
||||
ba->size(), SQLITE_STATIC);
|
||||
break; }
|
||||
case QVariant::Int:
|
||||
case QVariant::Bool:
|
||||
res = sqlite3_bind_int(d->stmt, i + 1, value.toInt());
|
||||
break;
|
||||
case QVariant::Double:
|
||||
@ -403,7 +442,7 @@ bool QSQLiteResult::exec()
|
||||
}
|
||||
} else {
|
||||
setLastError(QSqlError(QCoreApplication::translate("QSQLiteResult",
|
||||
"Parameter count mismatch"), QString(), QSqlError::StatementError));
|
||||
"Parameter count mismatch") + QString::number(paramCount, 10) + "/" + QString::number(values.count(), 10), QString(), QSqlError::StatementError));
|
||||
return false;
|
||||
}
|
||||
d->skippedStatus = d->fetchNext(d->firstRow, 0, true);
|
||||
@ -449,9 +488,15 @@ QSqlRecord QSQLiteResult::record() const
|
||||
return d->rInf;
|
||||
}
|
||||
|
||||
void QSQLiteResult::detachFromResultSet()
|
||||
{
|
||||
if (d->stmt)
|
||||
sqlite3_reset(d->stmt);
|
||||
}
|
||||
|
||||
QVariant QSQLiteResult::handle() const
|
||||
{
|
||||
return qVariantFromValue(d->stmt);
|
||||
return QVariant::fromValue(d->stmt);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@ -500,32 +545,6 @@ bool QSQLiteDriver::hasFeature(DriverFeature f) const
|
||||
return false;
|
||||
}
|
||||
|
||||
static int qGetSqliteTimeout(QString opts)
|
||||
{
|
||||
enum { DefaultTimeout = 5000 };
|
||||
|
||||
opts.remove(QLatin1Char(' '));
|
||||
foreach(QString option, opts.split(QLatin1Char(';'))) {
|
||||
if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
|
||||
bool ok;
|
||||
int nt = option.mid(21).toInt(&ok);
|
||||
if (ok)
|
||||
return nt;
|
||||
}
|
||||
}
|
||||
return DefaultTimeout;
|
||||
}
|
||||
|
||||
static int qGetSqliteOpenMode(QString opts)
|
||||
{
|
||||
opts.remove(QLatin1Char(' '));
|
||||
foreach(QString option, opts.split(QLatin1Char(';'))) {
|
||||
if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
|
||||
return SQLITE_OPEN_READONLY;
|
||||
}
|
||||
return SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
|
||||
}
|
||||
|
||||
/*
|
||||
SQLite dbs have no user name, passwords, hosts or ports.
|
||||
just file names.
|
||||
@ -537,13 +556,35 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
|
||||
|
||||
if (db.isEmpty())
|
||||
return false;
|
||||
bool sharedCache = false;
|
||||
int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000;
|
||||
QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';'));
|
||||
foreach(const QString &option, opts) {
|
||||
if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
|
||||
bool ok;
|
||||
int nt = option.mid(21).toInt(&ok);
|
||||
if (ok)
|
||||
timeOut = nt;
|
||||
}
|
||||
if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
|
||||
openMode = SQLITE_OPEN_READONLY;
|
||||
if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE"))
|
||||
sharedCache = true;
|
||||
}
|
||||
|
||||
if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, qGetSqliteOpenMode(conOpts), NULL) == SQLITE_OK) {
|
||||
sqlite3_busy_timeout(d->access, qGetSqliteTimeout(conOpts));
|
||||
sqlite3_enable_shared_cache(sharedCache);
|
||||
|
||||
if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) {
|
||||
sqlite3_busy_timeout(d->access, timeOut);
|
||||
setOpen(true);
|
||||
setOpenError(false);
|
||||
return true;
|
||||
} else {
|
||||
if (d->access) {
|
||||
sqlite3_close(d->access);
|
||||
d->access = 0;
|
||||
}
|
||||
|
||||
setLastError(qMakeError(d->access, tr("Error opening database"),
|
||||
QSqlError::ConnectionError));
|
||||
setOpenError(true);
|
||||
@ -554,6 +595,10 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
|
||||
void QSQLiteDriver::close()
|
||||
{
|
||||
if (isOpen()) {
|
||||
foreach (QSQLiteResult *result, d->results) {
|
||||
result->d->finalize();
|
||||
}
|
||||
|
||||
if (sqlite3_close(d->access) != SQLITE_OK)
|
||||
setLastError(qMakeError(d->access, tr("Error closing database"),
|
||||
QSqlError::ConnectionError));
|
||||
@ -705,7 +750,7 @@ QSqlRecord QSQLiteDriver::record(const QString &tbl) const
|
||||
|
||||
QVariant QSQLiteDriver::handle() const
|
||||
{
|
||||
return qVariantFromValue(d->access);
|
||||
return QVariant::fromValue(d->access);
|
||||
}
|
||||
|
||||
QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const
|
||||
|
27
3rdparty/qsqlite/qsql_sqlite.h
vendored
27
3rdparty/qsqlite/qsql_sqlite.h
vendored
@ -1,17 +1,18 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtSql module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
@ -21,8 +22,8 @@
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
@ -33,8 +34,7 @@
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
@ -42,8 +42,8 @@
|
||||
#ifndef QSQL_SQLITE_H
|
||||
#define QSQL_SQLITE_H
|
||||
|
||||
#include <QSqlDriver>
|
||||
#include <QSqlResult>
|
||||
#include <QtSql/qsqldriver.h>
|
||||
#include <QtSql/qsqlresult.h>
|
||||
#include "clementinesqlcachedresult.h"
|
||||
|
||||
struct sqlite3;
|
||||
@ -79,6 +79,7 @@ protected:
|
||||
int numRowsAffected();
|
||||
QVariant lastInsertId() const;
|
||||
QSqlRecord record() const;
|
||||
void detachFromResultSet();
|
||||
void virtual_hook(int id, void *data);
|
||||
|
||||
private:
|
||||
|
3
3rdparty/qsqlite/qsqlite.json
vendored
Normal file
3
3rdparty/qsqlite/qsqlite.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Keys": [ "QSQLITE" ]
|
||||
}
|
65
3rdparty/qsqlite/smain.cpp
vendored
65
3rdparty/qsqlite/smain.cpp
vendored
@ -1,59 +1,40 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qsqldriverplugin.h>
|
||||
#include <qstringlist.h>
|
||||
#include "qsql_sqlite.h"
|
||||
#include "smain.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QSQLiteDriverPlugin : public QSqlDriverPlugin
|
||||
{
|
||||
public:
|
||||
QSQLiteDriverPlugin();
|
||||
|
||||
QSqlDriver* create(const QString &);
|
||||
QStringList keys() const;
|
||||
};
|
||||
|
||||
QSQLiteDriverPlugin::QSQLiteDriverPlugin()
|
||||
: QSqlDriverPlugin()
|
||||
{
|
||||
@ -68,14 +49,4 @@ QSqlDriver* QSQLiteDriverPlugin::create(const QString &name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList QSQLiteDriverPlugin::keys() const
|
||||
{
|
||||
QStringList l;
|
||||
l << QLatin1String("QSQLITE");
|
||||
return l;
|
||||
}
|
||||
|
||||
Q_EXPORT_STATIC_PLUGIN(QSQLiteDriverPlugin)
|
||||
Q_EXPORT_PLUGIN2(qsqlite, QSQLiteDriverPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
51
3rdparty/qsqlite/smain.h
vendored
Normal file
51
3rdparty/qsqlite/smain.h
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qsqldriverplugin.h>
|
||||
#include <qstringlist.h>
|
||||
#include "qsql_sqlite.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QSQLiteDriverPlugin : public QSqlDriverPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "qsqlite.json")
|
||||
|
||||
public:
|
||||
QSQLiteDriverPlugin();
|
||||
|
||||
QSqlDriver* create(const QString &);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
11
3rdparty/qsqlite/smain.patch
vendored
11
3rdparty/qsqlite/smain.patch
vendored
@ -1,11 +0,0 @@
|
||||
--- smain.cpp.old 2010-03-22 17:34:03.000000000 +0000
|
||||
+++ smain.cpp 2010-03-22 17:34:08.000000000 +0000
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#include <qsqldriverplugin.h>
|
||||
#include <qstringlist.h>
|
||||
-#include "../../../../src/sql/drivers/sqlite/qsql_sqlite.h"
|
||||
+#include "qsql_sqlite.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
6
3rdparty/qtiocompressor/CMakeLists.txt
vendored
6
3rdparty/qtiocompressor/CMakeLists.txt
vendored
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
set(IOCOMPRESSOR-SOURCES
|
||||
qtiocompressor.cpp
|
||||
@ -8,9 +8,11 @@ set(IOCOMPRESSOR-MOC-HEADERS
|
||||
qtiocompressor.h
|
||||
)
|
||||
|
||||
QT4_WRAP_CPP(IOCOMPRESSOR-SOURCES-MOC ${IOCOMPRESSOR-MOC-HEADERS})
|
||||
QT5_WRAP_CPP(IOCOMPRESSOR-SOURCES-MOC ${IOCOMPRESSOR-MOC-HEADERS})
|
||||
|
||||
ADD_LIBRARY(qtiocompressor STATIC
|
||||
${IOCOMPRESSOR-SOURCES}
|
||||
${IOCOMPRESSOR-SOURCES-MOC}
|
||||
)
|
||||
|
||||
target_link_libraries(qtiocompressor Qt5::Core)
|
||||
|
2
3rdparty/qtiocompressor/qtiocompressor.h
vendored
2
3rdparty/qtiocompressor/qtiocompressor.h
vendored
@ -49,7 +49,7 @@
|
||||
|
||||
#include <QtCore/QIODevice>
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
# if !defined(QT_QTIOCOMPRESSOR_EXPORT) && !defined(QT_QTIOCOMPRESSOR_IMPORT)
|
||||
# define QT_QTIOCOMPRESSOR_EXPORT
|
||||
# elif defined(QT_QTIOCOMPRESSOR_IMPORT)
|
||||
|
7
3rdparty/qtsingleapplication/CMakeLists.txt
vendored
7
3rdparty/qtsingleapplication/CMakeLists.txt
vendored
@ -1,9 +1,8 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
|
||||
|
||||
set(SINGLEAPP-SOURCES
|
||||
qtlocalpeer.cpp
|
||||
qtlockedfile.cpp
|
||||
qtsingleapplication.cpp
|
||||
qtsinglecoreapplication.cpp
|
||||
)
|
||||
@ -20,9 +19,11 @@ elseif(WIN32)
|
||||
set(SINGLEAPP-SOURCES ${SINGLEAPP-SOURCES} qtlockedfile_unix.cpp)
|
||||
endif(WIN32)
|
||||
|
||||
QT4_WRAP_CPP(SINGLEAPP-SOURCES-MOC ${SINGLEAPP-MOC-HEADERS})
|
||||
QT5_WRAP_CPP(SINGLEAPP-SOURCES-MOC ${SINGLEAPP-MOC-HEADERS})
|
||||
|
||||
ADD_LIBRARY(qtsingleapplication STATIC
|
||||
${SINGLEAPP-SOURCES}
|
||||
${SINGLEAPP-SOURCES-MOC}
|
||||
)
|
||||
|
||||
target_link_libraries(qtsingleapplication Qt5::Core Qt5::Widgets Qt5::Network)
|
||||
|
1
3rdparty/qtsingleapplication/QtLockedFile
vendored
1
3rdparty/qtsingleapplication/QtLockedFile
vendored
@ -1 +0,0 @@
|
||||
#include "qtlockedfile.h"
|
@ -1 +0,0 @@
|
||||
#include "qtsingleapplication.h"
|
118
3rdparty/qtsingleapplication/qtlocalpeer.cpp
vendored
118
3rdparty/qtsingleapplication/qtlocalpeer.cpp
vendored
@ -1,58 +1,52 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "qtlocalpeer.h"
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtDebug>
|
||||
#include <QCoreApplication>
|
||||
#include <QTime>
|
||||
#include <QDataStream>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtCore/QLibrary>
|
||||
#include <QtCore/qt_windows.h>
|
||||
#include <QLibrary>
|
||||
#include <qt_windows.h>
|
||||
typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
|
||||
static PProcessIdToSessionId pProcessIdToSessionId = 0;
|
||||
#endif
|
||||
@ -107,7 +101,6 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
||||
+ QLatin1Char('/') + socketName
|
||||
+ QLatin1String("-lockfile");
|
||||
lockFile.setFileName(lockName);
|
||||
lockFileCreated = !lockFile.exists();
|
||||
lockFile.open(QIODevice::ReadWrite);
|
||||
}
|
||||
|
||||
@ -118,8 +111,7 @@ bool QtLocalPeer::isClient()
|
||||
if (lockFile.isLocked())
|
||||
return false;
|
||||
|
||||
if (!lockFile.lock(QtLockedFile::WriteLock, false))
|
||||
return true;
|
||||
if (!lockFile.lock(QtLockedFile::WriteLock, false)) return true;
|
||||
|
||||
bool res = server->listen(socketName);
|
||||
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0))
|
||||
@ -137,16 +129,6 @@ bool QtLocalPeer::isClient()
|
||||
|
||||
|
||||
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
||||
{
|
||||
return sendMessage(message.toUtf8(), timeout);
|
||||
}
|
||||
|
||||
bool QtLocalPeer::sendMessage(const char* message, int timeout)
|
||||
{
|
||||
return sendMessage(QByteArray(message), timeout);
|
||||
}
|
||||
|
||||
bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
|
||||
{
|
||||
if (!isClient())
|
||||
return false;
|
||||
@ -170,11 +152,15 @@ bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
|
||||
if (!connOk)
|
||||
return false;
|
||||
|
||||
QByteArray uMsg(message.toUtf8());
|
||||
QDataStream ds(&socket);
|
||||
ds.writeBytes(message.constData(), message.size());
|
||||
ds.writeBytes(uMsg.constData(), uMsg.size());
|
||||
bool res = socket.waitForBytesWritten(timeout);
|
||||
res &= socket.waitForReadyRead(timeout); // wait for ack
|
||||
res &= (socket.read(qstrlen(ack)) == ack);
|
||||
if (res) {
|
||||
res &= socket.waitForReadyRead(timeout); // wait for ack
|
||||
if (res)
|
||||
res &= (socket.read(qstrlen(ack)) == ack);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -200,19 +186,13 @@ void QtLocalPeer::receiveConnection()
|
||||
uMsgBuf += got;
|
||||
} while (remaining && got >= 0 && socket->waitForReadyRead(2000));
|
||||
if (got < 0) {
|
||||
qWarning() << "QtLocalPeer: Message reception failed" << socket->errorString();
|
||||
qWarning("QtLocalPeer: Message reception failed %s", socket->errorString().toLatin1().constData());
|
||||
delete socket;
|
||||
return;
|
||||
}
|
||||
QString message(QString::fromUtf8(uMsg));
|
||||
socket->write(ack, qstrlen(ack));
|
||||
socket->waitForBytesWritten(1000);
|
||||
delete socket;
|
||||
emit messageReceived(uMsg); //### (might take a long time to return)
|
||||
emit messageReceived(QString::fromUtf8(uMsg));
|
||||
}
|
||||
|
||||
QtLocalPeer::~QtLocalPeer ()
|
||||
{
|
||||
if (lockFileCreated)
|
||||
lockFile.remove();
|
||||
emit messageReceived(message); //### (might take a long time to return)
|
||||
}
|
||||
|
89
3rdparty/qtsingleapplication/qtlocalpeer.h
vendored
89
3rdparty/qtsingleapplication/qtlocalpeer.h
vendored
@ -1,53 +1,48 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTLOCALPEER_H
|
||||
#define QTLOCALPEER_H
|
||||
|
||||
#include <QtNetwork/QLocalServer>
|
||||
#include <QtNetwork/QLocalSocket>
|
||||
#include <QtCore/QDir>
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QDir>
|
||||
|
||||
#include "qtlockedfile.h"
|
||||
|
||||
@ -57,18 +52,13 @@ class QtLocalPeer : public QObject
|
||||
|
||||
public:
|
||||
QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
|
||||
~QtLocalPeer ();
|
||||
bool isClient();
|
||||
bool sendMessage(const QString &message, int timeout);
|
||||
bool sendMessage(const QByteArray &message, int timeout);
|
||||
bool sendMessage(const char* message, int timeout);
|
||||
QString applicationId() const
|
||||
{ return id; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
void messageReceived(const QByteArray &message);
|
||||
void messageReceived(const char* message);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void receiveConnection();
|
||||
@ -79,7 +69,8 @@ protected:
|
||||
QLocalServer* server;
|
||||
QtLockedFile lockFile;
|
||||
|
||||
private:
|
||||
private:
|
||||
static const char* ack;
|
||||
bool lockFileCreated;
|
||||
};
|
||||
|
||||
#endif // QTLOCALPEER_H
|
||||
|
71
3rdparty/qtsingleapplication/qtlockedfile.cpp
vendored
71
3rdparty/qtsingleapplication/qtlockedfile.cpp
vendored
@ -1,47 +1,40 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qtlockedfile.h"
|
||||
|
75
3rdparty/qtsingleapplication/qtlockedfile.h
vendored
75
3rdparty/qtsingleapplication/qtlockedfile.h
vendored
@ -1,58 +1,51 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTLOCKEDFILE_H
|
||||
#define QTLOCKEDFILE_H
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QFile>
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QtCore/QVector>
|
||||
#endif
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
# if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT)
|
||||
# define QT_QTLOCKEDFILE_EXPORT
|
||||
# elif defined(QT_QTLOCKEDFILE_IMPORT)
|
||||
|
@ -1,47 +1,40 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -1,52 +1,45 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qtlockedfile.h"
|
||||
#include <qt_windows.h>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QFileInfo>
|
||||
|
||||
#define MUTEX_PREFIX "QtLockedFile mutex "
|
||||
// Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS
|
||||
@ -65,19 +58,35 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
|
||||
|
||||
Qt::HANDLE mutex;
|
||||
if (doCreate) {
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QT_WA({ mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); },
|
||||
{
|
||||
mutex =
|
||||
CreateMutexA(nullptr, FALSE, mname.toLocal8Bit().constData());
|
||||
});
|
||||
if (!mutex) {
|
||||
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
|
||||
return 0;
|
||||
#else
|
||||
mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16());
|
||||
#endif
|
||||
if (!mutex) {
|
||||
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); },
|
||||
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QT_WA(
|
||||
{
|
||||
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE,
|
||||
(WCHAR*)mname.utf16());
|
||||
},
|
||||
{
|
||||
mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE,
|
||||
mname.toLocal8Bit().constData());
|
||||
});
|
||||
#else
|
||||
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE,
|
||||
(WCHAR*)mname.utf16());
|
||||
#endif
|
||||
if (!mutex) {
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND)
|
||||
qErrnoWarning("QtLockedFile::lock(): OpenMutex failed");
|
||||
|
199
3rdparty/qtsingleapplication/qtsingleapplication.cpp
vendored
199
3rdparty/qtsingleapplication/qtsingleapplication.cpp
vendored
@ -1,54 +1,46 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "qtsingleapplication.h"
|
||||
#include "qtlocalpeer.h"
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
/*!
|
||||
\class QtSingleApplication qtsingleapplication.h
|
||||
@ -68,28 +60,31 @@
|
||||
that will be compared instead.
|
||||
|
||||
The application should create the QtSingleApplication object early
|
||||
in the startup phase, and call isRunning() or sendMessage() to
|
||||
find out if another instance of this application is already
|
||||
running. Startup parameters (e.g. the name of the file the user
|
||||
wanted this new instance to open) can be passed to the running
|
||||
instance in the sendMessage() function.
|
||||
in the startup phase, and call isRunning() to find out if another
|
||||
instance of this application is already running. If isRunning()
|
||||
returns false, it means that no other instance is running, and
|
||||
this instance has assumed the role as the running instance. In
|
||||
this case, the application should continue with the initialization
|
||||
of the application user interface before entering the event loop
|
||||
with exec(), as normal.
|
||||
|
||||
If isRunning() or sendMessage() returns false, it means that no
|
||||
other instance is running, and this instance has assumed the role
|
||||
as the running instance. The application should continue with the
|
||||
initialization of the application user interface before entering
|
||||
the event loop with exec(), as normal. The messageReceived()
|
||||
signal will be emitted when the application receives messages from
|
||||
another instance of the same application.
|
||||
The messageReceived() signal will be emitted when the running
|
||||
application receives messages from another instance of the same
|
||||
application. When a message is received it might be helpful to the
|
||||
user to raise the application so that it becomes visible. To
|
||||
facilitate this, QtSingleApplication provides the
|
||||
setActivationWindow() function and the activateWindow() slot.
|
||||
|
||||
If isRunning() or sendMessage() returns true, another instance is
|
||||
already running, and the application should terminate or enter
|
||||
client mode.
|
||||
If isRunning() returns true, another instance is already
|
||||
running. It may be alerted to the fact that another instance has
|
||||
started by using the sendMessage() function. Also data such as
|
||||
startup parameters (e.g. the name of the file the user wanted this
|
||||
new instance to open) can be passed to the running instance with
|
||||
this function. Then, the application should terminate (or enter
|
||||
client mode).
|
||||
|
||||
If a message is received it might be helpful to the user to raise
|
||||
the application so that it becomes visible. To facilitate this,
|
||||
QtSingleApplication provides the setActivationWindow() function
|
||||
and the activateWindow() slot.
|
||||
If isRunning() returns true, but sendMessage() fails, that is an
|
||||
indication that the running instance is frozen.
|
||||
|
||||
Here's an example that shows how to convert an existing
|
||||
application to use QtSingleApplication. It is very simple and does
|
||||
@ -103,7 +98,6 @@
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MyMainWidget mmw;
|
||||
|
||||
mmw.show();
|
||||
return app.exec();
|
||||
}
|
||||
@ -114,19 +108,17 @@
|
||||
QtSingleApplication app(argc, argv);
|
||||
|
||||
if (app.isRunning())
|
||||
return 0;
|
||||
return !app.sendMessage(someDataString);
|
||||
|
||||
MyMainWidget mmw;
|
||||
|
||||
app.setActivationWindow(&mmw);
|
||||
|
||||
mmw.show();
|
||||
return app.exec();
|
||||
}
|
||||
\endcode
|
||||
|
||||
Once this QtSingleApplication instance is destroyed(for example,
|
||||
when the user quits), when the user next attempts to run the
|
||||
Once this QtSingleApplication instance is destroyed (normally when
|
||||
the process exits or crashes), when the user next attempts to run the
|
||||
application this instance will not, of course, be encountered. The
|
||||
next instance to call isRunning() or sendMessage() will assume the
|
||||
role as the new running instance.
|
||||
@ -144,8 +136,6 @@ void QtSingleApplication::sysInit(const QString &appId)
|
||||
actWin = 0;
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
|
||||
}
|
||||
|
||||
|
||||
@ -179,59 +169,6 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char *
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Creates a QtSingleApplication object. The application identifier
|
||||
will be QCoreApplication::applicationFilePath(). \a argc, \a
|
||||
argv, and \a type are passed on to the QAppliation constructor.
|
||||
*/
|
||||
QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type)
|
||||
: QApplication(argc, argv, type)
|
||||
{
|
||||
sysInit();
|
||||
}
|
||||
|
||||
|
||||
#if defined(Q_WS_X11)
|
||||
/*!
|
||||
Special constructor for X11, ref. the documentation of
|
||||
QApplication's corresponding constructor. The application identifier
|
||||
will be QCoreApplication::applicationFilePath(). \a dpy, \a visual,
|
||||
and \a cmap are passed on to the QApplication constructor.
|
||||
*/
|
||||
QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap)
|
||||
: QApplication(dpy, visual, cmap)
|
||||
{
|
||||
sysInit();
|
||||
}
|
||||
|
||||
/*!
|
||||
Special constructor for X11, ref. the documentation of
|
||||
QApplication's corresponding constructor. The application identifier
|
||||
will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a
|
||||
argv, \a visual, and \a cmap are passed on to the QApplication
|
||||
constructor.
|
||||
*/
|
||||
QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap)
|
||||
: QApplication(dpy, argc, argv, visual, cmap)
|
||||
{
|
||||
sysInit();
|
||||
}
|
||||
|
||||
/*!
|
||||
Special constructor for X11, ref. the documentation of
|
||||
QApplication's corresponding constructor. The application identifier
|
||||
will be \a appId. \a dpy, \a argc, \a
|
||||
argv, \a visual, and \a cmap are passed on to the QApplication
|
||||
constructor.
|
||||
*/
|
||||
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap)
|
||||
: QApplication(dpy, argc, argv, visual, cmap)
|
||||
{
|
||||
sysInit(appId);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
Returns true if another instance of this application is running;
|
||||
otherwise false.
|
||||
@ -267,16 +204,6 @@ bool QtSingleApplication::sendMessage(const QString &message, int timeout)
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
bool QtSingleApplication::sendMessage(const QByteArray &message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
bool QtSingleApplication::sendMessage(const char* message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the application identifier. Two processes with the same
|
||||
@ -303,16 +230,10 @@ QString QtSingleApplication::id() const
|
||||
void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
|
||||
{
|
||||
actWin = aw;
|
||||
if (activateOnMessage) {
|
||||
if (activateOnMessage)
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), this, SLOT(activateWindow()));
|
||||
}
|
||||
else {
|
||||
else
|
||||
disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
|
||||
disconnect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
|
||||
disconnect(peer, SIGNAL(messageReceived(const char*)), this, SLOT(activateWindow()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,55 +1,50 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTSINGLEAPPLICATION_H
|
||||
#define QTSINGLEAPPLICATION_H
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QApplication>
|
||||
|
||||
class QtLocalPeer;
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_WIN32)
|
||||
# if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT)
|
||||
# define QT_QTSINGLEAPPLICATION_EXPORT
|
||||
# elif defined(QT_QTSINGLEAPPLICATION_IMPORT)
|
||||
@ -72,12 +67,6 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication
|
||||
public:
|
||||
QtSingleApplication(int &argc, char **argv, bool GUIenabled = true);
|
||||
QtSingleApplication(const QString &id, int &argc, char **argv);
|
||||
QtSingleApplication(int &argc, char **argv, Type type);
|
||||
#if defined(Q_WS_X11)
|
||||
QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
|
||||
QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
|
||||
QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
|
||||
#endif
|
||||
|
||||
bool isRunning();
|
||||
QString id() const;
|
||||
@ -91,15 +80,11 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
bool sendMessage(const QByteArray &message, int timeout = 5000);
|
||||
bool sendMessage(const char* message, int timeout = 5000);
|
||||
void activateWindow();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
void messageReceived(const QByteArray &message);
|
||||
void messageReceived(const char* message);
|
||||
|
||||
|
||||
private:
|
||||
@ -107,3 +92,5 @@ private:
|
||||
QtLocalPeer *peer;
|
||||
QWidget *actWin;
|
||||
};
|
||||
|
||||
#endif // QTSINGLEAPPLICATION_H
|
||||
|
@ -1,231 +0,0 @@
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.cpp qtsingleapplication/qtlocalpeer.cpp
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.cpp 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtlocalpeer.cpp 2010-07-10 16:26:50.000000000 +0100
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "qtlocalpeer.h"
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QTime>
|
||||
+#include <QtDebug>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtCore/QLibrary>
|
||||
@@ -59,14 +60,12 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
-namespace QtLP_Private {
|
||||
#include "qtlockedfile.cpp"
|
||||
#if defined(Q_OS_WIN)
|
||||
#include "qtlockedfile_win.cpp"
|
||||
#else
|
||||
#include "qtlockedfile_unix.cpp"
|
||||
#endif
|
||||
-}
|
||||
|
||||
const char* QtLocalPeer::ack = "ack";
|
||||
|
||||
@@ -118,7 +117,7 @@
|
||||
if (lockFile.isLocked())
|
||||
return false;
|
||||
|
||||
- if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false))
|
||||
+ if (!lockFile.lock(QtLockedFile::WriteLock, false))
|
||||
return true;
|
||||
|
||||
bool res = server->listen(socketName);
|
||||
@@ -138,6 +137,11 @@
|
||||
|
||||
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
||||
{
|
||||
+ return sendMessage(message.toUtf8(), timeout);
|
||||
+}
|
||||
+
|
||||
+bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
|
||||
+{
|
||||
if (!isClient())
|
||||
return false;
|
||||
|
||||
@@ -160,9 +164,8 @@
|
||||
if (!connOk)
|
||||
return false;
|
||||
|
||||
- QByteArray uMsg(message.toUtf8());
|
||||
QDataStream ds(&socket);
|
||||
- ds.writeBytes(uMsg.constData(), uMsg.size());
|
||||
+ ds.writeBytes(message.constData(), message.size());
|
||||
bool res = socket.waitForBytesWritten(timeout);
|
||||
res &= socket.waitForReadyRead(timeout); // wait for ack
|
||||
res &= (socket.read(qstrlen(ack)) == ack);
|
||||
@@ -195,9 +198,9 @@
|
||||
delete socket;
|
||||
return;
|
||||
}
|
||||
- QString message(QString::fromUtf8(uMsg));
|
||||
socket->write(ack, qstrlen(ack));
|
||||
socket->waitForBytesWritten(1000);
|
||||
delete socket;
|
||||
- emit messageReceived(message); //### (might take a long time to return)
|
||||
+ emit messageReceived(uMsg); //### (might take a long time to return)
|
||||
+ emit messageReceived(QString::fromUtf8(uMsg));
|
||||
}
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.h qtsingleapplication/qtlocalpeer.h
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.h 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtlocalpeer.h 2010-07-10 16:26:16.000000000 +0100
|
||||
@@ -49,9 +49,7 @@
|
||||
#include <QtNetwork/QLocalSocket>
|
||||
#include <QtCore/QDir>
|
||||
|
||||
-namespace QtLP_Private {
|
||||
#include "qtlockedfile.h"
|
||||
-}
|
||||
|
||||
class QtLocalPeer : public QObject
|
||||
{
|
||||
@@ -61,11 +59,13 @@
|
||||
QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
|
||||
bool isClient();
|
||||
bool sendMessage(const QString &message, int timeout);
|
||||
+ bool sendMessage(const QByteArray &message, int timeout);
|
||||
QString applicationId() const
|
||||
{ return id; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
+ void messageReceived(const QByteArray &message);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void receiveConnection();
|
||||
@@ -74,7 +74,7 @@
|
||||
QString id;
|
||||
QString socketName;
|
||||
QLocalServer* server;
|
||||
- QtLP_Private::QtLockedFile lockFile;
|
||||
+ QtLockedFile lockFile;
|
||||
|
||||
private:
|
||||
static const char* ack;
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtlockedfile_win.cpp qtsingleapplication/qtlockedfile_win.cpp
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtlockedfile_win.cpp 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtlockedfile_win.cpp 2010-07-10 16:26:33.000000000 +0100
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
Qt::HANDLE mutex;
|
||||
if (doCreate) {
|
||||
- QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
|
||||
+ QT_WA( { mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16()); },
|
||||
{ mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
if (!mutex) {
|
||||
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
}
|
||||
else {
|
||||
- QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
|
||||
+ QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); },
|
||||
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
if (!mutex) {
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND)
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.cpp qtsingleapplication/qtsingleapplication.cpp
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.cpp 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtsingleapplication.cpp 2010-07-10 16:23:53.000000000 +0100
|
||||
@@ -144,6 +144,7 @@
|
||||
actWin = 0;
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
}
|
||||
|
||||
|
||||
@@ -265,6 +266,11 @@
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
+bool QtSingleApplication::sendMessage(const QByteArray &message, int timeout)
|
||||
+{
|
||||
+ return peer->sendMessage(message, timeout);
|
||||
+}
|
||||
+
|
||||
|
||||
/*!
|
||||
Returns the application identifier. Two processes with the same
|
||||
@@ -291,10 +297,14 @@
|
||||
void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
|
||||
{
|
||||
actWin = aw;
|
||||
- if (activateOnMessage)
|
||||
+ if (activateOnMessage) {
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
|
||||
- else
|
||||
+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
|
||||
+ }
|
||||
+ else {
|
||||
disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
|
||||
+ disconnect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.h qtsingleapplication/qtsingleapplication.h
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.h 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtsingleapplication.h 2010-07-10 16:23:53.000000000 +0100
|
||||
@@ -91,11 +91,13 @@
|
||||
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
+ bool sendMessage(const QByteArray &message, int timeout = 5000);
|
||||
void activateWindow();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
+ void messageReceived(const QByteArray &message);
|
||||
|
||||
|
||||
private:
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.cpp qtsingleapplication/qtsinglecoreapplication.cpp
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.cpp 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtsinglecoreapplication.cpp 2010-07-10 16:32:33.000000000 +0100
|
||||
@@ -81,6 +81,7 @@
|
||||
{
|
||||
peer = new QtLocalPeer(this);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +95,7 @@
|
||||
{
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +135,11 @@
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
+bool QtSingleCoreApplication::sendMessage(const QByteArray &message, int timeout)
|
||||
+{
|
||||
+ return peer->sendMessage(message, timeout);
|
||||
+}
|
||||
+
|
||||
|
||||
/*!
|
||||
Returns the application identifier. Two processes with the same
|
||||
diff -ur /home/david/qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.h qtsingleapplication/qtsinglecoreapplication.h
|
||||
--- /home/david/qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.h 2009-12-16 10:43:33.000000000 +0000
|
||||
+++ qtsingleapplication/qtsinglecoreapplication.h 2010-07-10 16:32:33.000000000 +0100
|
||||
@@ -62,10 +62,12 @@
|
||||
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
+ bool sendMessage(const QByteArray &message, int timeout = 5000);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
+ void messageReceived(const QByteArray &message);
|
||||
|
||||
|
||||
private:
|
@ -1,47 +1,40 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@ -81,8 +74,6 @@ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv)
|
||||
{
|
||||
peer = new QtLocalPeer(this);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
|
||||
}
|
||||
|
||||
|
||||
@ -96,8 +87,6 @@ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc
|
||||
{
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
|
||||
}
|
||||
|
||||
|
||||
@ -137,16 +126,6 @@ bool QtSingleCoreApplication::sendMessage(const QString &message, int timeout)
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
bool QtSingleCoreApplication::sendMessage(const QByteArray &message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
bool QtSingleCoreApplication::sendMessage(const char* message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the application identifier. Two processes with the same
|
||||
|
@ -1,51 +1,46 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** This file is part of a Qt Solutions component.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||
** with the Software or, alternatively, in accordance with the terms
|
||||
** contained in a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain
|
||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
** package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Please note Third Party Software included with Qt Solutions may impose
|
||||
** additional restrictions and it is the user's responsibility to ensure
|
||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
** Solutions Commercial license and the relevant license of the Third
|
||||
** Party Software they are using.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTSINGLECOREAPPLICATION_H
|
||||
#define QTSINGLECOREAPPLICATION_H
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
class QtLocalPeer;
|
||||
|
||||
@ -62,16 +57,14 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
bool sendMessage(const QByteArray &message, int timeout = 5000);
|
||||
bool sendMessage(const char* message, int timeout = 5000);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
void messageReceived(const QByteArray &message);
|
||||
void messageReceived(const char* message);
|
||||
|
||||
|
||||
private:
|
||||
QtLocalPeer* peer;
|
||||
};
|
||||
|
||||
#endif // QTSINGLECOREAPPLICATION_H
|
||||
|
9
3rdparty/qtwin/CMakeLists.txt
vendored
9
3rdparty/qtwin/CMakeLists.txt
vendored
@ -1,9 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(QTWIN-SOURCES
|
||||
qtwin.cpp
|
||||
)
|
||||
|
||||
ADD_LIBRARY(qtwin STATIC
|
||||
${QTWIN-SOURCES}
|
||||
)
|
229
3rdparty/qtwin/qtwin.cpp
vendored
229
3rdparty/qtwin/qtwin.cpp
vendored
@ -1,229 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Use, modification and distribution is allowed without limitation,
|
||||
** warranty, liability or support of any kind.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qtwin.h"
|
||||
#include <QLibrary>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#include <qt_windows.h>
|
||||
|
||||
// Blur behind data structures
|
||||
#define DWM_BB_ENABLE 0x00000001 // fEnable has been specified
|
||||
#define DWM_BB_BLURREGION 0x00000002 // hRgnBlur has been specified
|
||||
#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 // fTransitionOnMaximized has been specified
|
||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E // Composition changed window message
|
||||
|
||||
typedef struct _DWM_BLURBEHIND
|
||||
{
|
||||
DWORD dwFlags;
|
||||
BOOL fEnable;
|
||||
HRGN hRgnBlur;
|
||||
BOOL fTransitionOnMaximized;
|
||||
} DWM_BLURBEHIND, *PDWM_BLURBEHIND;
|
||||
|
||||
typedef struct _MARGINS
|
||||
{
|
||||
int cxLeftWidth;
|
||||
int cxRightWidth;
|
||||
int cyTopHeight;
|
||||
int cyBottomHeight;
|
||||
} MARGINS, *PMARGINS;
|
||||
|
||||
typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled);
|
||||
typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
|
||||
typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
|
||||
typedef HRESULT (WINAPI *PtrDwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend);
|
||||
|
||||
static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled= 0;
|
||||
static PtrDwmEnableBlurBehindWindow pDwmEnableBlurBehindWindow = 0;
|
||||
static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0;
|
||||
static PtrDwmGetColorizationColor pDwmGetColorizationColor = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Internal helper class that notifies windows if the
|
||||
* DWM compositing state changes and updates the widget
|
||||
* flags correspondingly.
|
||||
*/
|
||||
class WindowNotifier : public QWidget
|
||||
{
|
||||
public:
|
||||
WindowNotifier() { winId(); }
|
||||
void addWidget(QWidget *widget) { widgets.append(widget); }
|
||||
void removeWidget(QWidget *widget) { widgets.removeAll(widget); }
|
||||
bool winEvent(MSG *message, long *result);
|
||||
|
||||
private:
|
||||
QWidgetList widgets;
|
||||
};
|
||||
|
||||
static bool resolveLibs()
|
||||
{
|
||||
if (!pDwmIsCompositionEnabled) {
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
pDwmIsCompositionEnabled =(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
|
||||
pDwmExtendFrameIntoClientArea = (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
|
||||
pDwmEnableBlurBehindWindow = (PtrDwmEnableBlurBehindWindow)dwmLib.resolve("DwmEnableBlurBehindWindow");
|
||||
pDwmGetColorizationColor = (PtrDwmGetColorizationColor)dwmLib.resolve("DwmGetColorizationColor");
|
||||
}
|
||||
return pDwmIsCompositionEnabled != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Chekcs and returns true if Windows DWM composition
|
||||
* is currently enabled on the system.
|
||||
*
|
||||
* To get live notification on the availability of
|
||||
* this feature, you will currently have to
|
||||
* reimplement winEvent() on your widget and listen
|
||||
* for the WM_DWMCOMPOSITIONCHANGED event to occur.
|
||||
*
|
||||
*/
|
||||
bool QtWin::isCompositionEnabled()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs()) {
|
||||
HRESULT hr = S_OK;
|
||||
BOOL isEnabled = false;
|
||||
hr = pDwmIsCompositionEnabled(&isEnabled);
|
||||
if (SUCCEEDED(hr))
|
||||
return isEnabled;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Enables Blur behind on a Widget.
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
bool QtWin::enableBlurBehindWindow(QWidget *widget, bool enable,
|
||||
const QRegion ®ion)
|
||||
{
|
||||
Q_ASSERT(widget);
|
||||
bool result = false;
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs()) {
|
||||
DWM_BLURBEHIND bb = {0};
|
||||
HRESULT hr = S_OK;
|
||||
bb.fEnable = enable;
|
||||
bb.dwFlags = DWM_BB_ENABLE;
|
||||
bb.hRgnBlur = NULL;
|
||||
|
||||
if (!region.isEmpty()) {
|
||||
bb.dwFlags |= DWM_BB_BLURREGION;
|
||||
bb.hRgnBlur = region.handle();
|
||||
}
|
||||
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, enable);
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, enable);
|
||||
hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb);
|
||||
if (SUCCEEDED(hr)) {
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* ExtendFrameIntoClientArea.
|
||||
*
|
||||
* This controls the rendering of the frame inside the window.
|
||||
* Note that passing margins of -1 (the default value) will completely
|
||||
* remove the frame from the window.
|
||||
*
|
||||
* \note you should not call enableBlurBehindWindow before calling
|
||||
* this functions
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom)
|
||||
{
|
||||
|
||||
Q_ASSERT(widget);
|
||||
Q_UNUSED(left);
|
||||
Q_UNUSED(top);
|
||||
Q_UNUSED(right);
|
||||
Q_UNUSED(bottom);
|
||||
|
||||
bool result = false;
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs()) {
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
MARGINS m = {left, top, right, bottom};
|
||||
hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m);
|
||||
if (SUCCEEDED(hr)) {
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
}
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, result);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the current colorizationColor for the window.
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
QColor QtWin::colorizatinColor()
|
||||
{
|
||||
QColor resultColor = QApplication::palette().window().color();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs()) {
|
||||
DWORD color = 0;
|
||||
BOOL opaque = FALSE;
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
hr = pDwmGetColorizationColor(&color, &opaque);
|
||||
if (SUCCEEDED(hr))
|
||||
resultColor = QColor(color);
|
||||
}
|
||||
#endif
|
||||
return resultColor;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
WindowNotifier *QtWin::windowNotifier()
|
||||
{
|
||||
static WindowNotifier *windowNotifierInstance = 0;
|
||||
if (!windowNotifierInstance)
|
||||
windowNotifierInstance = new WindowNotifier;
|
||||
return windowNotifierInstance;
|
||||
}
|
||||
|
||||
|
||||
/* Notify all enabled windows that the DWM state changed */
|
||||
bool WindowNotifier::winEvent(MSG *message, long *result)
|
||||
{
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED) {
|
||||
bool compositionEnabled = QtWin::isCompositionEnabled();
|
||||
foreach(QWidget * widget, widgets) {
|
||||
if (widget) {
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled);
|
||||
}
|
||||
widget->update();
|
||||
}
|
||||
}
|
||||
return QWidget::winEvent(message, result);
|
||||
}
|
||||
#endif
|
38
3rdparty/qtwin/qtwin.h
vendored
38
3rdparty/qtwin/qtwin.h
vendored
@ -1,38 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Use, modification and distribution is allowed without limitation,
|
||||
** warranty, liability or support of any kind.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTWIN_H
|
||||
#define QTWIN_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QWidget>
|
||||
/**
|
||||
* This is a helper class for using the Desktop Window Manager
|
||||
* functionality on Windows 7 and Windows Vista. On other platforms
|
||||
* these functions will simply not do anything.
|
||||
*/
|
||||
|
||||
class WindowNotifier;
|
||||
|
||||
class QtWin
|
||||
{
|
||||
public:
|
||||
static bool enableBlurBehindWindow(QWidget *widget, bool enable = true,
|
||||
const QRegion& region = QRegion());
|
||||
static bool extendFrameIntoClientArea(QWidget *widget,
|
||||
int left = -1, int top = -1,
|
||||
int right = -1, int bottom = -1);
|
||||
static bool isCompositionEnabled();
|
||||
static QColor colorizatinColor();
|
||||
|
||||
private:
|
||||
static WindowNotifier *windowNotifier();
|
||||
};
|
||||
|
||||
#endif // QTWIN_H
|
12
3rdparty/qxt/CMakeLists.txt
vendored
12
3rdparty/qxt/CMakeLists.txt
vendored
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
set(QXT-SOURCES
|
||||
@ -10,8 +10,8 @@ set(QXT-MOC-HEADERS
|
||||
qxtglobalshortcut.h
|
||||
)
|
||||
|
||||
find_package(X11)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
|
||||
if(WIN32)
|
||||
set(QXT-SOURCES ${QXT-SOURCES} qxtglobalshortcut_win.cpp)
|
||||
@ -21,9 +21,15 @@ else(WIN32)
|
||||
set(QXT-SOURCES ${QXT-SOURCES} qxtglobalshortcut_x11.cpp)
|
||||
endif(WIN32)
|
||||
|
||||
QT4_WRAP_CPP(QXT-SOURCES-MOC ${QXT-MOC-HEADERS})
|
||||
QT5_WRAP_CPP(QXT-SOURCES-MOC ${QXT-MOC-HEADERS})
|
||||
|
||||
ADD_LIBRARY(qxt STATIC
|
||||
${QXT-SOURCES}
|
||||
${QXT-SOURCES-MOC}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(qxt Qt5::Core Qt5::Widgets)
|
||||
else(WIN32)
|
||||
target_link_libraries(qxt Qt5::Core Qt5::Widgets Qt5::X11Extras)
|
||||
endif(WIN32)
|
||||
|
432
3rdparty/qxt/media-keys.patch
vendored
432
3rdparty/qxt/media-keys.patch
vendored
@ -1,432 +0,0 @@
|
||||
diff -ru libqxt-old/src/gui/keymapper_x11.h libqxt/src/gui/keymapper_x11.h
|
||||
--- libqxt-old/src/gui/keymapper_x11.h 2010-04-21 15:17:56.000000000 +0100
|
||||
+++ libqxt/src/gui/keymapper_x11.h 2010-04-21 15:18:16.000000000 +0100
|
||||
@@ -0,0 +1,364 @@
|
||||
+#ifndef KEYMAPPER_X11_H
|
||||
+#define KEYMAPPER_X11_H
|
||||
+
|
||||
+// (davidsansome) Nicked from qkeymapper_x11.cpp
|
||||
+
|
||||
+#include <Qt>
|
||||
+
|
||||
+#define XK_MISCELLANY
|
||||
+#define XK_LATIN1
|
||||
+#define XK_KOREAN
|
||||
+#define XK_XKB_KEYS
|
||||
+#include <X11/keysymdef.h>
|
||||
+
|
||||
+//
|
||||
+// Keyboard event translation
|
||||
+//
|
||||
+
|
||||
+#ifndef XK_ISO_Left_Tab
|
||||
+#define XK_ISO_Left_Tab 0xFE20
|
||||
+#endif
|
||||
+
|
||||
+#ifndef XK_dead_hook
|
||||
+#define XK_dead_hook 0xFE61
|
||||
+#endif
|
||||
+
|
||||
+#ifndef XK_dead_horn
|
||||
+#define XK_dead_horn 0xFE62
|
||||
+#endif
|
||||
+
|
||||
+#ifndef XK_Codeinput
|
||||
+#define XK_Codeinput 0xFF37
|
||||
+#endif
|
||||
+
|
||||
+#ifndef XK_Kanji_Bangou
|
||||
+#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */
|
||||
+#endif
|
||||
+
|
||||
+// Fix old X libraries
|
||||
+#ifndef XK_KP_Home
|
||||
+#define XK_KP_Home 0xFF95
|
||||
+#endif
|
||||
+#ifndef XK_KP_Left
|
||||
+#define XK_KP_Left 0xFF96
|
||||
+#endif
|
||||
+#ifndef XK_KP_Up
|
||||
+#define XK_KP_Up 0xFF97
|
||||
+#endif
|
||||
+#ifndef XK_KP_Right
|
||||
+#define XK_KP_Right 0xFF98
|
||||
+#endif
|
||||
+#ifndef XK_KP_Down
|
||||
+#define XK_KP_Down 0xFF99
|
||||
+#endif
|
||||
+#ifndef XK_KP_Prior
|
||||
+#define XK_KP_Prior 0xFF9A
|
||||
+#endif
|
||||
+#ifndef XK_KP_Next
|
||||
+#define XK_KP_Next 0xFF9B
|
||||
+#endif
|
||||
+#ifndef XK_KP_End
|
||||
+#define XK_KP_End 0xFF9C
|
||||
+#endif
|
||||
+#ifndef XK_KP_Insert
|
||||
+#define XK_KP_Insert 0xFF9E
|
||||
+#endif
|
||||
+#ifndef XK_KP_Delete
|
||||
+#define XK_KP_Delete 0xFF9F
|
||||
+#endif
|
||||
+
|
||||
+// the next lines are taken from XFree > 4.0 (X11/XF86keysyms.h), defining some special
|
||||
+// multimedia keys. They are included here as not every system has them.
|
||||
+#define XF86XK_Standby 0x1008FF10
|
||||
+#define XF86XK_AudioLowerVolume 0x1008FF11
|
||||
+#define XF86XK_AudioMute 0x1008FF12
|
||||
+#define XF86XK_AudioRaiseVolume 0x1008FF13
|
||||
+#define XF86XK_AudioPlay 0x1008FF14
|
||||
+#define XF86XK_AudioStop 0x1008FF15
|
||||
+#define XF86XK_AudioPrev 0x1008FF16
|
||||
+#define XF86XK_AudioNext 0x1008FF17
|
||||
+#define XF86XK_HomePage 0x1008FF18
|
||||
+#define XF86XK_Calculator 0x1008FF1D
|
||||
+#define XF86XK_Mail 0x1008FF19
|
||||
+#define XF86XK_Start 0x1008FF1A
|
||||
+#define XF86XK_Search 0x1008FF1B
|
||||
+#define XF86XK_AudioRecord 0x1008FF1C
|
||||
+#define XF86XK_Back 0x1008FF26
|
||||
+#define XF86XK_Forward 0x1008FF27
|
||||
+#define XF86XK_Stop 0x1008FF28
|
||||
+#define XF86XK_Refresh 0x1008FF29
|
||||
+#define XF86XK_Favorites 0x1008FF30
|
||||
+#define XF86XK_AudioPause 0x1008FF31
|
||||
+#define XF86XK_AudioMedia 0x1008FF32
|
||||
+#define XF86XK_MyComputer 0x1008FF33
|
||||
+#define XF86XK_OpenURL 0x1008FF38
|
||||
+#define XF86XK_Launch0 0x1008FF40
|
||||
+#define XF86XK_Launch1 0x1008FF41
|
||||
+#define XF86XK_Launch2 0x1008FF42
|
||||
+#define XF86XK_Launch3 0x1008FF43
|
||||
+#define XF86XK_Launch4 0x1008FF44
|
||||
+#define XF86XK_Launch5 0x1008FF45
|
||||
+#define XF86XK_Launch6 0x1008FF46
|
||||
+#define XF86XK_Launch7 0x1008FF47
|
||||
+#define XF86XK_Launch8 0x1008FF48
|
||||
+#define XF86XK_Launch9 0x1008FF49
|
||||
+#define XF86XK_LaunchA 0x1008FF4A
|
||||
+#define XF86XK_LaunchB 0x1008FF4B
|
||||
+#define XF86XK_LaunchC 0x1008FF4C
|
||||
+#define XF86XK_LaunchD 0x1008FF4D
|
||||
+#define XF86XK_LaunchE 0x1008FF4E
|
||||
+#define XF86XK_LaunchF 0x1008FF4F
|
||||
+// end of XF86keysyms.h
|
||||
+
|
||||
+// Special keys used by Qtopia, mapped into the X11 private keypad range.
|
||||
+#define QTOPIAXK_Select 0x11000601
|
||||
+#define QTOPIAXK_Yes 0x11000602
|
||||
+#define QTOPIAXK_No 0x11000603
|
||||
+#define QTOPIAXK_Cancel 0x11000604
|
||||
+#define QTOPIAXK_Printer 0x11000605
|
||||
+#define QTOPIAXK_Execute 0x11000606
|
||||
+#define QTOPIAXK_Sleep 0x11000607
|
||||
+#define QTOPIAXK_Play 0x11000608
|
||||
+#define QTOPIAXK_Zoom 0x11000609
|
||||
+#define QTOPIAXK_Context1 0x1100060A
|
||||
+#define QTOPIAXK_Context2 0x1100060B
|
||||
+#define QTOPIAXK_Context3 0x1100060C
|
||||
+#define QTOPIAXK_Context4 0x1100060D
|
||||
+#define QTOPIAXK_Call 0x1100060E
|
||||
+#define QTOPIAXK_Hangup 0x1100060F
|
||||
+#define QTOPIAXK_Flip 0x11000610
|
||||
+
|
||||
+// keyboard mapping table
|
||||
+static const unsigned int KeyTbl[] = {
|
||||
+
|
||||
+ // misc keys
|
||||
+
|
||||
+ XK_Escape, Qt::Key_Escape,
|
||||
+ XK_Tab, Qt::Key_Tab,
|
||||
+ XK_ISO_Left_Tab, Qt::Key_Backtab,
|
||||
+ XK_BackSpace, Qt::Key_Backspace,
|
||||
+ XK_Return, Qt::Key_Return,
|
||||
+ XK_Insert, Qt::Key_Insert,
|
||||
+ XK_Delete, Qt::Key_Delete,
|
||||
+ XK_Clear, Qt::Key_Delete,
|
||||
+ XK_Pause, Qt::Key_Pause,
|
||||
+ XK_Print, Qt::Key_Print,
|
||||
+ 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq
|
||||
+ 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq
|
||||
+
|
||||
+ // cursor movement
|
||||
+
|
||||
+ XK_Home, Qt::Key_Home,
|
||||
+ XK_End, Qt::Key_End,
|
||||
+ XK_Left, Qt::Key_Left,
|
||||
+ XK_Up, Qt::Key_Up,
|
||||
+ XK_Right, Qt::Key_Right,
|
||||
+ XK_Down, Qt::Key_Down,
|
||||
+ XK_Prior, Qt::Key_PageUp,
|
||||
+ XK_Next, Qt::Key_PageDown,
|
||||
+
|
||||
+ // modifiers
|
||||
+
|
||||
+ XK_Shift_L, Qt::Key_Shift,
|
||||
+ XK_Shift_R, Qt::Key_Shift,
|
||||
+ XK_Shift_Lock, Qt::Key_Shift,
|
||||
+ XK_Control_L, Qt::Key_Control,
|
||||
+ XK_Control_R, Qt::Key_Control,
|
||||
+ XK_Meta_L, Qt::Key_Meta,
|
||||
+ XK_Meta_R, Qt::Key_Meta,
|
||||
+ XK_Alt_L, Qt::Key_Alt,
|
||||
+ XK_Alt_R, Qt::Key_Alt,
|
||||
+ XK_Caps_Lock, Qt::Key_CapsLock,
|
||||
+ XK_Num_Lock, Qt::Key_NumLock,
|
||||
+ XK_Scroll_Lock, Qt::Key_ScrollLock,
|
||||
+ XK_Super_L, Qt::Key_Super_L,
|
||||
+ XK_Super_R, Qt::Key_Super_R,
|
||||
+ XK_Menu, Qt::Key_Menu,
|
||||
+ XK_Hyper_L, Qt::Key_Hyper_L,
|
||||
+ XK_Hyper_R, Qt::Key_Hyper_R,
|
||||
+ XK_Help, Qt::Key_Help,
|
||||
+ 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab
|
||||
+ 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11)
|
||||
+ 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12)
|
||||
+
|
||||
+ // numeric and function keypad keys
|
||||
+
|
||||
+ XK_KP_Space, Qt::Key_Space,
|
||||
+ XK_KP_Tab, Qt::Key_Tab,
|
||||
+ XK_KP_Enter, Qt::Key_Enter,
|
||||
+ //XK_KP_F1, Qt::Key_F1,
|
||||
+ //XK_KP_F2, Qt::Key_F2,
|
||||
+ //XK_KP_F3, Qt::Key_F3,
|
||||
+ //XK_KP_F4, Qt::Key_F4,
|
||||
+ XK_KP_Home, Qt::Key_Home,
|
||||
+ XK_KP_Left, Qt::Key_Left,
|
||||
+ XK_KP_Up, Qt::Key_Up,
|
||||
+ XK_KP_Right, Qt::Key_Right,
|
||||
+ XK_KP_Down, Qt::Key_Down,
|
||||
+ XK_KP_Prior, Qt::Key_PageUp,
|
||||
+ XK_KP_Next, Qt::Key_PageDown,
|
||||
+ XK_KP_End, Qt::Key_End,
|
||||
+ XK_KP_Begin, Qt::Key_Clear,
|
||||
+ XK_KP_Insert, Qt::Key_Insert,
|
||||
+ XK_KP_Delete, Qt::Key_Delete,
|
||||
+ XK_KP_Equal, Qt::Key_Equal,
|
||||
+ XK_KP_Multiply, Qt::Key_Asterisk,
|
||||
+ XK_KP_Add, Qt::Key_Plus,
|
||||
+ XK_KP_Separator, Qt::Key_Comma,
|
||||
+ XK_KP_Subtract, Qt::Key_Minus,
|
||||
+ XK_KP_Decimal, Qt::Key_Period,
|
||||
+ XK_KP_Divide, Qt::Key_Slash,
|
||||
+
|
||||
+ // International input method support keys
|
||||
+
|
||||
+ // International & multi-key character composition
|
||||
+ XK_ISO_Level3_Shift, Qt::Key_AltGr,
|
||||
+ XK_Multi_key, Qt::Key_Multi_key,
|
||||
+ XK_Codeinput, Qt::Key_Codeinput,
|
||||
+ XK_SingleCandidate, Qt::Key_SingleCandidate,
|
||||
+ XK_MultipleCandidate, Qt::Key_MultipleCandidate,
|
||||
+ XK_PreviousCandidate, Qt::Key_PreviousCandidate,
|
||||
+
|
||||
+ // Misc Functions
|
||||
+ XK_Mode_switch, Qt::Key_Mode_switch,
|
||||
+ XK_script_switch, Qt::Key_Mode_switch,
|
||||
+
|
||||
+ // Japanese keyboard support
|
||||
+ XK_Kanji, Qt::Key_Kanji,
|
||||
+ XK_Muhenkan, Qt::Key_Muhenkan,
|
||||
+ //XK_Henkan_Mode, Qt::Key_Henkan_Mode,
|
||||
+ XK_Henkan_Mode, Qt::Key_Henkan,
|
||||
+ XK_Henkan, Qt::Key_Henkan,
|
||||
+ XK_Romaji, Qt::Key_Romaji,
|
||||
+ XK_Hiragana, Qt::Key_Hiragana,
|
||||
+ XK_Katakana, Qt::Key_Katakana,
|
||||
+ XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana,
|
||||
+ XK_Zenkaku, Qt::Key_Zenkaku,
|
||||
+ XK_Hankaku, Qt::Key_Hankaku,
|
||||
+ XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku,
|
||||
+ XK_Touroku, Qt::Key_Touroku,
|
||||
+ XK_Massyo, Qt::Key_Massyo,
|
||||
+ XK_Kana_Lock, Qt::Key_Kana_Lock,
|
||||
+ XK_Kana_Shift, Qt::Key_Kana_Shift,
|
||||
+ XK_Eisu_Shift, Qt::Key_Eisu_Shift,
|
||||
+ XK_Eisu_toggle, Qt::Key_Eisu_toggle,
|
||||
+ //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou,
|
||||
+ //XK_Zen_Koho, Qt::Key_Zen_Koho,
|
||||
+ //XK_Mae_Koho, Qt::Key_Mae_Koho,
|
||||
+ XK_Kanji_Bangou, Qt::Key_Codeinput,
|
||||
+ XK_Zen_Koho, Qt::Key_MultipleCandidate,
|
||||
+ XK_Mae_Koho, Qt::Key_PreviousCandidate,
|
||||
+
|
||||
+#ifdef XK_KOREAN
|
||||
+ // Korean keyboard support
|
||||
+ XK_Hangul, Qt::Key_Hangul,
|
||||
+ XK_Hangul_Start, Qt::Key_Hangul_Start,
|
||||
+ XK_Hangul_End, Qt::Key_Hangul_End,
|
||||
+ XK_Hangul_Hanja, Qt::Key_Hangul_Hanja,
|
||||
+ XK_Hangul_Jamo, Qt::Key_Hangul_Jamo,
|
||||
+ XK_Hangul_Romaja, Qt::Key_Hangul_Romaja,
|
||||
+ //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput,
|
||||
+ XK_Hangul_Codeinput, Qt::Key_Codeinput,
|
||||
+ XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja,
|
||||
+ XK_Hangul_Banja, Qt::Key_Hangul_Banja,
|
||||
+ XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja,
|
||||
+ XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja,
|
||||
+ //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate,
|
||||
+ //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate,
|
||||
+ //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate,
|
||||
+ XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate,
|
||||
+ XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate,
|
||||
+ XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate,
|
||||
+ XK_Hangul_Special, Qt::Key_Hangul_Special,
|
||||
+ //XK_Hangul_switch, Qt::Key_Hangul_switch,
|
||||
+ XK_Hangul_switch, Qt::Key_Mode_switch,
|
||||
+#endif // XK_KOREAN
|
||||
+
|
||||
+ // dead keys
|
||||
+ XK_dead_grave, Qt::Key_Dead_Grave,
|
||||
+ XK_dead_acute, Qt::Key_Dead_Acute,
|
||||
+ XK_dead_circumflex, Qt::Key_Dead_Circumflex,
|
||||
+ XK_dead_tilde, Qt::Key_Dead_Tilde,
|
||||
+ XK_dead_macron, Qt::Key_Dead_Macron,
|
||||
+ XK_dead_breve, Qt::Key_Dead_Breve,
|
||||
+ XK_dead_abovedot, Qt::Key_Dead_Abovedot,
|
||||
+ XK_dead_diaeresis, Qt::Key_Dead_Diaeresis,
|
||||
+ XK_dead_abovering, Qt::Key_Dead_Abovering,
|
||||
+ XK_dead_doubleacute, Qt::Key_Dead_Doubleacute,
|
||||
+ XK_dead_caron, Qt::Key_Dead_Caron,
|
||||
+ XK_dead_cedilla, Qt::Key_Dead_Cedilla,
|
||||
+ XK_dead_ogonek, Qt::Key_Dead_Ogonek,
|
||||
+ XK_dead_iota, Qt::Key_Dead_Iota,
|
||||
+ XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound,
|
||||
+ XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound,
|
||||
+ XK_dead_belowdot, Qt::Key_Dead_Belowdot,
|
||||
+ XK_dead_hook, Qt::Key_Dead_Hook,
|
||||
+ XK_dead_horn, Qt::Key_Dead_Horn,
|
||||
+
|
||||
+ // Special multimedia keys
|
||||
+ // currently only tested with MS internet keyboard
|
||||
+
|
||||
+ // browsing keys
|
||||
+ XF86XK_Back, Qt::Key_Back,
|
||||
+ XF86XK_Forward, Qt::Key_Forward,
|
||||
+ XF86XK_Stop, Qt::Key_Stop,
|
||||
+ XF86XK_Refresh, Qt::Key_Refresh,
|
||||
+ XF86XK_Favorites, Qt::Key_Favorites,
|
||||
+ XF86XK_AudioMedia, Qt::Key_LaunchMedia,
|
||||
+ XF86XK_OpenURL, Qt::Key_OpenUrl,
|
||||
+ XF86XK_HomePage, Qt::Key_HomePage,
|
||||
+ XF86XK_Search, Qt::Key_Search,
|
||||
+
|
||||
+ // media keys
|
||||
+ XF86XK_AudioLowerVolume, Qt::Key_VolumeDown,
|
||||
+ XF86XK_AudioMute, Qt::Key_VolumeMute,
|
||||
+ XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp,
|
||||
+ XF86XK_AudioPlay, Qt::Key_MediaPlay,
|
||||
+ XF86XK_AudioStop, Qt::Key_MediaStop,
|
||||
+ XF86XK_AudioPrev, Qt::Key_MediaPrevious,
|
||||
+ XF86XK_AudioNext, Qt::Key_MediaNext,
|
||||
+ XF86XK_AudioRecord, Qt::Key_MediaRecord,
|
||||
+
|
||||
+ // launch keys
|
||||
+ XF86XK_Mail, Qt::Key_LaunchMail,
|
||||
+ XF86XK_MyComputer, Qt::Key_Launch0,
|
||||
+ XF86XK_Calculator, Qt::Key_Launch1,
|
||||
+ XF86XK_Standby, Qt::Key_Standby,
|
||||
+
|
||||
+ XF86XK_Launch0, Qt::Key_Launch2,
|
||||
+ XF86XK_Launch1, Qt::Key_Launch3,
|
||||
+ XF86XK_Launch2, Qt::Key_Launch4,
|
||||
+ XF86XK_Launch3, Qt::Key_Launch5,
|
||||
+ XF86XK_Launch4, Qt::Key_Launch6,
|
||||
+ XF86XK_Launch5, Qt::Key_Launch7,
|
||||
+ XF86XK_Launch6, Qt::Key_Launch8,
|
||||
+ XF86XK_Launch7, Qt::Key_Launch9,
|
||||
+ XF86XK_Launch8, Qt::Key_LaunchA,
|
||||
+ XF86XK_Launch9, Qt::Key_LaunchB,
|
||||
+ XF86XK_LaunchA, Qt::Key_LaunchC,
|
||||
+ XF86XK_LaunchB, Qt::Key_LaunchD,
|
||||
+ XF86XK_LaunchC, Qt::Key_LaunchE,
|
||||
+ XF86XK_LaunchD, Qt::Key_LaunchF,
|
||||
+
|
||||
+ // Qtopia keys
|
||||
+ QTOPIAXK_Select, Qt::Key_Select,
|
||||
+ QTOPIAXK_Yes, Qt::Key_Yes,
|
||||
+ QTOPIAXK_No, Qt::Key_No,
|
||||
+ QTOPIAXK_Cancel, Qt::Key_Cancel,
|
||||
+ QTOPIAXK_Printer, Qt::Key_Printer,
|
||||
+ QTOPIAXK_Execute, Qt::Key_Execute,
|
||||
+ QTOPIAXK_Sleep, Qt::Key_Sleep,
|
||||
+ QTOPIAXK_Play, Qt::Key_Play,
|
||||
+ QTOPIAXK_Zoom, Qt::Key_Zoom,
|
||||
+ QTOPIAXK_Context1, Qt::Key_Context1,
|
||||
+ QTOPIAXK_Context2, Qt::Key_Context2,
|
||||
+ QTOPIAXK_Context3, Qt::Key_Context3,
|
||||
+ QTOPIAXK_Context4, Qt::Key_Context4,
|
||||
+ QTOPIAXK_Call, Qt::Key_Call,
|
||||
+ QTOPIAXK_Hangup, Qt::Key_Hangup,
|
||||
+ QTOPIAXK_Flip, Qt::Key_Flip,
|
||||
+
|
||||
+ 0, 0
|
||||
+};
|
||||
+
|
||||
+#endif // KEYMAPPER_X11_H
|
||||
diff -ru libqxt-old/src/gui/qxtglobalshortcut_win.cpp libqxt/src/gui/qxtglobalshortcut_win.cpp
|
||||
--- libqxt-old/src/gui/qxtglobalshortcut_win.cpp 2010-04-21 15:17:56.000000000 +0100
|
||||
+++ libqxt/src/gui/qxtglobalshortcut_win.cpp 2010-04-21 15:18:16.000000000 +0100
|
||||
@@ -156,6 +156,21 @@
|
||||
case Qt::Key_Slash:
|
||||
return VK_DIVIDE;
|
||||
|
||||
+ case Qt::Key_MediaNext:
|
||||
+ return VK_MEDIA_NEXT_TRACK;
|
||||
+ case Qt::Key_MediaPrevious:
|
||||
+ return VK_MEDIA_PREV_TRACK;
|
||||
+ case Qt::Key_MediaStop:
|
||||
+ return VK_MEDIA_STOP;
|
||||
+ case Qt::Key_MediaPlay:
|
||||
+ return VK_MEDIA_PLAY_PAUSE;
|
||||
+ case Qt::Key_VolumeDown:
|
||||
+ return VK_VOLUME_DOWN;
|
||||
+ case Qt::Key_VolumeUp:
|
||||
+ return VK_VOLUME_UP;
|
||||
+ case Qt::Key_VolumeMute:
|
||||
+ return VK_VOLUME_MUTE;
|
||||
+
|
||||
// numbers
|
||||
case Qt::Key_0:
|
||||
case Qt::Key_1:
|
||||
diff -ru libqxt-old/src/gui/qxtglobalshortcut_x11.cpp libqxt/src/gui/qxtglobalshortcut_x11.cpp
|
||||
--- libqxt-old/src/gui/qxtglobalshortcut_x11.cpp 2010-04-21 15:17:56.000000000 +0100
|
||||
+++ libqxt/src/gui/qxtglobalshortcut_x11.cpp 2010-04-21 15:18:16.000000000 +0100
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
+#include "keymapper_x11.h"
|
||||
+
|
||||
static int (*original_x_errhandler)(Display* display, XErrorEvent* event);
|
||||
|
||||
static int qxt_x_errhandler(Display* display, XErrorEvent *event)
|
||||
@@ -81,8 +83,25 @@
|
||||
|
||||
quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key)
|
||||
{
|
||||
+ // (davidsansome) Try the table from QKeyMapper first - this seems to be
|
||||
+ // the only way to get Keysyms for the media keys.
|
||||
+ unsigned int keysym = 0;
|
||||
+ int i = 0;
|
||||
+ while (KeyTbl[i]) {
|
||||
+ if (KeyTbl[i+1] == static_cast<uint>(key)) {
|
||||
+ keysym = KeyTbl[i];
|
||||
+ break;
|
||||
+ }
|
||||
+ i += 2;
|
||||
+ }
|
||||
+
|
||||
+ // If that didn't work then fall back on XStringToKeysym
|
||||
+ if (!keysym) {
|
||||
+ keysym = XStringToKeysym(QKeySequence(key).toString().toLatin1().data());
|
||||
+ }
|
||||
+
|
||||
Display* display = QX11Info::display();
|
||||
- return XKeysymToKeycode(display, XStringToKeysym(QKeySequence(key).toString().toLatin1().data()));
|
||||
+ return XKeysymToKeycode(display, keysym);
|
||||
}
|
||||
|
||||
bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user