Removing unneeded stuff
27
AUTHORS
|
@ -1,27 +0,0 @@
|
|||
== main developers ==
|
||||
|
||||
Arvid Picciani <aep@libqxt.org>
|
||||
Adam Higerd <ahigerd@libqxt.org>
|
||||
J-P Nurmi <jpnurmi@libqxt.org>
|
||||
Benjamin Zeller <zbenjamin@libqxt.org>
|
||||
|
||||
== contributors ==
|
||||
|
||||
Gabriel Assis Bezerra
|
||||
Scott Aron Bloom
|
||||
Lawrence Holtsclaw
|
||||
Marcin Jakubowski
|
||||
Dominique Leducq
|
||||
Marcus Lindblom
|
||||
Konstantin Molchanov
|
||||
Thomas Mueller
|
||||
Bjørn Erik Nilsen
|
||||
Kaleb Pederson
|
||||
Matthew Schnee
|
||||
André Somers
|
||||
Alex Unden
|
||||
Chris Vickery
|
||||
Benjamin Wohlwend
|
||||
|
||||
thanks everyone not named for all the patches, bug reports,
|
||||
beta tests, and the free beer :-)
|
114
CHANGES
|
@ -1,114 +0,0 @@
|
|||
LibQxt 0.7.0 introduces new features and contains bug fixes to the 0.6.x
|
||||
series. For more details, see the documentation included in this package
|
||||
or online at http://docs.libqxt.org.
|
||||
|
||||
0.7.0
|
||||
-----
|
||||
- QxtNetwork
|
||||
* Added QxtPop3
|
||||
|
||||
|
||||
0.6.0
|
||||
-----
|
||||
- QxtCore
|
||||
* Added QxtModelSerializer
|
||||
* Removed obsolete QxtSemaphore
|
||||
|
||||
- QxtGui
|
||||
* Added rich text support to QxtItemDelegate
|
||||
* Removed obsolete QxtTabWidget::TabMovementMode & QxtTabBar
|
||||
* Removed obsolete QxtDockWidget
|
||||
* Revised QxtConfigDialog & QxtConfigWidget
|
||||
* Enhanced QxtWindowSystem::idleTime() to resolve libXss at run-time
|
||||
|
||||
- Added QxtZeroConf module
|
||||
|
||||
0.5.0
|
||||
-----
|
||||
|
||||
- General
|
||||
* Added LGPL license option
|
||||
* Run Krazy checks and fixed found issues
|
||||
* Improved configure.bat
|
||||
* Added missing export macros
|
||||
* Added missing convenience headers
|
||||
* Improved compatibility
|
||||
- QT_FORWARD_DECLARE_CLASS
|
||||
- Q_SLOTS, Q_SIGNALS & Q_FOREACH in headers
|
||||
- interface
|
||||
|
||||
- QxtCore
|
||||
* Revised QxtFifo
|
||||
* Added QxtAlgorithms
|
||||
* Added QxtSerialDevice
|
||||
* Added QxtSlotMapper
|
||||
|
||||
- QxtCrypto
|
||||
* Revised QxtBlowfish
|
||||
|
||||
- QxtGui
|
||||
* Added QxtWindowSystem::idleTime()
|
||||
* Added QxtCrumbView
|
||||
* Improved QxtScheduleView
|
||||
* Added QxtSortFilterProxyModel
|
||||
* Improved QxtSpanSlider
|
||||
- Added QxtSpanSlider::HandleMovementMode
|
||||
* Improved QxtItemDelegate
|
||||
- Added ProgressMinimumRole & ProgressMaximumRole
|
||||
- Added support for busy indicator mode
|
||||
* Improved QxtLetterBoxWidget
|
||||
- Added QxtLetterBoxWidget::margin
|
||||
- Added QxtLetterBoxWidget::resizeWidget
|
||||
|
||||
- QxtWeb
|
||||
* Added QxtWebCgiService
|
||||
|
||||
0.4.0
|
||||
-----
|
||||
|
||||
- QxtCore
|
||||
* Added QxtDeplex
|
||||
* Added QxtLocale
|
||||
* Added QxtPointerList
|
||||
* Added QxtMultiSignalWaiter
|
||||
* Added QxtSignalGroup
|
||||
* Added QxtCommandOptions
|
||||
* Added QxtLogger
|
||||
* Added QxtAbstractConnectionManager
|
||||
* Added QxtDataStreamSignalSerializer
|
||||
* Added QxtAbstractSignalSerializer
|
||||
|
||||
- QxtCrypto
|
||||
* Added QxtHmac
|
||||
|
||||
- QxtGui
|
||||
* Added QxtItemEditorCreatorBase
|
||||
* Added QxtStandardItemEditorCreator
|
||||
* Added QxtItemEditorCreator
|
||||
* Added QxtBaseSpinBox
|
||||
* Added QxtCountryComboBox
|
||||
* Added QxtCountryModel
|
||||
* Added QxtLanguageComboBox
|
||||
* Added QxtScheduleView
|
||||
* Added QxtTabBar
|
||||
* Added QxtFlowView
|
||||
* Added QxtLetterBoxWidget
|
||||
* Improved QxtTabWidget
|
||||
- Added QxtTabWidget::alwaysShowTabBar
|
||||
- Added QxtTabWidget::tabAnimation
|
||||
- Added QxtTabWidget::tabMovementMode
|
||||
* Improved QxtConfirmationMessage
|
||||
- Added QxtConfirmationMessage::settingsFormat
|
||||
- Added QxtConfirmationMessage::rememberOnReject
|
||||
- Added QxtConfirmationMessage::overrideSettingsApplication
|
||||
- Added QxtConfirmationMessage::overrideSettingsKey
|
||||
- Added QxtConfirmationMessage::overrideSettingsOrganization
|
||||
|
||||
- QxtBerkeley
|
||||
* Added QxtBdbTree
|
||||
|
||||
- QxtWeb
|
||||
* Revised the whole module
|
||||
|
||||
- QxtNetwork
|
||||
* Added QxtTcpConnectionManager
|
52
README
|
@ -1,52 +0,0 @@
|
|||
1) configure
|
||||
|
||||
make sure qmake is in your PATH and run ./configure or configure.bat on windows.
|
||||
|
||||
see configure --help for more information
|
||||
|
||||
(for msvc you could try ./configure.bat -msvc and open
|
||||
the solution file in msvc, we recomend compiling on
|
||||
commandline though)
|
||||
|
||||
2) build
|
||||
|
||||
type make or nmake when using msvc
|
||||
then don't forget to make install
|
||||
Note: This will also install qxt.prf to your qtdir/mkspecs/features directory.
|
||||
|
||||
|
||||
|
||||
3) use
|
||||
|
||||
Add the following lines to your qmake project file:
|
||||
CONFIG += qxt
|
||||
QXT += core gui
|
||||
|
||||
The QXT variable should contain the modules you want. (In this example core and gui are used.)
|
||||
Note: Some modules depend on other modules. The required modules are added automatically.
|
||||
|
||||
if you have an existing msvc project and can't swtich to qmake you can use zbenjamins solution:
|
||||
|
||||
Howto use libqxt in a existing Visual Studio Project:
|
||||
1. create and install libqxt. (See install instructions)
|
||||
2. add {libqxtinstalldir}\include\qxt\QxtCore to your include path
|
||||
3. add {libqxtinstalldir}\lib to your library search path
|
||||
4. to add a specific libqxt module (f.e QxtSql) you have to:
|
||||
- add {libqxtinstalldir}\include\qxt\QxtSql to your include path
|
||||
- add the library QxtSql.lib to your project
|
||||
Most of the times you have also to include the QxtCore and QxtKit modules.
|
||||
It's done the same way like the example above.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Building packages (Linux/Unix - experimental):
|
||||
|
||||
To build packages for Redhat or Debian based distributions, you can utilize
|
||||
the "rpm" or "deb" make targets. Perform the configure as outlined above,
|
||||
edit the "config" file in the packages subdirectory if needed and then type
|
||||
"make rpm" or "make deb" as appropriate. This will also perform a "make clean"
|
||||
to avoid copying files which will be rebuilt anyway.
|
||||
|
||||
For RPM packages, you will need a standard .rpmmacros file in your home
|
||||
directory. A sample file, "rpmmacros-sample", is contained in the packages
|
||||
directory and must be edited for your environment before use.
|
|
@ -1,8 +0,0 @@
|
|||
CONFIG -= app_bundle
|
||||
TEMPLATE = app
|
||||
TARGET = db
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
SOURCES += main.cpp
|
||||
!win32:LIBS+=-ldb
|
||||
QT=core
|
|
@ -1,26 +0,0 @@
|
|||
#include <db.h>
|
||||
|
||||
#if DB_VERSION_MAJOR < 4
|
||||
#error db>=4.4 required
|
||||
#endif
|
||||
|
||||
#if DB_VERSION_MAJOR < 5
|
||||
|
||||
#if DB_VERSION_MINOR < 4
|
||||
#error db>=4.4 required
|
||||
#endif
|
||||
|
||||
#if DB_VERSION_MINOR < 6
|
||||
#warning db < 4.6, some features will be disabled
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
int main (int,char**)
|
||||
{
|
||||
DB * db;
|
||||
db_create(&db, NULL, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#include <openssl/blowfish.h>
|
||||
|
||||
int main(int,char**)
|
||||
{
|
||||
BF_KEY key;
|
||||
unsigned char * foo=(unsigned char *)"hello world";
|
||||
BF_set_key(&key, 1,foo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
win32:include(../../depends.pri)
|
||||
TEMPLATE = app
|
||||
TARGET = openssl
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
SOURCES += main.cpp
|
||||
!win32:LIBS+= -lcrypto -lssl
|
||||
QT=core
|
||||
CONFIG -= app_bundle
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#include <QObject>
|
||||
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#error needs qt4
|
||||
#endif
|
||||
|
||||
|
||||
int main (int,char**)
|
||||
{
|
||||
QObject();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
TEMPLATE = app
|
||||
TARGET = qt4
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
SOURCES += main.cpp
|
||||
QT=core
|
||||
CONFIG -= app_bundle
|
|
@ -1,11 +0,0 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int major;
|
||||
int minor;
|
||||
Display* display = XOpenDisplay(0);
|
||||
XRRQueryVersion(display, &major, &minor);
|
||||
return 0;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
win32:include(../../depends.pri)
|
||||
TEMPLATE = app
|
||||
TARGET = xrandr
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
SOURCES += main.cpp
|
||||
!win32:LIBS+=-lXrandr
|
|
@ -1,7 +0,0 @@
|
|||
#include <X11/extensions/scrnsaver.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
XScreenSaverAllocInfo();
|
||||
return 0;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
win32:include(../../depends.pri)
|
||||
CONFIG -= app_bundle
|
||||
TEMPLATE = app
|
||||
TARGET = xss
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
SOURCES += main.cpp
|
||||
!win32:LIBS+=-lXss
|
|
@ -1,6 +0,0 @@
|
|||
#include <dns_sd.h>
|
||||
|
||||
int main(int, char**) {
|
||||
char buffer[kDNSServiceMaxDomainName];
|
||||
return DNSServiceConstructFullName(buffer, 0, "_foo._tcp", "domain");
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
unix:!macx:LIBS += -ldns_sd
|
||||
win32:LIBS += -ldnssd
|
||||
CONFIG -= app_bundle
|
||||
TEMPLATE = app
|
||||
TARGET = zeroconf
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
SOURCES += zeroconf.cpp
|
||||
QT=core
|
||||
CONFIG -= app_bundle
|
|
@ -1,292 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# defaults
|
||||
QMAKE_BIN=qmake
|
||||
WHICH=which
|
||||
NO_DB=0
|
||||
NO_ZEROCONF=0
|
||||
NO_OPENSSL=0
|
||||
NO_XRANDR=0
|
||||
QXT_MODULES="docs berkeley core designer widgets network sql web zeroconf"
|
||||
|
||||
# detect platform
|
||||
if uname -a | grep -iq Darwin; then
|
||||
QXT_MAC=1
|
||||
DEFAULT_LIBS="/Library/Frameworks"
|
||||
QMAKE_PARAMS="-spec macx-g++"
|
||||
NO_XRANDR=1
|
||||
else
|
||||
QXT_MAC=0
|
||||
DEFAULT_LIBS="PREFIX/lib"
|
||||
QMAKE_PARAMS=""
|
||||
fi
|
||||
|
||||
# working directories
|
||||
QXT_SOURCE_TREE=`dirname $0`
|
||||
QXT_SOURCE_TREE=`(cd "$QXT_SOURCE_TREE"; /bin/pwd)`
|
||||
QXT_BUILD_TREE=`/bin/pwd`
|
||||
[ ! -d $QXT_BUILD_TREE/features ] && mkdir $QXT_BUILD_TREE/features
|
||||
[ ! -d $QXT_BUILD_TREE/examples ] && mkdir $QXT_BUILD_TREE/examples
|
||||
[ ! -d $QXT_BUILD_TREE/tests ] && mkdir $QXT_BUILD_TREE/tests
|
||||
|
||||
# output files
|
||||
CONFIG_LOG=$QXT_BUILD_TREE/config.log
|
||||
QMAKE_CACHE=$QXT_BUILD_TREE/.qmake.cache
|
||||
QXT_VARS=$QXT_BUILD_TREE/features/qxtvars.prf
|
||||
[ -f $CONFIG_LOG ] && mv $CONFIG_LOG $CONFIG_LOG.bak
|
||||
[ -f $QMAKE_CACHE ] && mv $QMAKE_CACHE $QMAKE_CACHE.bak
|
||||
[ -f $QXT_VARS ] && mv $QXT_VARS $QXT_VARS.bak
|
||||
|
||||
# colors
|
||||
C_RED='\e[1;31m'
|
||||
C_BLUE='\e[1;34m'
|
||||
C_GREEN='\e[1;32m'
|
||||
C_CYAN='\e[1;36m'
|
||||
C_NONE='\e[0m'
|
||||
|
||||
# defaults
|
||||
echo "CONFIG += silent" > $QMAKE_CACHE
|
||||
echo "QXT_MODULES = $QXT_MODULES" >> $QMAKE_CACHE
|
||||
echo "QXT_MODULES = $QXT_MODULES" > $QXT_VARS
|
||||
|
||||
# parse configure options
|
||||
while (( $# > 0 )); do
|
||||
if [ $1 == "-qmake-bin" ]; then
|
||||
QMAKE_BIN=$2; shift
|
||||
elif [ $1 == "-L" ]; then
|
||||
echo "LIBS += -L$2" >> $QMAKE_CACHE;shift
|
||||
elif [ $1 == "-l" ]; then
|
||||
echo "LIBS += -l$2" >> $QMAKE_CACHE;shift
|
||||
elif [ $1 == "-I" ]; then
|
||||
echo "INCLUDEPATH += $2" >> $QMAKE_CACHE;shift
|
||||
elif [ $1 == "-bootstrap" ]; then
|
||||
echo "CONFIG += bootstrap" >> $QMAKE_CACHE; shift
|
||||
elif [ $1 == "-nomake" ]; then
|
||||
echo "QXT_MODULES -= $2" >> $QMAKE_CACHE
|
||||
echo "QXT_MODULES -= $2" >> $QXT_VARS; shift
|
||||
elif [ $1 == "-prefix" ]; then
|
||||
QXT_INSTALL_PREFIX=$2; shift
|
||||
elif [ $1 == "-libdir" ]; then
|
||||
QXT_INSTALL_LIBS=$2; shift
|
||||
elif [ $1 == "-docdir" ]; then
|
||||
QXT_INSTALL_DOCS=$2; shift
|
||||
elif [ $1 == "-headerdir" ]; then
|
||||
QXT_INSTALL_HEADERS=$2; shift
|
||||
elif [ $1 == "-bindir" ]; then
|
||||
QXT_INSTALL_BINS=$2; shift
|
||||
elif [ $1 == "-featuredir" ]; then
|
||||
QXT_INSTALL_FEATURES=$2; shift
|
||||
elif [ $1 == "-static" ]; then
|
||||
echo "CONFIG += static staticlib" >> $QMAKE_CACHE
|
||||
echo "DEFINES += QXT_STATIC" >> $QXT_VARS
|
||||
elif [ $1 == "-debug" ]; then
|
||||
echo "CONFIG += debug" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_TYPE = debug" >> $QXT_VARS
|
||||
elif [ $1 == "-release" ]; then
|
||||
echo "CONFIG += release" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_TYPE = release" >> $QXT_VARS
|
||||
elif [ $1 == "-no-db" ]; then
|
||||
NO_DB=1
|
||||
elif [ $1 == "-no-xrandr" ]; then
|
||||
NO_XRANDR=1
|
||||
elif [ $1 == "-no-zeroconf" ]; then
|
||||
NO_ZEROCONF=1
|
||||
elif [ $1 == "-no-openssl" ]; then
|
||||
NO_OPENSSL=1
|
||||
elif [ $1 == "-no-avahi" ]; then
|
||||
echo "CONFIG += NO_AVAHI" >> $QMAKE_CACHE
|
||||
elif [ $1 == "-verbose" ]; then
|
||||
echo "CONFIG -= silent" >> $QMAKE_CACHE
|
||||
elif [ $1 == "-qws" ]; then
|
||||
echo "CONFIG += qws" >> $QMAKE_CACHE
|
||||
elif [ $1 == "-coverage" ]; then
|
||||
echo "CONFIG += coverage" >> $QMAKE_CACHE
|
||||
elif [ $1 == "-universal" ]; then
|
||||
echo "CONFIG += x86 ppc" >> $QMAKE_CACHE
|
||||
elif [ $1 == "-arch" ]; then
|
||||
echo "CONFIG += $2" >> $QMAKE_CACHE
|
||||
shift
|
||||
elif [ $1 == "-sdk" ]; then
|
||||
echo "QMAKE_MAC_SDK=$2" >> $QMAKE_CACHE; shift
|
||||
elif [ $1 == "-h" ] || [ $1 == "-help" ] || [ $1 == "--help" ]; then
|
||||
echo "Usage: configure [-prefix <dir>] [-libdir <dir>] [-docdir <dir>]"
|
||||
echo " [-bindir <dir>] [-headerdir <dir>] [-featuredir <dir> ]"
|
||||
echo " [-qmake-bin <path>] [-static] [-debug] [-release]"
|
||||
echo " [-no-db] [-no-zeroconf] [-nomake <module>]"
|
||||
if [[ "$QXT_MAC" == "0" ]]; then
|
||||
echo -n " [-no-xrandr] [-qws]"
|
||||
else
|
||||
echo -n " [-universal] [-arch <arch>] [-sdk <path>]"
|
||||
fi
|
||||
echo " [-verbose] [-coverage]"
|
||||
echo
|
||||
echo "Installation options:"
|
||||
echo
|
||||
echo "-prefix <dir> ....... This will install everything relative to <dir>"
|
||||
echo " default: /usr/local/Qxt"
|
||||
echo "-libdir <dir> ....... Libraries will be installed to <dir>"
|
||||
echo " default: $DEFAULT_LIBS"
|
||||
echo "-docdir <dir> ....... Documentation will be installed to <dir>"
|
||||
echo " default: PREFIX/doc"
|
||||
echo "-bindir <dir> ....... Executables will be installed to <dir>"
|
||||
echo " default: PREFIX/bin"
|
||||
echo "-headerdir <dir> .... Include files will be installed to <dir>"
|
||||
echo " default: PREFIX/include"
|
||||
echo "-featuredir <dir> ... Feature files will be installed to <dir>"
|
||||
echo " default: QMAKE_MKSPECS/features"
|
||||
echo "-qmake-bin <path> ... Specifies the path to the qmake executable"
|
||||
echo " default: search the system path"
|
||||
echo "-L <path> ........... Specifies the a additional library search path"
|
||||
echo "-I <path> ........... Specifies the a additional include search path"
|
||||
echo "-l <path> ........... Add a custom library"
|
||||
echo "-static ............. Build Qxt as a static library"
|
||||
echo "-debug .............. Build Qxt with debugging symbols"
|
||||
echo "-release ............ Build Qxt without debugging support"
|
||||
if [[ "$QXT_MAC" != "1" ]]; then
|
||||
echo "-qws ................ Build for Qt/Embedded"
|
||||
echo "-no-xrandr ......... Do not link to Xrandr"
|
||||
fi
|
||||
echo "-no-db .............. Do not link to Berkeley DB"
|
||||
echo "-no-zeroconf ........ Do not link to Zeroconf"
|
||||
echo "-no-openssl ......... Do not link to Openssl"
|
||||
echo "-no-avahi ........... Apple mdns-sd instead of avahi even on linux"
|
||||
echo "-nomake <module> .... Do not compile the specified module"
|
||||
echo " options: $QXT_MODULES"
|
||||
echo "-verbose ............ Show full compiler output"
|
||||
echo "-coverage ........... Collect coverage information"
|
||||
if [[ "$QXT_MAC" == "1" ]]; then
|
||||
echo "-universal .......... Equivalent to -arch ppc -arch x86"
|
||||
echo "-arch <arch> ........ Include <arch> in universal binary"
|
||||
echo "-sdk <path> ......... Use a different Mac SDK"
|
||||
fi
|
||||
|
||||
[ -f $CONFIG_LOG.bak ] && mv $CONFIG_LOG.bak $CONFIG_LOG
|
||||
[ -f $QMAKE_CACHE.bak ] && mv $QMAKE_CACHE.bak $QMAKE_CACHE
|
||||
[ -f $QXT_VARS.bak ] && mv $QXT_VARS.bak $QXT_VARS
|
||||
exit
|
||||
else
|
||||
echo "Unrecognized configure option: $1"
|
||||
[ -f $CONFIG_LOG.bak ] && mv $CONFIG_LOG.bak $CONFIG_LOG
|
||||
[ -f $QMAKE_CACHE.bak ] && mv $QMAKE_CACHE.bak $QMAKE_CACHE
|
||||
[ -f $QXT_VARS.bak ] && mv $QXT_VARS.bak $QXT_VARS
|
||||
exit
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
# detect qmake
|
||||
if ! $WHICH $QMAKE_BIN >>$CONFIG_LOG 2>&1; then
|
||||
echo >&2 "You don't seem to have 'qmake' in your PATH."
|
||||
echo >&2 "Cannot proceed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# default directories
|
||||
if [[ "$QXT_INSTALL_PREFIX" == "" ]]; then
|
||||
QXT_INSTALL_PREFIX="/usr/local/Qxt"
|
||||
fi
|
||||
if [[ "$QXT_INSTALL_LIBS" == "" ]]; then
|
||||
if [[ "$QXT_MAC" == "1" ]]; then
|
||||
QXT_INSTALL_LIBS="/Library/Frameworks"
|
||||
else
|
||||
QXT_INSTALL_LIBS="$QXT_INSTALL_PREFIX/lib"
|
||||
fi
|
||||
fi
|
||||
if [[ "$QXT_INSTALL_DOCS" == "" ]]; then
|
||||
QXT_INSTALL_DOCS="$QXT_INSTALL_PREFIX/doc"
|
||||
fi
|
||||
if [[ "$QXT_INSTALL_HEADERS" == "" ]]; then
|
||||
QXT_INSTALL_HEADERS="$QXT_INSTALL_PREFIX/include"
|
||||
fi
|
||||
if [[ "$QXT_INSTALL_BINS" == "" ]]; then
|
||||
QXT_INSTALL_BINS="$QXT_INSTALL_PREFIX/bin"
|
||||
fi
|
||||
if [[ "$QXT_INSTALL_FEATURES" == "" ]]; then
|
||||
QXT_INSTALL_FEATURES=`$QMAKE_BIN -query QMAKE_MKSPECS`
|
||||
[ "$QXT_INSTALL_FEATURES" == "**Unknown**" ] && QXT_INSTALL_FEATURES=`$QMAKE_BIN -query QT_HOST_DATA`/mkspecs
|
||||
QXT_INSTALL_FEATURES="$QXT_INSTALL_FEATURES/features"
|
||||
fi
|
||||
|
||||
# output variables
|
||||
echo "QXT_INSTALL_PREFIX = $QXT_INSTALL_PREFIX" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_PREFIX = $QXT_INSTALL_PREFIX" >> $QXT_VARS
|
||||
echo "QXT_INSTALL_LIBS = $QXT_INSTALL_LIBS" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_LIBS = $QXT_INSTALL_LIBS" >> $QXT_VARS
|
||||
echo "QXT_INSTALL_BINS = $QXT_INSTALL_BINS" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_BINS = $QXT_INSTALL_BINS" >> $QXT_VARS
|
||||
echo "QXT_INSTALL_HEADERS = $QXT_INSTALL_HEADERS" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_HEADERS = $QXT_INSTALL_HEADERS" >> $QXT_VARS
|
||||
echo "QXT_INSTALL_FEATURES = $QXT_INSTALL_FEATURES" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_FEATURES = $QXT_INSTALL_FEATURES" >> $QXT_VARS
|
||||
echo "QXT_INSTALL_DOCS = $QXT_INSTALL_DOCS" >> $QMAKE_CACHE
|
||||
echo "QXT_INSTALL_DOCS = $QXT_INSTALL_DOCS" >> $QXT_VARS
|
||||
echo "QXT_SOURCE_TREE = $QXT_SOURCE_TREE" >> $QMAKE_CACHE
|
||||
echo "QXT_BUILD_TREE = $QXT_BUILD_TREE" >> $QMAKE_CACHE
|
||||
|
||||
# detect make
|
||||
echo>$CONFIG_LOG
|
||||
if [ -z "$MAKE" ]; then
|
||||
MAKE=
|
||||
for mk in gmake make; do
|
||||
if "$WHICH" $mk 2>&1| grep -qv "no "; then
|
||||
MAKE=`$WHICH $mk`
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$MAKE" ]; then
|
||||
echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
|
||||
echo >&2 "Cannot proceed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# detect dependencies
|
||||
configtest()
|
||||
{
|
||||
echo -en "Checking for $1 "
|
||||
echo -e " \n\n $1\n" >>$CONFIG_LOG
|
||||
mkdir -p "$QXT_BUILD_TREE/config.tests/$1"
|
||||
cd "$QXT_BUILD_TREE/config.tests/$1"
|
||||
$QMAKE_BIN $QMAKE_PARAMS "$QXT_SOURCE_TREE/config.tests/$1/$1.pro" >>$CONFIG_LOG
|
||||
echo -n "."
|
||||
$MAKE clean >>$CONFIG_LOG 2>&1
|
||||
[ -f ./$1 ] && rm ./$1
|
||||
echo -n "."
|
||||
$MAKE >>$CONFIG_LOG 2>&1 >>$CONFIG_LOG 2>&1
|
||||
if [ -x $1 ] ; then
|
||||
echo -e >&2 " [${C_GREEN}success${C_NONE}] "
|
||||
echo "DEFINES+=HAVE_$2">>$QMAKE_CACHE
|
||||
else
|
||||
echo -e >&2 " [${C_RED}failure${C_NONE}] "
|
||||
fi
|
||||
}
|
||||
|
||||
echo >&2 "Testing for optional external libraries."
|
||||
echo >&2 "If tests fail, some features will not be available."
|
||||
|
||||
configtest qt4 QT
|
||||
if [[ "$NO_DB" == "0" ]]; then
|
||||
configtest db DB
|
||||
fi
|
||||
|
||||
if [[ "$NO_OPENSSL" == "0" ]]; then
|
||||
configtest openssl OPENSSL
|
||||
fi
|
||||
|
||||
if [[ "$QXT_MAC" == "0" ]]; then
|
||||
if [[ "$NO_XRANDR" == "0" ]]; then
|
||||
configtest xrandr XRANDR
|
||||
fi
|
||||
|
||||
if [[ "$NO_ZEROCONF" == "0" ]]; then
|
||||
configtest zeroconf ZEROCONF
|
||||
fi
|
||||
else
|
||||
echo "DEFINES+=HAVE_ZEROCONF">>$QMAKE_CACHE
|
||||
fi
|
||||
|
||||
# run qmake
|
||||
echo "Autodetection finished. Running qmake."
|
||||
cd $QXT_BUILD_TREE
|
||||
$QMAKE_BIN $QMAKE_PARAMS "$QXT_SOURCE_TREE/libqxt.pro" -recursive >>$CONFIG_LOG
|
||||
echo -e >&2 "${C_CYAN}Configure finished. Run $MAKE now.${C_NONE}\n"
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
this=$(dirname $(readlink -f $0))
|
||||
|
||||
premake=
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux)
|
||||
case "$(uname -m)" in
|
||||
x86_64)
|
||||
premake=${this}/premake/premake4.x86_64
|
||||
;;
|
||||
*86*)
|
||||
premake=${this}/premake/premake4.i686
|
||||
;;
|
||||
*)
|
||||
echo "we have no premake binary for architecture $(uname -m), "\
|
||||
"you'll have to build your own premake4. sorry."
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Darwin)
|
||||
premake=${this}/premake/premake4.darwin
|
||||
;;
|
||||
*)
|
||||
echo "we have no premake binary for system $(uname -s), "\
|
||||
"you'll have to build your own premake4. sorry."
|
||||
;;
|
||||
esac
|
||||
|
||||
${premake} --file=${this}/premake/premake4.lua --to=$(pwd) $@
|
||||
|
364
configure.bat
|
@ -1,364 +0,0 @@
|
|||
@ECHO off
|
||||
|
||||
@rem -- defaults
|
||||
set QMAKE_BIN=qmake
|
||||
set MAKE_BIN=
|
||||
set STATIC=0
|
||||
set DEBUG_OR_RELEASE=0
|
||||
set MSVCMODE=
|
||||
set DB=1
|
||||
set ZEROCONF=1
|
||||
set QXT_MODULES=docs core widgets network sql web designer berkeley zeroconf
|
||||
|
||||
@rem -- initialize
|
||||
set QXT_INSTALL_PREFIX=
|
||||
set QXT_INSTALL_LIBS=
|
||||
set QXT_INSTALL_BINS=
|
||||
set QXT_INSTALL_HEADERS=
|
||||
set QXT_INSTALL_FEATURES=
|
||||
set QXT_INSTALL_DOCS=
|
||||
|
||||
@rem -- working directories
|
||||
set QXT_BUILD_TREE=%CD%
|
||||
cd "%0\..\"
|
||||
SET QXT_SOURCE_TREE=%CD%
|
||||
cd %QXT_BUILD_TREE%
|
||||
if not exist %QXT_BUILD_TREE%\features mkdir %QXT_BUILD_TREE%\features >NUL 2>&1
|
||||
if not exist %QXT_BUILD_TREE%\examples mkdir %QXT_BUILD_TREE%\examples >NUL 2>&1
|
||||
if not exist %QXT_BUILD_TREE%\tests mkdir %QXT_BUILD_TREE%\tests >NUL 2>&1
|
||||
|
||||
@rem -- output files
|
||||
set CONFIG_LOG=%QXT_BUILD_TREE%\config.log
|
||||
set QMAKE_CACHE=%QXT_BUILD_TREE%\.qmake.cache
|
||||
set QXT_VARS=%QXT_BUILD_TREE%\features\qxtvars.prf
|
||||
if exist %CONFIG_LOG% move %CONFIG_LOG% %CONFIG_LOG%.bak >NUL 2>&1
|
||||
if exist %QMAKE_CACHE% move %QMAKE_CACHE% %QMAKE_CACHE%.bak >NUL 2>&1
|
||||
if exist %QXT_VARS% move %QXT_VARS% %QXT_VARS%.bak >NUL 2>&1
|
||||
|
||||
@rem -- defaults
|
||||
echo CONFIG += silent > %QMAKE_CACHE%
|
||||
echo QXT_MODULES = %QXT_MODULES% >> %QMAKE_CACHE%
|
||||
echo QXT_MODULES = %QXT_MODULES% > %QXT_VARS%
|
||||
|
||||
shift
|
||||
:top
|
||||
if "%0" == "" goto finish
|
||||
if "%0" == "-qmake-bin" goto setqmake
|
||||
if "%0" == "-make-bin" goto setmake
|
||||
if "%0" == "-I" goto addinclude
|
||||
if "%0" == "-L" goto addlibpath
|
||||
if "%0" == "-l" goto addlib
|
||||
if "%0" == "-nomake" goto nomake
|
||||
if "%0" == "-prefix" goto prefix
|
||||
if "%0" == "-libdir" goto libdir
|
||||
if "%0" == "-docdir" goto docdir
|
||||
if "%0" == "-headerdir" goto headerdir
|
||||
if "%0" == "-bindir" goto bindir
|
||||
if "%0" == "-featuredir" goto featuredir
|
||||
if "%0" == "-static" goto static
|
||||
if "%0" == "-debug" goto debug
|
||||
if "%0" == "-release" goto release
|
||||
if "%0" == "-debug_and_release" goto debug_and_release
|
||||
if "%0" == "-no-db" goto nodb
|
||||
if "%0" == "-msvc" goto msvc
|
||||
if "%0" == "/help" goto help
|
||||
if "%0" == "-help" goto help
|
||||
if "%0" == "--help" goto help
|
||||
if "%0" == "/?" goto help
|
||||
|
||||
echo Unrecognized configure option: %0
|
||||
del %QMAKE_CACHE%
|
||||
del %QXT_VARS%
|
||||
goto end
|
||||
|
||||
:setqmake
|
||||
set QMAKE_BIN=%1
|
||||
goto bottom2
|
||||
|
||||
:setmake
|
||||
set MAKE_BIN=%1
|
||||
goto bottom2
|
||||
|
||||
:addinclude
|
||||
set QXT_INCPATH=%1
|
||||
set QXT_INCPATH=%QXT_INCPATH:\=/%
|
||||
echo INCLUDEPATH += %QXT_INCPATH% >> %QMAKE_CACHE%
|
||||
goto bottom2
|
||||
|
||||
:addlibpath
|
||||
set QXT_LIBPATH=%1
|
||||
set QXT_LIBPATH=%QXT_LIBPATH:\=/%
|
||||
echo LIBS += -L%QXT_LIBPATH% >> %QMAKE_CACHE%
|
||||
goto bottom2
|
||||
|
||||
:addlib
|
||||
echo LIBS += -l%1 >> %QMAKE_CACHE%
|
||||
goto bottom2
|
||||
|
||||
:nomake
|
||||
if "%1"=="db" set DB=0
|
||||
if "%1"=="zeroconf" set ZEROCONF=0
|
||||
echo QXT_MODULES -= %1 >> %QMAKE_CACHE%
|
||||
echo QXT_MODULES -= %1 >> %QXT_VARS%
|
||||
goto bottom2
|
||||
|
||||
:prefix
|
||||
echo hmm
|
||||
set QXT_INSTALL_PREFIX=%1
|
||||
goto bottom2
|
||||
|
||||
:libdir
|
||||
set QXT_INSTALL_LIBS=%1
|
||||
goto bottom2
|
||||
|
||||
:docdir
|
||||
set QXT_INSTALL_DOCS=%1
|
||||
goto bottom2
|
||||
|
||||
:headerdir
|
||||
set QXT_INSTALL_HEADERS=%1
|
||||
goto bottom2
|
||||
|
||||
:bindir
|
||||
set QXT_INSTALL_BINS=%1
|
||||
goto bottom2
|
||||
|
||||
:featuredir
|
||||
set QXT_INSTALL_FEATURES=%1
|
||||
goto bottom2
|
||||
|
||||
:static
|
||||
set STATIC=1
|
||||
echo CONFIG += static staticlib >> %QMAKE_CACHE%
|
||||
echo DEFINES += QXT_STATIC >> %QXT_VARS%
|
||||
goto bottom
|
||||
|
||||
:debug
|
||||
set DEBUG_OR_RELEASE=1
|
||||
echo CONFIG += debug >> %QMAKE_CACHE%
|
||||
goto bottom
|
||||
|
||||
:release
|
||||
set DEBUG_OR_RELEASE=1
|
||||
echo CONFIG += release >> %QMAKE_CACHE%
|
||||
goto bottom
|
||||
|
||||
:debug_and_release
|
||||
set DEBUG_OR_RELEASE=1
|
||||
echo CONFIG += debug_and_release build_all >> %QMAKE_CACHE%
|
||||
goto bottom
|
||||
|
||||
:nodb
|
||||
set DB=0
|
||||
echo DEFINES -= HAVE_DB >> %QMAKE_CACHE%
|
||||
goto bottom
|
||||
|
||||
:nozeroconf
|
||||
set ZEROCONF=0
|
||||
echo DEFINES -= HAVE_ZEROCONF >> %QMAKE_CACHE%
|
||||
goto bottom
|
||||
|
||||
:msvc
|
||||
set MSVCMODE=-tp vc
|
||||
goto bottom
|
||||
|
||||
:bottom2
|
||||
shift
|
||||
:bottom
|
||||
shift
|
||||
goto top
|
||||
|
||||
:help
|
||||
echo Usage: configure [-prefix (dir)] [-libdir (dir)] [-docdir (dir)]
|
||||
echo [-bindir (dir)] [-headerdir (dir)] [-qmake-bin (path)]
|
||||
echo [-make-bin (path)] [-nomake (module)] [-debug] [-release]
|
||||
echo [-static]
|
||||
echo.
|
||||
echo Installation options:
|
||||
echo.
|
||||
echo -prefix (dir) ....... This will install everything relative to (dir)
|
||||
echo default: C:\libqxt
|
||||
echo -libdir (dir) ....... Libraries will be installed to (dir)
|
||||
echo default: PREFIX/lib
|
||||
echo -docdir (dir) ....... Documentation will be installed to (dir)
|
||||
echo default: PREFIX/share/doc
|
||||
echo -bindir (dir) ....... Executables will be installed to (dir)
|
||||
echo default: PREFIX/bin
|
||||
echo -headerdir (dir) .... Include files will be installed to (dir)
|
||||
echo default: PREFIX/include
|
||||
echo -qmake-bin (path) ... Specifies the path to the qmake executable
|
||||
echo default: search the system path
|
||||
echo -make-bin (path) .... Specifies the path to the make executable
|
||||
echo default: search the system path
|
||||
echo -featuredir (dir) ... Specifies the path to the features directory
|
||||
echo qt4 default: the result of qmake -query QMAKE_MKSPECS
|
||||
echo qt5 default: the result of qmake -query QT_HOST_DATA + \mkspecs
|
||||
echo -L (path)............ Specifies the a additional library search path
|
||||
echo -I (path)............ Specifies the a additional include search path
|
||||
echo -l (path)............ Add a custom library
|
||||
echo -static ............. Compile Qxt as a static library
|
||||
echo -debug .............. Build Qxt with debugging symbols
|
||||
echo -release ............ Build Qxt without debugging support
|
||||
echo -debug_and_release .. Build Qxt with and without debugging support
|
||||
echo -no-db .............. Do not link to Berkeley DB
|
||||
echo -nomake (module) .... Do not compile the specified module
|
||||
echo options: %QXT_MODULES%
|
||||
|
||||
del %QMAKE_CACHE%
|
||||
goto end
|
||||
|
||||
:finish
|
||||
echo Testing for qmake...
|
||||
%QMAKE_BIN% -v >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto qmakeERR
|
||||
goto qmakeOK
|
||||
:qmakeERR
|
||||
echo You don't seem to have 'qmake' in your PATH.
|
||||
echo Cannot proceed.
|
||||
goto end
|
||||
|
||||
:qmakeOK
|
||||
if not "%MAKE_BIN%" == "" goto detectTools_end_test_make
|
||||
if "%QMAKESPEC%" == "win32-msvc" goto testnmake
|
||||
if "%QMAKESPEC%" == "win32-msvc.net" goto testnmake
|
||||
if "%QMAKESPEC%" == "win32-msvc2005" goto testnmake
|
||||
if "%QMAKESPEC%" == "win32-msvc2008" goto testnmake
|
||||
|
||||
:testmingw
|
||||
echo Testing for mingw32-make...
|
||||
call mingw32-make -v >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto testnmake
|
||||
echo Using mingw32-make.
|
||||
SET MAKE_BIN=mingw32-make
|
||||
GOTO detectTools_end_test_make
|
||||
|
||||
:testnmake
|
||||
if "%QMAKESPEC%" == "win32-g++" goto testgmake
|
||||
echo Testing for nmake...
|
||||
nmake /? >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto testgmake
|
||||
echo Using nmake.
|
||||
SET MAKE_BIN=nmake
|
||||
GOTO detectTools_end_test_make
|
||||
|
||||
:testgmake
|
||||
echo Testing for GNU make...
|
||||
call make -v >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto missingmake
|
||||
echo Using GNU make.
|
||||
SET MAKE_BIN=make
|
||||
GOTO detectTools_end_test_make
|
||||
|
||||
:missingmake
|
||||
echo You don't seem to have 'mingw32-make', 'nmake' or 'make' in your PATH.
|
||||
echo Cannot proceed.
|
||||
goto end
|
||||
|
||||
:detectTools_end_test_make
|
||||
if not "%QXT_INSTALL_PREFIX%" == "" goto skipdefaultprefix
|
||||
set QXT_INSTALL_PREFIX=C:\Qxt
|
||||
:skipdefaultprefix
|
||||
if not "%QXT_INSTALL_LIBS%" == "" goto skipdefaultlibs
|
||||
set QXT_INSTALL_LIBS=%QXT_INSTALL_PREFIX%\lib
|
||||
:skipdefaultlibs
|
||||
if not "%QXT_INSTALL_DOCS%" == "" goto skipdefaultdocs
|
||||
set QXT_INSTALL_DOCS=%QXT_INSTALL_PREFIX%\doc
|
||||
:skipdefaultdocs
|
||||
if not "%QXT_INSTALL_HEADERS%" == "" goto skipdefaultheaders
|
||||
set QXT_INSTALL_HEADERS=%QXT_INSTALL_PREFIX%\include
|
||||
:skipdefaultheaders
|
||||
if not "%QXT_INSTALL_BINS%" == "" goto skipdefaultbins
|
||||
set QXT_INSTALL_BINS=%QXT_INSTALL_PREFIX%\bin
|
||||
:skipdefaultbins
|
||||
if not "%QXT_INSTALL_FEATURES%" == "" goto skipdefaultfeatures
|
||||
%QMAKE_BIN% -query QMAKE_MKSPECS > %QXT_BUILD_TREE%\mkspecs.tmp
|
||||
set /p QXT_INSTALL_FEATURES=<%QXT_BUILD_TREE%\mkspecs.tmp
|
||||
if "%QXT_INSTALL_FEATURES%" == "**Unknown**" %QMAKE_BIN% -query QT_HOST_DATA > %QXT_BUILD_TREE%\mkspecs.tmp & set /p QXT_INSTALL_FEATURES=<%QXT_BUILD_TREE%\mkspecs.tmp & set QXT_INSTALL_FEATURES=<%QXT_INSTALL_FEATURES%\mkspecs\
|
||||
if "%QXT_INSTALL_FEATURES%" == "**Unknown**" echo "Cannot find mkspecs directory. Cannot proceed." & goto end
|
||||
set QXT_INSTALL_FEATURES=%QXT_INSTALL_FEATURES%\features
|
||||
del %QXT_BUILD_TREE%\mkspecs.tmp
|
||||
:skipdefaultfeatures
|
||||
|
||||
echo QXT_INSTALL_PREFIX = %QXT_INSTALL_PREFIX:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_INSTALL_PREFIX = %QXT_INSTALL_PREFIX:\=/% >> %QXT_VARS%
|
||||
echo QXT_INSTALL_LIBS = %QXT_INSTALL_LIBS:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_INSTALL_LIBS = %QXT_INSTALL_LIBS:\=/% >> %QXT_VARS%
|
||||
echo QXT_INSTALL_BINS = %QXT_INSTALL_BINS:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_INSTALL_BINS = %QXT_INSTALL_BINS:\=/% >> %QXT_VARS%
|
||||
echo QXT_INSTALL_HEADERS = %QXT_INSTALL_HEADERS:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_INSTALL_HEADERS = %QXT_INSTALL_HEADERS:\=/% >> %QXT_VARS%
|
||||
echo QXT_INSTALL_FEATURES = %QXT_INSTALL_FEATURES:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_INSTALL_FEATURES = %QXT_INSTALL_FEATURES:\=/% >> %QXT_VARS%
|
||||
echo QXT_INSTALL_DOCS = %QXT_INSTALL_DOCS:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_INSTALL_DOCS = %QXT_INSTALL_DOCS:\=/% >> %QXT_VARS%
|
||||
echo QXT_SOURCE_TREE = %QXT_SOURCE_TREE:\=/% >> %QMAKE_CACHE%
|
||||
echo QXT_BUILD_TREE = %QXT_BUILD_TREE:\=/% >> %QMAKE_CACHE%
|
||||
|
||||
echo Testing for optional external libraries.
|
||||
echo If tests fail, some features will not be available.
|
||||
|
||||
:detectdb
|
||||
if "%DB%"=="0" goto detectzeroconf
|
||||
echo Testing for Berkeley DB...
|
||||
echo BDB... >> %CONFIG_LOG%
|
||||
if not exist %QXT_BUILD_TREE%\config.tests\db mkdir %QXT_BUILD_TREE%\config.tests\db
|
||||
cd %QXT_BUILD_TREE%\config.tests\db
|
||||
%QMAKE_BIN% %QXT_SOURCE_TREE%\config.tests\db\db.pro >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto dbfailed
|
||||
call %MAKE_BIN% clean >> %CONFIG_LOG% 2>&1
|
||||
call %MAKE_BIN% >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto dbfailed
|
||||
set DB=1
|
||||
echo DEFINES += HAVE_DB >> %QMAKE_CACHE%
|
||||
echo Berkeley DB enabled.
|
||||
goto detectzeroconf
|
||||
|
||||
:dbfailed
|
||||
set DB=0
|
||||
echo DEFINES -= HAVE_DB >> %QMAKE_CACHE%
|
||||
echo Berkeley DB disabled.
|
||||
|
||||
:detectzeroconf
|
||||
if "%ZEROCONF%"=="0" goto alltestsok
|
||||
echo Testing for Zero Conf...
|
||||
echo ZEROCONF... >> %CONFIG_LOG%
|
||||
if not exist %QXT_BUILD_TREE%\config.tests\zeroconf mkdir %QXT_BUILD_TREE%\config.tests\zeroconf
|
||||
cd %QXT_BUILD_TREE%\config.tests\zeroconf
|
||||
%QMAKE_BIN% %QXT_SOURCE_TREE%\config.tests\zeroconf\zeroconf.pro >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto zeroconffailed
|
||||
call %MAKE_BIN% clean >> %CONFIG_LOG% 2>&1
|
||||
call %MAKE_BIN% >> %CONFIG_LOG% 2>&1
|
||||
if errorlevel 1 goto zeroconffailed
|
||||
set ZEROCONF=1
|
||||
echo DEFINES += HAVE_ZEROCONF >> %QMAKE_CACHE%
|
||||
echo Zero Conf enabled.
|
||||
goto alltestsok
|
||||
|
||||
:zeroconffailed
|
||||
set ZEROCONF=0
|
||||
echo DEFINES -= HAVE_ZEROCONF >> %QMAKE_CACHE%
|
||||
echo Zero Conf disabled.
|
||||
|
||||
:alltestsok
|
||||
if "%DEBUG_OR_RELEASE%"=="1" goto skiprelease
|
||||
echo CONFIG += release >> %QMAKE_CACHE%
|
||||
:skiprelease
|
||||
|
||||
echo Configuration successful.
|
||||
echo Generating makefiles...
|
||||
cd %QXT_BUILD_TREE%
|
||||
%QMAKE_BIN% %MSVCMODE% -recursive %QXT_SOURCE_TREE%\libqxt.pro
|
||||
if errorlevel 1 goto mainqmakeERR
|
||||
|
||||
if not "%MSVCMODE%" == "" goto skipmakeannounce
|
||||
echo Makefiles generated. Run %MAKE_BIN% now.
|
||||
goto end
|
||||
:skipmakeannounce
|
||||
echo Visual Studio solution generated. Open libqxt.sln in Visual Studio.
|
||||
goto end
|
||||
|
||||
:mainqmakeERR
|
||||
echo Error running qmake. Cannot proceed.
|
||||
goto end
|
||||
|
||||
:end
|
46
doc/doc.pri
|
@ -1,46 +0,0 @@
|
|||
SUBDIRS += tools/3rdparty/qdoc3
|
||||
|
||||
win32 {
|
||||
QXT_WINCONFIG = release/
|
||||
!CONFIG(release, debug|release) {
|
||||
QXT_WINCONFIG = debug/
|
||||
}
|
||||
}
|
||||
|
||||
win32:!win32-g++ {
|
||||
unixstyle = false
|
||||
} else :win32-g++:isEmpty(QMAKE_SH) {
|
||||
unixstyle = false
|
||||
} else {
|
||||
unixstyle = true
|
||||
}
|
||||
|
||||
$$unixstyle {
|
||||
QDOC = QXT_SOURCE_TREE=$$QXT_SOURCE_TREE QXT_BUILD_TREE=$$QXT_BUILD_TREE $$QXT_BUILD_TREE/tools/3rdparty/qdoc3/$${QXT_WINCONFIG}qdoc3
|
||||
} else {
|
||||
QDOC = set QXT_SOURCE_TREE=$$QXT_SOURCE_TREE&& set QXT_BUILD_TREE=$$QXT_BUILD_TREE&& $$QXT_BUILD_TREE/tools/3rdparty/qdoc3/$${QXT_WINCONFIG}qdoc3.exe
|
||||
QDOC = $$replace(QDOC, "/", "\\\\")
|
||||
}
|
||||
|
||||
adp_docs.commands = ($$QDOC -DQXT_DOXYGEN_RUN $$QXT_SOURCE_TREE/doc/src/qxt.qdocconf)
|
||||
adp_docs.depends += sub-tools-3rdparty-qdoc3
|
||||
docs.depends = adp_docs
|
||||
QMAKE_EXTRA_TARGETS += adp_docs docs
|
||||
|
||||
htmldocs.files = $$QXT_BUILD_TREE/doc/html/*
|
||||
htmldocs.path = $$QXT_INSTALL_DOCS
|
||||
htmldocs.CONFIG += no_check_exist
|
||||
|
||||
INSTALLS += htmldocs
|
||||
|
||||
exists( $$[QT_INSTALL_BINS]/qhelpgenerator) {
|
||||
QHELPGENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator
|
||||
qch_docs.commands = $$QHELPGENERATOR $$QXT_BUILD_TREE/doc/html/qxt.qhp -o $$QXT_BUILD_TREE/doc/qch/qxt.qch
|
||||
qch_docs.depends = adp_docs
|
||||
docs.depends += qch_docs
|
||||
QMAKE_EXTRA_TARGETS += qch_docs
|
||||
qchdocs.files= $$QXT_BUILD_TREE/doc/qch/qxt.qch
|
||||
qchdocs.path = $$QXT_INSTALL_DOCS
|
||||
qchdocs.CONFIG += no_check_exist
|
||||
INSTALLS += qchdocs
|
||||
}
|
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 252 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 9.8 KiB |
|
@ -1,145 +0,0 @@
|
|||
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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 the LibQxt project 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 <COPYRIGHT HOLDER> 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.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
/*!
|
||||
\module QxtCore
|
||||
\title QxtCore Module
|
||||
\keyword QxtCore
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtCore module extends QtCore and contains core non-GUI functionality.
|
||||
|
||||
All other Qt modules rely on this module. To include the
|
||||
definitions of the module's classes, use the following directive:
|
||||
|
||||
\code
|
||||
#include <QxtCore>
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\module QxtGui
|
||||
\title QxtGui Module
|
||||
\keyword QxtGui
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtGui module extends QxtCore and QtGui.
|
||||
|
||||
To include the definitions of both Qxt modules' classes, use the
|
||||
following directive:
|
||||
|
||||
\code
|
||||
QXT = core gui
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\module QxtBerkeley
|
||||
\title QxtBerkeley Module
|
||||
\keyword QxtBerkeley
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtBerkeley module provides a Qt interface to the Berkeley DB.
|
||||
|
||||
berkeley db is in wide use where relational databases, especially SQL, are not desired due to heavy overhead or its programming complexity. QxtBerkeley provides you an extremly easy to use interface to the fast and stable file based berkeley database. The API is designed after Qts tulip container classes.
|
||||
|
||||
<h2>Platform specific notes</h2>
|
||||
<h3>Windows</h3>
|
||||
On Windows the buildsystem is unfortunately unable to detect the berkeley db library on your system automatically, because of the wide differences in naming scheme.
|
||||
<br>
|
||||
You will have to add the library yourself:
|
||||
<br>
|
||||
MSVC:
|
||||
\code
|
||||
configure.bat -I C:\BDB-MSVC\include -L C:\BDB-MSVC\lib -l libdb46 (or libdb45)
|
||||
\endcode
|
||||
|
||||
MinGW (http://mathieu.carbou.free.fr/wiki/index.php?title=Berkeley_DB_for_MinGW)
|
||||
\code
|
||||
configure.bat -I C:\BDB-MINGW\include -L C:\BDB-MINGW\lib -l db
|
||||
\endcode
|
||||
<h3>Linux</h3>
|
||||
If you have issues compiling QxtBerkeley with your distributions bdb package, it is suggested that you try the upstream version from http://www.oracle.com/technology/software/products/berkeley-db/index.html
|
||||
*/
|
||||
|
||||
/*!
|
||||
\module QxtNetwork
|
||||
\title QxtNetwork Module
|
||||
\keyword QxtNetwork
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtNetwork module extends QtNetwork
|
||||
*/
|
||||
|
||||
/*!
|
||||
\module QxtSql
|
||||
\title QxtSql Module
|
||||
\keyword QxtSql
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtSql module extends QtSql with serializable queries.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\module QxtWeb
|
||||
\title QxtWeb Module
|
||||
\keyword QxtWeb
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtWeb module provides tools for creating web services using Qt.
|
||||
|
||||
QxtWeb provides tools for creating event-driven web services using Qt.
|
||||
|
||||
The general usage pattern is as follows:
|
||||
|
||||
\list
|
||||
\o Create a QxtAbstractWebSessionManager object, such as QxtHttpSessionManager, for each protocol that can interface to the service.
|
||||
\o If using QxtHttpSessionManager, select a connector plugin, such as QxtHttpServerConnector.
|
||||
\o Register a QxtAbstractWebService factory. The factory is invoked each time a new session is created and returns a service object
|
||||
for that session. QxtWebServiceDirectory allows you to register multiple services and selects between them based on the path.
|
||||
\o Invoke QxtAbstractWebSessionManager::start() to begin accepting connections.
|
||||
\endlist
|
||||
|
||||
When a new visitor connects who does not belong to a session, a new service instance is created. When a request is received, a
|
||||
QxtAbstractWebService::pageRequestedEvent() is dispatched to the service. When the service is ready to respond to the request, it posts
|
||||
a QxtWebPageEvent to the session manager. This is done asynchronously; there is no requirement that the pageRequestedEvent handler
|
||||
must respond to the request before the function ends, but such a response must eventually be posted or the web browser will eventually
|
||||
time out.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\module QxtZeroconf
|
||||
\title QxtZeroconf Module
|
||||
\keyword QxtZeroconf
|
||||
\ingroup modules
|
||||
|
||||
\brief The QxtZeroconf module implements configure free service discovery
|
||||
*/
|
|
@ -1,271 +0,0 @@
|
|||
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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 the LibQxt project 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 <COPYRIGHT HOLDER> 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.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
/*!
|
||||
\page index.html
|
||||
|
||||
\keyword Qxt Reference Documentation
|
||||
\title Qxt Reference Documentation
|
||||
|
||||
Qxt, an extension library for Qt, provides a suite of cross-platform utility classes to add functionality not readily available in the Qt toolkit by Nokia.
|
||||
|
||||
\raw HTML
|
||||
<table cellpadding="2" cellspacing="1" border="0" width="100%" bgcolor="#e5e5e5">
|
||||
<tr>
|
||||
<th bgcolor="#66b036" width="50%">
|
||||
Getting Started
|
||||
</th>
|
||||
<th bgcolor="#66b036" width="50%">
|
||||
Api Reference
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<ul>
|
||||
<li><a href="http://dev.libqxt.org/libqxt/wiki/user_guide">User Guide</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<ul>
|
||||
<li><a href="modules.html">Modules</a></li>
|
||||
<li><a href="classes.html">Classes</a></li>
|
||||
<li><a href="namespaces.html">Namespaces</a></li>
|
||||
<li><a href="functions.html">Functions</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th bgcolor="#66b036">
|
||||
Technologies
|
||||
</th>
|
||||
<th bgcolor="#66b036">
|
||||
About
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<ul>
|
||||
<li><a href="tech-ipc.html">Inter-Process Communication</a></li>
|
||||
<li><a href="tech-web.html">Create Web Services with Qxt</a></li>
|
||||
<li><a href="tech-zeroconf.html">Configure free service discovery</a></li>
|
||||
<li><a href="tech-log.html">Pluggable Logging Framework</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<ul>
|
||||
<li><a href="http://www.libqxt.org">About Qxt</a></li>
|
||||
<li><a href="http://www.qtsoftware.com/products">About Qt</a></li>
|
||||
<!--
|
||||
<li><a href="supported-platforms.html">Supported Platforms</a></li>
|
||||
--!>
|
||||
<li><a href="http://dev.libqxt.org/libqxt/issues/new/">Report a bug</a></li>
|
||||
<li><a href="http://dev.libqxt.org/libqxt/wiki/libqxt_developer_guide">How to Contribute</a></li>
|
||||
<li><a href="http://www.opensource.org/licenses/cpl1.0.php">IBM CPL</a>, <a href="http://www.opensource.org/licenses/lgpl-2.1.php">GNU LGPL</a></li>
|
||||
<!--
|
||||
<li><a href="3rdparty.html">Third-Party Licenses Used in Qxt</a></li>
|
||||
<li><a href="licenses.html">Other Licenses Used in Qxt</a></li>
|
||||
<li><a href="credits.html">Credits</a></li>
|
||||
-->
|
||||
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
\endraw
|
||||
*/
|
||||
|
||||
/*!
|
||||
\group modules
|
||||
\title Qxt's Modules
|
||||
|
||||
Qxt consists of several modules, each of which lives in a
|
||||
separate library:
|
||||
|
||||
\table 80%
|
||||
\row \o \l{QxtBerkeley} \o The QxtBerkeley module provides a Qt interface to the Berkeley DB.
|
||||
\row \o \l{QxtCore} \o The QxtCore module extends QtCore and contains core non-GUI functionality.
|
||||
\row \o \l{QxtGui} \o The QxtGui module extends QxtCore and QtGui.
|
||||
\row \o \l{QxtNetwork} \o The QxtNetwork module extends QtNetwork with RPC functionality.
|
||||
\row \o \l{QxtSql} \o The QxtSql module extends QtSql with serializable queries.
|
||||
\row \o \l{QxtWeb} \o The QxtWeb module provides tools for creating web services using Qt.
|
||||
\row \o \l{QxtZeroconf} \o Qxt QxtZeroconf module implements configure free service discovery
|
||||
\endtable
|
||||
|
||||
|
||||
To use one of these modules, add them to the QXT variable in your qmake project (.pro) file. For example:
|
||||
|
||||
\code
|
||||
CONFIG += qxt
|
||||
QXT += network
|
||||
\endcode
|
||||
|
||||
The QxtCore and QxtGui
|
||||
modules are included by default. To link only against QxtCore, do this:
|
||||
|
||||
\code
|
||||
QXT = core
|
||||
\endcode
|
||||
|
||||
\sa {Qxt's Classes}, {Qxt's Namespaces}, {Qxt's Functions}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page classes.html
|
||||
\title Qxt's Classes
|
||||
\ingroup classlists
|
||||
|
||||
This is a list of all Qxt classes.
|
||||
|
||||
\generatelist classes
|
||||
|
||||
\sa {Qxt's Modules}, {Qxt's Namespaces}, {Qxt's Functions}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page namespaces.html
|
||||
\title Qxt's Namespaces
|
||||
\ingroup classlists
|
||||
|
||||
This is a list of the main namespaces in Qxt.
|
||||
|
||||
\generatelist{namespaces}
|
||||
|
||||
\sa {Qxt's Modules}, {Qxt's Classes}, {Qxt's Functions}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page functions.html
|
||||
\title Qxt's Functions
|
||||
\ingroup classlists
|
||||
|
||||
This is a list of all Qxt functions.
|
||||
|
||||
\generatelist functionindex
|
||||
|
||||
\sa {Qxt's Modules}, {Qxt's Classes}, {Qxt's Namespaces}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\page tech-ipc.html
|
||||
\title Inter-Process Communication
|
||||
|
||||
|
||||
Qxt provides you with a range of IPC Implementations for different use cases.
|
||||
|
||||
|
||||
\raw HTML
|
||||
<h3>Qt Signals and Slots over the air</h3>
|
||||
<p>
|
||||
<a href="qxtrpcservice.html">QxtRpcService</a> provides a facility to use Qt signals and slots over any QIODevice.
|
||||
It let's you connect two QObjects on the fly and marshals arguments for you. If all you want is a quick and easy solution to connect
|
||||
two Qt programs, QxtRpcService is for you.<br />
|
||||
On top of that, <a href="qxtrpcpeer.html">QxtRpcPeer</a> provides a higher level implementation over TCP connections.
|
||||
</p>
|
||||
<h3>Qt in the cloud. Xml and Json rpcs</h3>
|
||||
<p>
|
||||
If you want to connect your qt program to an existing web service in the cloud, qxt provides ready implementations of common http based protocols.<br>
|
||||
<ul>
|
||||
<li><a href="qxtxmlrpcclient.html">QxtXmlRpcClient</a> implements XML-RPC </li>
|
||||
<li><a href="qxtjsonrpcclient.html">QxtJSONRpcClient</a> implements JSON-RPC </li>
|
||||
</ul>
|
||||
</p>
|
||||
\endraw
|
||||
|
||||
\sa {QxtNetwork}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\page tech-web.html
|
||||
\title Web Service Framework
|
||||
|
||||
\raw HTML
|
||||
<p>
|
||||
Webkit brings the Web to Qt, and <a href="qxtweb.html">QxtWeb</a> brings Qt to the web.
|
||||
It lets you create web services within the Qt Toolkit. Typicall you'd implement a "Website", but its flexible
|
||||
enough to to let you mix websites with other content, other connection protocols, and other clients.
|
||||
</p>
|
||||
<h3>Sessions</h3>
|
||||
<p>
|
||||
At first, there is a QxtAbstractWebSessionManager. Typically you would use a QxtHttpSessionManager which utilizes http cookies,
|
||||
but it is entirely possible to use different session techniques. The session manager starts a session either by just asigning it a number you can later use
|
||||
to identify sessions, or by instantiation a session stack (if you set serviceFactory). The former is more like the traditional webapp flow, where a request
|
||||
does not leave any traces other then some persisted session data, after it is handled. The later technique leaves qobjects in the main memory for the time
|
||||
of the session. They can handle background tasks for the specific session, and even later notify the session user asyncronously. However, it does come at a cost.
|
||||
</p>
|
||||
<h3>Connectors. Protocol implementations.</h3>
|
||||
<p>
|
||||
Qxt can connect your services with a range of protocols. Currently those are <a href="qxthttpserverconnector.html"> Http</a> and <a href="qxtscgiserverconnector.html"> Scgi</a>. It is not recommended to run the http connector directly as a frontend service on the internet. Instead use it for development, or on embedded devices within a trusted network. Scgi allows easy integration into frontend servers, such as apaches httpd.
|
||||
</p>
|
||||
<h3>The Services.</h3>
|
||||
<p>
|
||||
Finally, you will want to implement one or many <a href="qxtabstractwebservice.html"> QxtAbstractWebService</a> which handle the actual requests from clients.
|
||||
Your service then receives a pageRequestedEvent, with the request from a client. It responds to it by posting a response via postEvent.
|
||||
Note that the default event distribution is single threaded. Blocking a service will block the entire server. However, you will rarely find sitations where you have to block, thanks to Qts excellent asyncronous api. A few convenience implementations are provided, such as <a href="qxtwebservicedirectory.html">qxtwebservicedirectory.html</a>, <a href="qxtwebcgiservice.html">qxtwebcgiservice.html</a>,<a href="qxtwebslotservice.html">qxtwebslotservice.html</a>
|
||||
</p>
|
||||
|
||||
\endraw
|
||||
|
||||
|
||||
|
||||
\sa {QxtWeb}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\page tech-log.html
|
||||
\title Pluggable Logging Framework
|
||||
|
||||
\raw HTML
|
||||
<p>
|
||||
<a href="qxtlogger.html"> QxtLogger </a> provides your application with an excelene framework for logging errors and debug messages in different levels.
|
||||
It can write to different backend plugins, such as <a href="qxtbasicfileloggerengine.html">QxtBasicFileLoggerengine</a> , <a href="qxtbasicstdloggerengine.html"> QxtBasicStdLoggerEngine</a>
|
||||
</p>
|
||||
\endraw
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\page tech-zeroconf.html
|
||||
\title Configure free service discovery
|
||||
|
||||
\raw HTML
|
||||
<p>
|
||||
<a href="qxtzeroconf.html"> QxtZeroconf </a> implements classes for announcing and discovering services on the local network, without the need for any user configuration. Commonly this is known as "Zeroconf". A computer in the Local Area Network could announce a "printing service", and other computers could find this service without knowing the topology of the network. QxtZeroconf implements multiple possible system backends, namely apples mdnsd, and avahi.
|
||||
</p>
|
||||
\endraw
|
||||
|
||||
*/
|
68366
doc/src/qt.index
|
@ -1,104 +0,0 @@
|
|||
project = Qxt
|
||||
description = Qxt Reference Documentation
|
||||
url = http://doc.libqxt.org/0.7.0
|
||||
language = Cpp
|
||||
modules = QxtBerkeley QxtCore QxtGui QxtNetwork QxtSql QxtWeb QxtZeroconf
|
||||
|
||||
qhp.projects = Qxt
|
||||
|
||||
qhp.Qxt.file = qxt.qhp
|
||||
qhp.Qxt.namespace = org.libqxt.070
|
||||
qhp.Qxt.virtualFolder = qdoc
|
||||
qhp.Qxt.indexTitle = Qxt Reference Documentation
|
||||
qhp.Qxt.indexRoot =
|
||||
qhp.Qxt.extraFiles = stylesheet.css
|
||||
|
||||
qhp.Qxt.filterAttributes = qxt 0.7.0 qxtrefdoc
|
||||
qhp.Qxt.customFilters.Qxt.name = Qxt 0.7.0
|
||||
qhp.Qxt.customFilters.Qxt.filterAttributes = qxt 0.7.0
|
||||
qhp.Qxt.subprojects = classes overviews examples
|
||||
qhp.Qxt.subprojects.classes.title = Classes
|
||||
qhp.Qxt.subprojects.classes.indexTitle = Qxt's Classes
|
||||
qhp.Qxt.subprojects.classes.selectors = class fake:headerfile
|
||||
qhp.Qxt.subprojects.classes.sortPages = true
|
||||
qhp.Qxt.subprojects.overviews.title = Overviews
|
||||
qhp.Qxt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
|
||||
qhp.Qxt.subprojects.overviews.selectors = fake:page,group,module
|
||||
qhp.Qxt.subprojects.examples.title = Tutorials and Examples
|
||||
qhp.Qxt.subprojects.examples.indexTitle = Qxt Examples
|
||||
qhp.Qxt.subprojects.examples.selectors = fake:example
|
||||
|
||||
indexes = $QXT_SOURCE_TREE/doc/src/qt.index
|
||||
headerdirs = $QXT_SOURCE_TREE/src
|
||||
sourcedirs = $QXT_SOURCE_TREE/src $QXT_SOURCE_TREE/doc/src
|
||||
excludedirs = $QXT_SOURCE_TREE/src/designer
|
||||
|
||||
sources.fileextensions = "*.cpp *.qdoc"
|
||||
examples.fileextensions = "*.cpp *.h *.ui *.qhp *.qhcp"
|
||||
|
||||
exampledirs = $QXT_SOURCE_TREE/examples
|
||||
imagedirs = $QXT_SOURCE_TREE/doc/src/images
|
||||
outputdir = $QXT_BUILD_TREE/doc/html
|
||||
tagfile = $QXT_BUILD_TREE/doc/qxt.tags
|
||||
base = file:$QXT_BUILD_TREE/doc
|
||||
|
||||
extraimages.HTML = implicitshared.png \
|
||||
logo.png \
|
||||
note.png \
|
||||
qxtbasespinbox.png \
|
||||
qxtcheckcombobox.png \
|
||||
qxtconfigdialog.png \
|
||||
qxtconfirmationmessage.png \
|
||||
qxtcountrycombobox.png \
|
||||
qxtcountrymodel.png \
|
||||
qxtflowview.png \
|
||||
qxtgroupbox.png \
|
||||
qxtheaderview.png \
|
||||
qxtlabel.png \
|
||||
qxtlanguagecombobox.png \
|
||||
qxtlineedit.png \
|
||||
qxtlistwidget.png \
|
||||
qxt-logo.png \
|
||||
qxtprogresslabel.png \
|
||||
qxtpushbutton.png \
|
||||
qxtscheduleview.png \
|
||||
qxtslotmapper.png \
|
||||
qxtspanslider.png \
|
||||
qxtstars.png \
|
||||
qxtstringspinbox.png \
|
||||
qxttablewidget.png \
|
||||
qxttabwidget.png \
|
||||
qxttooltip.png \
|
||||
qxttreewidget.png \
|
||||
see.png \
|
||||
warning.png
|
||||
|
||||
HTML.stylesheets = stylesheet.css
|
||||
HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \
|
||||
"<tr>\n" \
|
||||
"<td align=\"left\" valign=\"top\" width=\"32\">" \
|
||||
"<a href=\"http://libqxt.org\">" \
|
||||
"<img src=\"images/qxt-logo.png\" width=\"50\" height=\"40\" align=\"left\" border=\"0\" /></a>" \
|
||||
"</td>\n" \
|
||||
"<td width=\"1\"> </td>" \
|
||||
"<td class=\"postheader\" valign=\"center\">" \
|
||||
"<a href=\"index.html\">" \
|
||||
"<font color=\"#004faf\">Home</font></a> ·" \
|
||||
" <a href=\"modules.html\">" \
|
||||
"<font color=\"#004faf\">Modules</font></a> ·" \
|
||||
" <a href=\"classes.html\">" \
|
||||
"<font color=\"#004faf\">Classes</font></a> ·" \
|
||||
" <a href=\"namespaces.html\">" \
|
||||
"<font color=\"#004faf\">Namespaces</font></a> ·" \
|
||||
" <a href=\"functions.html\">" \
|
||||
"<font color=\"#004faf\">Functions</font></a>" \
|
||||
"</td>\n" \
|
||||
"<td align=\"right\" valign=\"top\" width=\"230\"></td></tr></table>"
|
||||
|
||||
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
|
||||
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
|
||||
"<td align=\"left\">Copyright © 2007-2010\n" \
|
||||
"<a href=\"mailto:foundation@libqxt.org\">Qxt Foundation</a></td>\n" \
|
||||
"<td align=\"right\"><div align=\"right\">\n" \
|
||||
"<a href=\"http://libqxt.org\">Qxt</a> 0.7.0</div></td>\n" \
|
||||
"</tr></table></div></address>"
|
|
@ -1,106 +0,0 @@
|
|||
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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 the LibQxt project 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 <COPYRIGHT HOLDER> 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.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
/*!
|
||||
\namespace Qxt
|
||||
\inmodule QxtCore
|
||||
\brief The Qxt namespace contains miscellaneous identifiers
|
||||
used throughout the Qxt library.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qxt::Rotation
|
||||
This enum describes the rotation.
|
||||
|
||||
\value NoRotation No rotation.
|
||||
\value UpsideDown Upside down (180 degrees).
|
||||
\value Clockwise Clockwise (90 degrees).
|
||||
\value CounterClockwise CounterClockwise (-90 degrees).
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qxt::DecorationStyle
|
||||
This enum describes the decoration style.
|
||||
|
||||
\value NoDecoration No decoration.
|
||||
\value Buttonlike A style like in Qt Designer's Widget Box.
|
||||
\value Menulike A menu alike style.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qxt::ErrorCode
|
||||
The error Code dropped by QxtError
|
||||
|
||||
\value NoError Everything fine.
|
||||
\value UnknownError An unknown error.
|
||||
\value LogicalError Something happened that makes no sense (e.g. you tryed to compare apples and bananas).
|
||||
\value Bug That should not happen. please report any ocurence of it.
|
||||
\value UnexpectedEndOfFunction Suddenly the function returned where it should not. please report this behaiviour.
|
||||
\value NotImplemented The feature you requested has not been implemented for this situation. this could also mean you are trying to compare apples and bananas.
|
||||
\value CodecError Something went wrong with some codec. Please check if your codec is supported.
|
||||
\value NotInitialised Somone tryed to call a function of an object that needs to be start() ed or something like it.
|
||||
\value EndOfFile The end of the Input has been reached. There is no more data.
|
||||
\value FileIOError File Input/Output Error.
|
||||
\value FormatError The Format of the input is corupted or not supported.
|
||||
\value DeviceError The Device of the Computer reported failure or we are not able to comunicate with it.
|
||||
\value SDLError SDL reported an error.
|
||||
\value InsufficientMemory Not enough memory to perform the action.
|
||||
\value SeeErrorString The Error has no definition here, but the Error String should tell you more. This is mostly used for third party errors.
|
||||
\value UnexpectedNullParameter NULL was passed where it shouldn't.
|
||||
\value ClientTimeout The Client didn't answer within the expected time rang.
|
||||
\value SocketIOError Socket Input/Output Error.
|
||||
\value ParserError Unable to parse the requested string or file.
|
||||
\value HeaderTooLong The Header that was passed for parsing was too long.
|
||||
\value Auth Authentication failed.
|
||||
\value Overflow Overflow protection triggered.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qxt::QxtItemDataRole
|
||||
Data roles for qxt models/views
|
||||
|
||||
\value ItemStartTimeRole The starttime of a item in timebased views.
|
||||
\value ItemDurationRole The duration of a item in timebased views.
|
||||
\value UserRole The first role that can be used for application-specific purposes.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qxt::Timeunit
|
||||
Time units
|
||||
|
||||
\value Second A second
|
||||
\value Minute A minute
|
||||
\value Hour An hour
|
||||
\value Day A day
|
||||
\value Week A week
|
||||
\value Month A month
|
||||
\value Year A year
|
||||
*/
|
|
@ -1,142 +0,0 @@
|
|||
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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 the LibQxt project 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 <COPYRIGHT HOLDER> 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.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QxtNativeEventFilter
|
||||
\inmodule QxtGui
|
||||
\brief The QxtNativeEventFilter class provides a native event filter to
|
||||
access platform specific events.
|
||||
|
||||
QxtNativeEventFilter provides access to platform specific native events
|
||||
without the need of subclassing QApplication.
|
||||
|
||||
\bold {Note:} QxtNativeEventFilter requires QxtApplication.
|
||||
|
||||
Example usage:
|
||||
\code
|
||||
qxtApp->installNativeEventFilter(myObject);
|
||||
|
||||
class MyObject : public QxtNativeEventFilter {
|
||||
public:
|
||||
...
|
||||
|
||||
bool x11EventFilter(XEvent* event) {
|
||||
if (event->type == ...) {
|
||||
...
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool winEventFilter(MSG* msg, long* result) {
|
||||
if (msg->message == ...) {
|
||||
...
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool macEventFilter(EventHandlerCallRef caller, EventRef event) {
|
||||
if (GetEventClass(event) == ...) {
|
||||
...
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
\endcode
|
||||
|
||||
\sa QxtApplication::installNativeEventFilter()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QxtNativeEventFilter::~QxtNativeEventFilter()
|
||||
|
||||
Destructs the native event filter. The native event filter is
|
||||
automatically removed from the application.
|
||||
|
||||
\sa QxtApplication::removeNativeEventFilter()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QxtNativeEventFilter::x11EventFilter(XEvent* event)
|
||||
|
||||
Filters X11 events if this object has been installed as a native event filter.
|
||||
The events are passed in the \a event parameter.
|
||||
|
||||
In your reimplementation of this function, if you want to filter the event out,
|
||||
i.e. stop it being handled further, return \c true; otherwise return \c false.
|
||||
|
||||
\sa QxtApplication::installNativeEventFilter()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QxtNativeEventFilter::winEventFilter(MSG* msg, long* result)
|
||||
|
||||
Filters Windows events if this object has been installed as a native event filter.
|
||||
The window messages are passed in the \a msg parameter and the return value of
|
||||
the window procedure can be set to the \a result parameter.
|
||||
|
||||
In your reimplementation of this function, if you want to filter the event out,
|
||||
i.e. stop it being handled further, return \c true; otherwise return \c false.
|
||||
|
||||
\sa QxtApplication::installNativeEventFilter()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QxtNativeEventFilter::macEventFilter(EventHandlerCallRef caller, EventRef event)
|
||||
|
||||
Filters Mac events if this object has been installed as a native event filter.
|
||||
The events are passed in the \a event parameter with the \a caller parameter.
|
||||
|
||||
In your reimplementation of this function, if you want to filter the event out,
|
||||
i.e. stop it being handled further, return \c true; otherwise return \c false.
|
||||
|
||||
\sa QxtApplication::installNativeEventFilter()
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
h3.fn,span.fn
|
||||
{
|
||||
margin-left: 1cm;
|
||||
text-indent: -1cm;
|
||||
}
|
||||
|
||||
a:link
|
||||
{
|
||||
color: #004faf;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: #672967;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a.obsolete
|
||||
{
|
||||
color: #661100;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a.compat
|
||||
{
|
||||
color: #661100;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a.obsolete:visited
|
||||
{
|
||||
color: #995500;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a.compat:visited
|
||||
{
|
||||
color: #995500;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
td.postheader
|
||||
{
|
||||
font-family: sans-serif
|
||||
}
|
||||
|
||||
tr.address
|
||||
{
|
||||
font-family: sans-serif
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
background: #ffffff;
|
||||
color: black
|
||||
}
|
||||
|
||||
table tr.odd {
|
||||
background: #f0f0f0;
|
||||
color: black;
|
||||
}
|
||||
|
||||
table tr.even {
|
||||
background: #e4e4e4;
|
||||
color: black;
|
||||
}
|
||||
|
||||
table.annotated th {
|
||||
padding: 3px;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
table.annotated td {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
table tr pre
|
||||
{
|
||||
padding-top: none;
|
||||
padding-bottom: none;
|
||||
padding-left: none;
|
||||
padding-right: none;
|
||||
border: none;
|
||||
background: none
|
||||
}
|
||||
|
||||
tr.qt-style
|
||||
{
|
||||
background: #96E066;
|
||||
color: black
|
||||
}
|
||||
|
||||
body pre
|
||||
{
|
||||
padding: 0.2em;
|
||||
border: #e7e7e7 1px solid;
|
||||
background: #f1f1f1;
|
||||
color: black
|
||||
}
|
||||
|
||||
table tr.qt-code pre
|
||||
{
|
||||
padding: 0.2em;
|
||||
border: #e7e7e7 1px solid;
|
||||
background: #f1f1f1;
|
||||
color: black
|
||||
}
|
||||
|
||||
span.preprocessor, span.preprocessor a
|
||||
{
|
||||
color: darkblue;
|
||||
}
|
||||
|
||||
span.comment
|
||||
{
|
||||
color: darkred;
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
span.string,span.char
|
||||
{
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.title
|
||||
{
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.subtitle
|
||||
{
|
||||
font-size: 0.8em
|
||||
}
|
||||
|
||||
.small-subtitle
|
||||
{
|
||||
font-size: 0.65em
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
|
||||
CONFIG+=qxt
|
||||
QXT+=berkeley
|
||||
|
||||
|
||||
HEADERS += contact.h mainwindow.h
|
||||
FORMS += mainwindow.ui
|
||||
SOURCES += contact.cpp main.cpp mainwindow.cpp
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#include "contact.h"
|
||||
|
||||
|
||||
|
||||
QDataStream &operator<<(QDataStream &out,const Contact &c)
|
||||
{
|
||||
out<<c.name;
|
||||
out<<c.phone;
|
||||
out<<c.address;
|
||||
return out;
|
||||
}
|
||||
QDataStream &operator>>(QDataStream &in, Contact &c )
|
||||
{
|
||||
in>>c.name;
|
||||
in>>c.phone;
|
||||
in>>c.address;
|
||||
return in;
|
||||
}
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef CONTACT_H
|
||||
#define CONTACT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QDataStream>
|
||||
|
||||
struct Contact
|
||||
{
|
||||
QString name;
|
||||
QString phone;
|
||||
QString address;
|
||||
|
||||
};
|
||||
Q_DECLARE_METATYPE(Contact);
|
||||
|
||||
QDataStream &operator<<(QDataStream &out,const Contact &c);
|
||||
QDataStream &operator>>(QDataStream &in, Contact &c );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
#include "contact.h"
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
QApplication app(argc,argv);
|
||||
|
||||
qRegisterMetaType <Contact> ("Contact");
|
||||
qRegisterMetaTypeStreamOperators <Contact> ("Contact");
|
||||
|
||||
MainWindow m;
|
||||
m.show();
|
||||
app.exec();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#include "mainwindow.h"
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDebug>
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
ui.setupUi(this);
|
||||
hash.open("contacts.db");
|
||||
initTree();
|
||||
}
|
||||
void MainWindow::initTree()
|
||||
{
|
||||
ui.treeWidget->clear();
|
||||
QxtBdbHashIterator<QString,Contact> it=hash.begin();
|
||||
do
|
||||
{
|
||||
Contact c=it.value();
|
||||
QTreeWidgetItem *item=new QTreeWidgetItem(ui.treeWidget);
|
||||
item->setText(0,c.name);
|
||||
item->setText(1,c.phone);
|
||||
item->setText(2,c.address);
|
||||
|
||||
}
|
||||
while((++it).isValid());
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_addButton_clicked()
|
||||
{
|
||||
Contact c;
|
||||
c.name=ui.inputName->text();
|
||||
c.phone=ui.inputPhone->text();
|
||||
c.address=ui.inputAddress->text();
|
||||
qDebug()<<hash.insert(c.name,c);
|
||||
initTree();
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef MAINWINDOW_H_INCLUDED
|
||||
#define MAINWINDOW_H_INCLUDED
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "contact.h"
|
||||
#include <QxtBdbHash>
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
private:
|
||||
Ui::MainWindow ui;
|
||||
QxtBdbHash<QString,Contact> hash;
|
||||
void initTree();
|
||||
private slots:
|
||||
void on_addButton_clicked();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H_INCLUDED
|
|
@ -1,134 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>715</width>
|
||||
<height>756</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>QxtBerkeley Address Book example</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>27</y>
|
||||
<width>715</width>
|
||||
<height>706</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" >
|
||||
<item rowspan="2" row="0" column="0" >
|
||||
<widget class="QTreeWidget" name="treeWidget" >
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Phone Nr.</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Add Entry</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="inputName" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Phone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="inputPhone" />
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="inputAddress" />
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>455</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="QPushButton" name="addButton" >
|
||||
<property name="text" >
|
||||
<string>add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>715</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>733</y>
|
||||
<width>715</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,6 +0,0 @@
|
|||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) Fri Jan 16 22:48:34 2009
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += addressbook xmlstorage
|
|
@ -1,18 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
#include "node.h"
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
QApplication app(argc,argv);
|
||||
|
||||
qRegisterMetaType <XmlNode> ("XmlNode");
|
||||
qRegisterMetaTypeStreamOperators <XmlNode> ("XmlNode");
|
||||
|
||||
MainWindow m;
|
||||
m.show();
|
||||
app.exec();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#include "mainwindow.h"
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QHeaderView>
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
ui.setupUi(this);
|
||||
model.open("xml.db");
|
||||
ui.treeView->setModel(&model);
|
||||
ui.treeView->header()->resizeSection ( 0,300);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionLoad_triggered()
|
||||
{
|
||||
model.loadXml(QFileDialog::getOpenFileNames (this, "Load Xml file",QString(), "Xml File (*.xml)"));
|
||||
}
|
||||
|
||||
void MainWindow::on_actionQuit_triggered()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef MAINWINDOW_H_INCLUDED
|
||||
#define MAINWINDOW_H_INCLUDED
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "model.h"
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
private:
|
||||
Ui::MainWindow ui;
|
||||
XmlDbModel model;
|
||||
|
||||
private slots:
|
||||
void on_actionQuit_triggered();
|
||||
void on_actionLoad_triggered();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H_INCLUDED
|
|
@ -1,112 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>574</width>
|
||||
<height>603</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>QxtBerkeley XML Storage example</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>25</y>
|
||||
<width>574</width>
|
||||
<height>557</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Candara'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Welcome to the QxtBerkeley XML Storage example.</span></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You can load some xml files by clicking on the menu File-&gt;Load and scroll through the parsed files. </p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Note that parsing xml files takes a while, even with the QXmlStreamReader it is using.</p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Then open and close the application, and see how very fast it is starting up, thanks to the already parsed nodes stored in a QxtBdbTree.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="QTreeView" name="treeView" />
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Candara'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">QPatternist</span></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you are using Qt 4.4, you can type in an XQUery expression here, and press execute, or hit enter. The Query will evaluate on the database and imidiatly show you the results.</p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you are using a lower QT version, this does nothing.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLineEdit" name="lineEdit" />
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QPushButton" name="pushButton" >
|
||||
<property name="text" >
|
||||
<string>execute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>574</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuMenu" >
|
||||
<property name="title" >
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionLoad" />
|
||||
<addaction name="actionQuit" />
|
||||
</widget>
|
||||
<addaction name="menuMenu" />
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>582</y>
|
||||
<width>574</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<action name="actionLoad" >
|
||||
<property name="text" >
|
||||
<string>Load </string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit" >
|
||||
<property name="text" >
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,220 +0,0 @@
|
|||
#include "model.h"
|
||||
#include "xml2bdb.h"
|
||||
#include <QDebug>
|
||||
#include <QProgressDialog>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
|
||||
XmlDbModel::XmlDbModel(QString db):QAbstractItemModel(),QxtBdbTree<XmlNode>()
|
||||
{
|
||||
open(db);
|
||||
}
|
||||
|
||||
XmlDbModel::XmlDbModel():QAbstractItemModel(),QxtBdbTree<XmlNode>()
|
||||
{
|
||||
cache.root()->children=-1;
|
||||
cache.root()->node=root();
|
||||
}
|
||||
bool XmlDbModel::open (QString file)
|
||||
{
|
||||
bool p= QxtBdbTree<XmlNode>::open(file);
|
||||
|
||||
cache.root()->children=-1;
|
||||
cache.root()->node=root();
|
||||
|
||||
if(canFetchMore(QModelIndex()))
|
||||
fetchMore(QModelIndex());
|
||||
reset();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void XmlDbModel::loadXml(QStringList files)
|
||||
{
|
||||
reset();
|
||||
|
||||
QProgressDialog d;
|
||||
d.setLabelText("Loading xml files into database.");
|
||||
d.show();
|
||||
d.setMaximum(files.count());
|
||||
for (int i=0;i<files.count();i++)
|
||||
{
|
||||
QApplication::processEvents ();
|
||||
if(d.wasCanceled())
|
||||
break;
|
||||
QFile file(files.at(i));
|
||||
file.open(QIODevice::ReadOnly);
|
||||
d.setValue(i);
|
||||
|
||||
Xml2Bdb x;
|
||||
x.setDevice(&file);
|
||||
x.read(root());
|
||||
}
|
||||
|
||||
cache.clear();
|
||||
cache.root()->children=-1;
|
||||
cache.root()->node=root();
|
||||
|
||||
if(canFetchMore(QModelIndex()))
|
||||
fetchMore(QModelIndex());
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
int XmlDbModel::columnCount ( const QModelIndex & ) const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
QVariant XmlDbModel::data ( const QModelIndex & index, int role ) const
|
||||
{
|
||||
Q_ASSERT_X(index.isValid(),Q_FUNC_INFO,"invalid index");
|
||||
|
||||
if(role!=Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
if(index.column()==0)
|
||||
return cache.fromVoid(index.internalPointer())->node.value().name;
|
||||
if(index.column()==1)
|
||||
{
|
||||
switch(cache.fromVoid(index.internalPointer())->node.value().type)
|
||||
{
|
||||
case 0:
|
||||
return "NoToken";
|
||||
case 2:
|
||||
return "StartDocument";
|
||||
case 3:
|
||||
return "EndDocument";
|
||||
case 4:
|
||||
return "StartElement";
|
||||
case 5:
|
||||
return "EndElement";
|
||||
case 6:
|
||||
return "Characters";
|
||||
case 7:
|
||||
return "Comment";
|
||||
case 8:
|
||||
return "DTD";
|
||||
case 9:
|
||||
return "EntityReference";
|
||||
case 10:
|
||||
return "ProcessingInstruction";
|
||||
case 1:
|
||||
default:
|
||||
return "Invalid";
|
||||
}
|
||||
}
|
||||
if(index.column()==2)
|
||||
return cache.fromVoid(index.internalPointer())->node.value().value;
|
||||
|
||||
return QVariant();
|
||||
|
||||
}
|
||||
|
||||
QVariant XmlDbModel::headerData ( int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(orientation!=Qt::Horizontal)
|
||||
return QVariant();
|
||||
if(role!=Qt::DisplayRole)
|
||||
return QVariant();
|
||||
if (section==0)
|
||||
return "name";
|
||||
if (section==1)
|
||||
return "type";
|
||||
if (section==2)
|
||||
return "value";
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QModelIndex XmlDbModel::parent ( const QModelIndex & index ) const
|
||||
{
|
||||
Q_ASSERT_X(index.isValid(),Q_FUNC_INFO,"invalid index");
|
||||
|
||||
QxtLinkedTreeIterator <XmlDbModelCacheItem> it;
|
||||
it=cache.fromVoid(index.internalPointer()).parent();
|
||||
Q_ASSERT_X(it.isValid(),Q_FUNC_INFO,"invalid iterator inside valid index (wtf?)");
|
||||
|
||||
if(!it.isValid())
|
||||
return QModelIndex();
|
||||
if(it==cache.root())
|
||||
return QModelIndex();
|
||||
|
||||
int row=0;
|
||||
QxtLinkedTreeIterator <XmlDbModelCacheItem > et=it;
|
||||
--et;
|
||||
while(et.isValid())
|
||||
{
|
||||
--et;
|
||||
row++;
|
||||
}
|
||||
return createIndex(row,0,cache.toVoid (it));
|
||||
}
|
||||
|
||||
QModelIndex XmlDbModel::index ( int row, int column, const QModelIndex & parent ) const
|
||||
{
|
||||
if(canFetchMore(parent))
|
||||
const_cast<XmlDbModel*>(this)->fetchMore(parent);
|
||||
|
||||
QxtLinkedTreeIterator <XmlDbModelCacheItem > it;
|
||||
if (parent.isValid())
|
||||
it=cache.fromVoid(parent.internalPointer()).child();
|
||||
else
|
||||
it=cache.root().child();
|
||||
it+=row;
|
||||
if(!it.isValid())
|
||||
return QModelIndex();
|
||||
return createIndex(row,column,cache.toVoid (it));
|
||||
}
|
||||
|
||||
int XmlDbModel::rowCount ( const QModelIndex & parent ) const
|
||||
{
|
||||
if(canFetchMore(parent))
|
||||
const_cast<XmlDbModel*>(this)->fetchMore(parent);
|
||||
|
||||
QxtLinkedTreeIterator <XmlDbModelCacheItem > it;
|
||||
if(parent.isValid())
|
||||
it=cache.fromVoid(parent.internalPointer());
|
||||
else
|
||||
it=cache.root();
|
||||
if (it->children<0)
|
||||
return 0;
|
||||
return it->children;
|
||||
}
|
||||
|
||||
void XmlDbModel::fetchMore ( const QModelIndex & parent )
|
||||
{
|
||||
QxtLinkedTreeIterator <XmlDbModelCacheItem > itl;
|
||||
if(parent.isValid())
|
||||
itl=cache.fromVoid(parent.internalPointer());
|
||||
else
|
||||
itl=cache.root();
|
||||
|
||||
QxtBdbTreeIterator<XmlNode> it=itl->node.child();
|
||||
|
||||
int cc=0;
|
||||
while(it.isValid())
|
||||
{
|
||||
|
||||
XmlDbModelCacheItem ci;
|
||||
ci.node=it;
|
||||
ci.children=-1;
|
||||
|
||||
itl.append(ci);
|
||||
++it;
|
||||
++cc;
|
||||
}
|
||||
itl->children=cc;
|
||||
}
|
||||
|
||||
bool XmlDbModel::canFetchMore ( const QModelIndex & parent ) const
|
||||
{
|
||||
QxtLinkedTreeIterator <XmlDbModelCacheItem > itl;
|
||||
if(parent.isValid())
|
||||
itl=cache.fromVoid(parent.internalPointer());
|
||||
else
|
||||
itl=cache.root();
|
||||
|
||||
return(itl.child().isValid()!=itl->node.child().isValid());
|
||||
}
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef MODEL_H_INCLUDED
|
||||
#define MODEL_H_INCLUDED
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QxtBdbTree>
|
||||
#include <QxtLinkedTree>
|
||||
#include "node.h"
|
||||
#include <QStringList>
|
||||
|
||||
struct XmlDbModelCacheItem
|
||||
{
|
||||
QxtBdbTreeIterator<XmlNode> node;
|
||||
int children;
|
||||
};
|
||||
|
||||
|
||||
class XmlDbModel : public QAbstractItemModel, public QxtBdbTree<XmlNode>
|
||||
{
|
||||
public:
|
||||
XmlDbModel(QString db);
|
||||
XmlDbModel();
|
||||
bool open (QString file);
|
||||
void loadXml (QStringList files);
|
||||
virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
|
||||
virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
|
||||
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
|
||||
virtual QModelIndex parent ( const QModelIndex & index ) const;
|
||||
virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
|
||||
virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
|
||||
virtual bool canFetchMore ( const QModelIndex & parent ) const;
|
||||
virtual void fetchMore ( const QModelIndex & parent );
|
||||
private:
|
||||
mutable QxtLinkedTree <XmlDbModelCacheItem> cache ;
|
||||
};
|
||||
|
||||
#endif // MODEL_H_INCLUDED
|
|
@ -1,25 +0,0 @@
|
|||
#include "node.h"
|
||||
|
||||
|
||||
|
||||
QDataStream &operator<<(QDataStream &out,const XmlNode &c)
|
||||
{
|
||||
out<<c.name;
|
||||
out<<c.value;
|
||||
out<<c.type;
|
||||
return out;
|
||||
}
|
||||
QDataStream &operator>>(QDataStream &in, XmlNode &c )
|
||||
{
|
||||
in>>c.name;
|
||||
in>>c.value;
|
||||
in>>c.type;
|
||||
return in;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, const XmlNode &c)
|
||||
{
|
||||
dbg.nospace() << "(" << c.name << ", " << c.value << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef NODE_H_INCLUDED
|
||||
#define NODE_H_INCLUDED
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
struct XmlNode
|
||||
{
|
||||
QString name;
|
||||
QString value;
|
||||
int type;
|
||||
};
|
||||
Q_DECLARE_METATYPE(XmlNode);
|
||||
|
||||
QDataStream &operator<<(QDataStream &out,const XmlNode &c);
|
||||
QDataStream &operator>>(QDataStream &in, XmlNode &c );
|
||||
|
||||
QDebug operator<<(QDebug dbg, const XmlNode &c);
|
||||
|
||||
|
||||
#endif // NODE_H_INCLUDED
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
#include "xml2bdb.h"
|
||||
#include <QApplication>
|
||||
|
||||
Xml2Bdb::Xml2Bdb() : QXmlStreamReader()
|
||||
{
|
||||
}
|
||||
|
||||
void Xml2Bdb::read(QxtBdbTreeIterator<XmlNode> root)
|
||||
{
|
||||
while (!atEnd())
|
||||
{
|
||||
readNext();
|
||||
if (isStartElement())
|
||||
{
|
||||
readElement(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Xml2Bdb::readElement(QxtBdbTreeIterator<XmlNode> i)
|
||||
{
|
||||
|
||||
XmlNode x;
|
||||
x.name=name().toString();
|
||||
x.value=text().toString();
|
||||
x.type=tokenType();
|
||||
i=i.append(x);
|
||||
|
||||
while (!atEnd())
|
||||
{
|
||||
QApplication::processEvents ();
|
||||
readNext();
|
||||
if (isEndElement())
|
||||
break;
|
||||
else if (isStartElement())
|
||||
{
|
||||
readElement(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(text().toString().simplified().isEmpty())
|
||||
continue;
|
||||
XmlNode x;
|
||||
x.name=name().toString();
|
||||
x.value=text().toString();
|
||||
x.type=tokenType();
|
||||
i.append(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef XML2BDB_H_INCLUDED
|
||||
#define XML2BDB_H_INCLUDED
|
||||
|
||||
#include <QXmlStreamReader>
|
||||
#include <QxtBdbTree>
|
||||
#include "node.h"
|
||||
|
||||
class Xml2Bdb : public QXmlStreamReader
|
||||
{
|
||||
public:
|
||||
Xml2Bdb();
|
||||
void read(QxtBdbTreeIterator<XmlNode> root);
|
||||
private:
|
||||
void readElement(QxtBdbTreeIterator<XmlNode> i);
|
||||
};
|
||||
|
||||
#endif // XML2BDB_H_INCLUDED
|
|
@ -1,13 +0,0 @@
|
|||
TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
|
||||
CONFIG+=qxt
|
||||
QXT+=berkeley
|
||||
|
||||
|
||||
HEADERS += node.h mainwindow.h xml2bdb.h model.h
|
||||
FORMS += mainwindow.ui
|
||||
SOURCES += node.cpp main.cpp mainwindow.cpp xml2bdb.cpp model.cpp
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) Mi Nov 7 07:22:25 2007
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += debug_and_release
|
||||
CONFIG += qxt
|
||||
TARGET = test
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
|
||||
QXT += core gui
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
unix: TARGET = $$join(TARGET,,,_debug)
|
||||
else: TARGET = $$join(TARGET,,d)
|
||||
}
|
||||
|
||||
# Input
|
||||
FORMS += country.ui
|
||||
SOURCES += main.cpp
|
||||
HEADERS += testdialog.h
|
||||
RESOURCES += country.qrc
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file alias="qxt_de.qm">../../translations/qxt_de.qm</file>
|
||||
<file alias="qxt_en.qm">../../translations/qxt_en.qm</file>
|
||||
<file alias="qxt_es.qm">../../translations/qxt_es.qm</file>
|
||||
<file alias="qxt_fr.qm">../../translations/qxt_fr.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,25 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QDebug>
|
||||
#include <QxtLanguageComboBox>
|
||||
#include "testdialog.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Q_INIT_RESOURCE(flags);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QTranslator trans;
|
||||
bool ok = trans.load(":/qxt_"+QLocale::system().name());
|
||||
if (!ok)
|
||||
qDebug() << "Loading translation failed.";
|
||||
qDebug() << trans.translate("Country", "Germany");
|
||||
|
||||
app.installTranslator(&trans);
|
||||
|
||||
TestDialog* w = new TestDialog();
|
||||
|
||||
w->show();
|
||||
app.exec();
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef TESTDIALOG_H_INCLUDED
|
||||
#define TESTDIALOG_H_INCLUDED
|
||||
|
||||
#include <QDebug>
|
||||
#include "ui_country.h"
|
||||
#include <QxtCountryModel>
|
||||
|
||||
|
||||
|
||||
class TestDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TestDialog(QWidget *parent = 0)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.label->setText(QString("Current Locale: %1").arg(QLocale::system().name()));
|
||||
ui.tableView->setModel(new QxtCountryModel(this));
|
||||
}
|
||||
|
||||
private:
|
||||
Ui::Dialog ui;
|
||||
};
|
||||
|
||||
#endif // TESTDIALOG_H_INCLUDED
|
|
@ -1,15 +0,0 @@
|
|||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) Sun Mar 1 19:09:35 2009
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
CONFIG += qxt
|
||||
QXT += core gui
|
||||
|
||||
# Input
|
||||
FORMS += displaysettingsdialog.ui
|
||||
HEADERS += displaysettingsdialog.h
|
||||
SOURCES += displaysettingsdialog.cpp main.cpp
|
|
@ -1,201 +0,0 @@
|
|||
#include "displaysettingsdialog.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
|
||||
static int greatestCommonDivisor(int a, int b)
|
||||
{
|
||||
if (b == 0)
|
||||
return a;
|
||||
return greatestCommonDivisor(b, a % b);
|
||||
}
|
||||
|
||||
DisplaySettingsDialog::DisplaySettingsDialog(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.letterBoxWidget->setMargin(20);
|
||||
ui.letterBoxWidget->setWidget(ui.labelBox);
|
||||
ui.letterBoxWidget->setBackgroundColor(QColor("wheat"));
|
||||
|
||||
connect(ui.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(apply()));
|
||||
connect(ui.refreshButton, SIGNAL(clicked()), SLOT(refresh()));
|
||||
|
||||
fillScreens();
|
||||
selectScreen(qApp->desktop()->primaryScreen());
|
||||
fillRefreshRates();
|
||||
fillColorDepths();
|
||||
|
||||
connect(ui.comboBoxScreen, SIGNAL(currentIndexChanged(int)), SLOT(selectScreen(int)));
|
||||
connect(ui.comboBoxReso, SIGNAL(currentIndexChanged(int)), SLOT(fillRefreshRates()));
|
||||
connect(ui.comboBoxReso, SIGNAL(currentIndexChanged(int)), SLOT(fillColorDepths()));
|
||||
|
||||
updateUi(true);
|
||||
connect(ui.comboBoxScreen, SIGNAL(currentIndexChanged(int)), SLOT(updateUi()));
|
||||
connect(ui.comboBoxReso, SIGNAL(currentIndexChanged(int)), SLOT(updateUi()));
|
||||
connect(ui.comboBoxRate, SIGNAL(currentIndexChanged(int)), SLOT(updateUi()));
|
||||
connect(ui.comboBoxDepth, SIGNAL(currentIndexChanged(int)), SLOT(updateUi()));
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::apply()
|
||||
{
|
||||
int resoIndex = ui.comboBoxReso->currentIndex();
|
||||
if (resoIndex != -1)
|
||||
{
|
||||
const QSize reso = ui.comboBoxReso->itemData(resoIndex).toSize();
|
||||
screen.setResolution(reso);
|
||||
}
|
||||
|
||||
int rateIndex = ui.comboBoxRate->currentIndex();
|
||||
if (rateIndex != -1)
|
||||
{
|
||||
const int rate = ui.comboBoxRate->itemData(rateIndex).toInt();
|
||||
screen.setRefreshRate(rate);
|
||||
}
|
||||
|
||||
int depthIndex = ui.comboBoxDepth->currentIndex();
|
||||
if (depthIndex != -1)
|
||||
{
|
||||
const int depth = ui.comboBoxDepth->itemData(depthIndex).toInt();
|
||||
screen.setColorDepth(depth);
|
||||
}
|
||||
|
||||
screen.apply();
|
||||
|
||||
QMessageBox messageBox(this);
|
||||
messageBox.setWindowTitle(windowTitle());
|
||||
messageBox.setIcon(QMessageBox::Information);
|
||||
messageBox.setText(tr("Your desktop has been reconfigured. Do you want to keep these settings?"));
|
||||
messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
messageBox.setDefaultButton(QMessageBox::No);
|
||||
messageBox.setWindowModality(Qt::WindowModal);
|
||||
messageBox.show();
|
||||
|
||||
QEventLoop eventLoop;
|
||||
connect(messageBox.button(QMessageBox::Yes), SIGNAL(clicked()), &eventLoop, SLOT(quit()));
|
||||
connect(messageBox.button(QMessageBox::No), SIGNAL(clicked()), &eventLoop, SLOT(quit()));
|
||||
for (int i = 15; i > 0; --i)
|
||||
{
|
||||
messageBox.setInformativeText(tr("Reverting in %1 seconds").arg(i));
|
||||
QTimer::singleShot(1000, &eventLoop, SLOT(quit()));
|
||||
eventLoop.exec();
|
||||
|
||||
if (messageBox.clickedButton())
|
||||
break;
|
||||
}
|
||||
|
||||
if (messageBox.clickedButton() == messageBox.button(QMessageBox::Yes))
|
||||
ui.buttonBox->button(QDialogButtonBox::Apply)->setDisabled(true);
|
||||
else
|
||||
screen.cancel();
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::refresh()
|
||||
{
|
||||
screen.refresh();
|
||||
fillScreens();
|
||||
updateUi(true);
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::fillScreens()
|
||||
{
|
||||
ui.comboBoxScreen->clear();
|
||||
int numScreens = qApp->desktop()->numScreens();
|
||||
for (int i = 0; i < numScreens; ++i)
|
||||
ui.comboBoxScreen->addItem(tr("Screen %1").arg(i));
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::selectScreen(int screenNumber)
|
||||
{
|
||||
screen.setScreenNumber(screenNumber);
|
||||
fillResolutions();
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::fillResolutions()
|
||||
{
|
||||
ui.comboBoxReso->clear();
|
||||
const QList<QSize> resos = screen.availableResolutions();
|
||||
foreach (const QSize& reso, resos)
|
||||
{
|
||||
QSize ratio = reso / greatestCommonDivisor(reso.width(), reso.height());
|
||||
QString text = tr("%1 x %2 (%3:%4)")
|
||||
.arg(reso.width()).arg(reso.height())
|
||||
.arg(ratio.width()).arg(ratio.height());
|
||||
ui.comboBoxReso->addItem(text, reso);
|
||||
}
|
||||
|
||||
const QSize reso = screen.resolution();
|
||||
ui.comboBoxReso->setCurrentIndex(resos.indexOf(reso));
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::fillRefreshRates()
|
||||
{
|
||||
const int resoIndex = ui.comboBoxReso->currentIndex();
|
||||
if (resoIndex != -1)
|
||||
{
|
||||
const QSize reso = ui.comboBoxReso->itemData(resoIndex).toSize();
|
||||
|
||||
ui.comboBoxRate->clear();
|
||||
const QList<int> rates = screen.availableRefreshRates(reso);
|
||||
foreach (int rate, rates)
|
||||
{
|
||||
QString text = tr("%1 Hz").arg(rate);
|
||||
ui.comboBoxRate->addItem(text, rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::fillColorDepths()
|
||||
{
|
||||
const int resoIndex = ui.comboBoxReso->currentIndex();
|
||||
if (resoIndex != -1)
|
||||
{
|
||||
const QSize reso = ui.comboBoxReso->itemData(resoIndex).toSize();
|
||||
|
||||
ui.comboBoxDepth->clear();
|
||||
const QList<int> depths = screen.availableColorDepths(reso);
|
||||
foreach (int depth, depths)
|
||||
{
|
||||
QString text = tr("%1 bit").arg(depth);
|
||||
ui.comboBoxDepth->addItem(text, depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplaySettingsDialog::updateUi(bool init)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
const QSize reso = screen.resolution();
|
||||
const QList<QSize> resos = screen.availableResolutions();
|
||||
ui.comboBoxReso->setCurrentIndex(resos.indexOf(reso));
|
||||
|
||||
const int rate = screen.refreshRate();
|
||||
const QList<int> rates = screen.availableRefreshRates(reso);
|
||||
ui.comboBoxRate->setCurrentIndex(rates.indexOf(rate));
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
const int depth = screen.colorDepth();
|
||||
const QList<int> depths = screen.availableColorDepths(reso);
|
||||
ui.comboBoxDepth->setCurrentIndex(depths.indexOf(depth));
|
||||
#else
|
||||
ui.labelDepth->setDisabled(true);
|
||||
ui.comboBoxDepth->setDisabled(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
const int resoIndex = ui.comboBoxReso->currentIndex();
|
||||
const QSize reso = ui.comboBoxReso->itemData(resoIndex).toSize();
|
||||
QSize ratio = reso / greatestCommonDivisor(reso.width(), reso.height());
|
||||
|
||||
QString text = tr("%1 x %2 (%3:%4)")
|
||||
.arg(reso.width()).arg(reso.height())
|
||||
.arg(ratio.width()).arg(ratio.height());
|
||||
|
||||
ui.labelBox->setText(text);
|
||||
ui.labelBox->setSizeIncrement(reso);
|
||||
ui.letterBoxWidget->resizeWidget();
|
||||
|
||||
ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(!init);
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
#ifndef DISPLAYSETTINGSDIALOG_H
|
||||
#define DISPLAYSETTINGSDIALOG_H
|
||||
|
||||
#include <QxtScreen>
|
||||
#include "ui_displaysettingsdialog.h"
|
||||
|
||||
class DisplaySettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DisplaySettingsDialog(QWidget* parent = 0);
|
||||
|
||||
private slots:
|
||||
void apply();
|
||||
void refresh();
|
||||
|
||||
void fillScreens();
|
||||
void selectScreen(int screenNumber);
|
||||
void fillResolutions();
|
||||
void fillRefreshRates();
|
||||
void fillColorDepths();
|
||||
|
||||
void updateUi(bool init = false);
|
||||
|
||||
private:
|
||||
Ui::DisplaySettingsDialog ui;
|
||||
QxtScreen screen;
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSDIALOG_H
|
|
@ -1,193 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>DisplaySettingsDialog</class>
|
||||
<widget class="QDialog" name="DisplaySettingsDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>338</width>
|
||||
<height>392</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Display Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QxtLetterBoxWidget" name="letterBoxWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>320</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>40</y>
|
||||
<width>161</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet" >
|
||||
<string notr="true" >background: salmon; border: 2px solid blue</string>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<property name="fieldGrowthPolicy" >
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="labelReso" >
|
||||
<property name="text" >
|
||||
<string>&Resolution</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>comboBoxReso</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="comboBoxReso" />
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="labelRate" >
|
||||
<property name="text" >
|
||||
<string>Re&fresh Rate</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>comboBoxRate</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QComboBox" name="comboBoxRate" />
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="labelScreen" >
|
||||
<property name="text" >
|
||||
<string>&Screen</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>comboBoxScreen</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxScreen" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="refreshButton" >
|
||||
<property name="text" >
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QComboBox" name="comboBoxDepth" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="labelDepth" >
|
||||
<property name="text" >
|
||||
<string>&Depth</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>comboBoxDepth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>buttonBox</zorder>
|
||||
<zorder>letterBoxWidget</zorder>
|
||||
<zorder></zorder>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QxtLetterBoxWidget</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>QxtLetterBoxWidget</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>comboBoxScreen</tabstop>
|
||||
<tabstop>comboBoxReso</tabstop>
|
||||
<tabstop>comboBoxRate</tabstop>
|
||||
<tabstop>comboBoxDepth</tabstop>
|
||||
<tabstop>refreshButton</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DisplaySettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DisplaySettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,9 +0,0 @@
|
|||
#include <QtGui>
|
||||
#include "displaysettingsdialog.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
DisplaySettingsDialog dialog;
|
||||
return dialog.exec();
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) Fri Jan 16 22:47:44 2009
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = subdirs
|
||||
|
||||
contains(DEFINES,HAVE_DB):contains(QXT_MODULES, berkeley):SUBDIRS += berkeley
|
||||
contains(QXT_MODULES, gui) {
|
||||
!macx:SUBDIRS += displaysettings
|
||||
SUBDIRS += qxtflowview
|
||||
SUBDIRS += qxtscheduleview
|
||||
}
|
||||
contains(QXT_MODULES, network):SUBDIRS += ircpeer pop3
|
||||
contains(QXT_MODULES, web):SUBDIRS += web
|
||||
contains(DEFINES,HAVE_ZEROCONF):contains(QXT_MODULES, zeroconf):SUBDIRS += zeroconf
|
|
@ -1,36 +0,0 @@
|
|||
#include "dialog.h"
|
||||
#include <QSettings>
|
||||
|
||||
ConnectDialog::ConnectDialog()
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(save()));
|
||||
QSettings settings("libqxt.org", "ircpeer");
|
||||
if(settings.contains("username"))
|
||||
ui.nick->setText(settings.value("username").toString());
|
||||
if(settings.contains("port"))
|
||||
ui.port->setText(settings.value("port").toString());
|
||||
if(settings.contains("server"))
|
||||
ui.server->setText(settings.value("server").toString());
|
||||
}
|
||||
|
||||
void ConnectDialog::save()
|
||||
{
|
||||
QSettings settings("libqxt.org", "ircpeer");
|
||||
settings.setValue("username", nickname());
|
||||
settings.setValue("port", QString::number(port()));
|
||||
settings.setValue("server", hostname());
|
||||
}
|
||||
|
||||
QByteArray ConnectDialog::hostname()
|
||||
{
|
||||
return ui.server->text().toAscii();
|
||||
}
|
||||
int ConnectDialog::port()
|
||||
{
|
||||
return ui.port->text().toInt();
|
||||
}
|
||||
QString ConnectDialog::nickname()
|
||||
{
|
||||
return ui.nick->text();
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef DIALOG_H_INCLUDED
|
||||
#define DIALOG_H_INCLUDED
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_dialog.h"
|
||||
|
||||
class ConnectDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConnectDialog();
|
||||
QByteArray hostname();
|
||||
int port();
|
||||
QString nickname();
|
||||
|
||||
private slots:
|
||||
void save();
|
||||
|
||||
private:
|
||||
Ui::Dialog ui;
|
||||
};
|
||||
|
||||
#endif // DIALOG_H_INCLUDED
|
|
@ -1,124 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>379</width>
|
||||
<height>163</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>connect</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Server:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="server" >
|
||||
<property name="text" >
|
||||
<string>chat.freenode.net</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="port" >
|
||||
<property name="text" >
|
||||
<string>6667</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Nickname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="nick" >
|
||||
<property name="text" >
|
||||
<string>qxtirc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<spacer name="verticalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>nick</tabstop>
|
||||
<tabstop>server</tabstop>
|
||||
<tabstop>port</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,140 +0,0 @@
|
|||
#include "ircpeer.h"
|
||||
#include <QRegExp>
|
||||
|
||||
IRCSerializer::IRCSerializer() : QxtAbstractSignalSerializer() {
|
||||
qRegisterMetaType<IRCName>();
|
||||
}
|
||||
|
||||
bool IRCSerializer::canDeserialize(const QByteArray& buffer) const {
|
||||
return buffer.indexOf('\n') != -1 || buffer.indexOf('\r') != -1;
|
||||
}
|
||||
|
||||
static bool serializeParam(QTextStream& str, QVariant p) {
|
||||
if(!p.isValid() || !p.canConvert(QVariant::ByteArray)) {
|
||||
str << "\r\n" << flush;
|
||||
return true;
|
||||
}
|
||||
QByteArray ba = p.toByteArray();
|
||||
if(ba.contains(' ') || ba[0] == ':')
|
||||
{
|
||||
str << " :" << ba << "\r\n" << flush;
|
||||
return true;
|
||||
}
|
||||
str << " " << ba << flush;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray IRCSerializer::serialize(const QString& fn, const QVariant& p1, const QVariant& p2, const QVariant& p3,
|
||||
const QVariant& p4, const QVariant& p5, const QVariant& p6, const QVariant& p7, const QVariant& p8) const {
|
||||
if(fn == "raw") return p1.toString().toUtf8() + "\r\n";
|
||||
QByteArray rv;
|
||||
QTextStream str(&rv);
|
||||
if(p1.isValid()) {
|
||||
if(p1.canConvert<IRCName>()) {
|
||||
QByteArray name = p1.value<IRCName>().assemble();
|
||||
if(!name.isEmpty())
|
||||
str << ":" << p1.value<IRCName>().assemble() << " ";
|
||||
|
||||
} else if(!p1.toByteArray().isEmpty()) {
|
||||
str << ":" << p1.toByteArray() << " ";
|
||||
}
|
||||
}
|
||||
str << fn << flush;
|
||||
|
||||
if(serializeParam(str, p2)) return rv;
|
||||
if(serializeParam(str, p3)) return rv;
|
||||
if(serializeParam(str, p4)) return rv;
|
||||
if(serializeParam(str, p5)) return rv;
|
||||
if(serializeParam(str, p6)) return rv;
|
||||
if(serializeParam(str, p7)) return rv;
|
||||
if(serializeParam(str, p8)) return rv;
|
||||
return rv + "\r\n";
|
||||
}
|
||||
|
||||
QPair<QString, QList<QVariant> > IRCSerializer::deserialize(QByteArray& data) {
|
||||
int lfPos = data.indexOf('\n'), crPos = data.indexOf('\r'), wordPos = 0, endPos = (crPos == -1 || lfPos < crPos) ? lfPos : crPos;
|
||||
QByteArray message = data.left(endPos).trimmed(), prefix;
|
||||
data = data.mid(endPos+1);
|
||||
if(message.isEmpty()) return qMakePair(QString(), QList<QVariant>());
|
||||
|
||||
QList<QByteArray> words = message.split(' ');
|
||||
if(words[0][0] == ':') {
|
||||
prefix = words[0].mid(1);
|
||||
while(wordPos < words.count() && words[wordPos++].isEmpty())
|
||||
return qMakePair(QString(), QList<QVariant>() << QVariant());
|
||||
}
|
||||
|
||||
QString command(words[wordPos]);
|
||||
QList<QVariant> params;
|
||||
int cmdNum = command.toInt();
|
||||
if(cmdNum != 0) {
|
||||
params << QVariant::fromValue(IRCName((prefix + ':' + command).toUtf8(), "", prefix));
|
||||
command = "numeric";
|
||||
} else {
|
||||
if(prefix.isEmpty()) params << QVariant::fromValue(IRCName("","",""));
|
||||
else if(prefix.contains('@')) params << QVariant::fromValue(IRCName::fromName(prefix));
|
||||
else params << QVariant::fromValue(IRCName(prefix, prefix, prefix));
|
||||
}
|
||||
|
||||
while(wordPos++ < words.count()-1) {
|
||||
if(words[wordPos].isEmpty()) continue;
|
||||
if(words[wordPos][0] == ':') {
|
||||
QByteArray trailing = words[wordPos++].mid(1);
|
||||
while(wordPos < words.count())
|
||||
trailing = trailing + ' ' + words[wordPos++];
|
||||
params << trailing;
|
||||
break;
|
||||
}
|
||||
params << words[wordPos];
|
||||
}
|
||||
|
||||
if(command == "numeric") {
|
||||
params.removeAt(1); // always your own nick
|
||||
while(params[1].toByteArray() == "=" || params[1].toByteArray() == "@")
|
||||
params.removeAt(1); // nothing important
|
||||
if(params.size() == 2) {
|
||||
params.push_front(QByteArray()); // make it show up in the system window
|
||||
params.swap(0, 1);
|
||||
} else if(cmdNum < 300 || params.size() > 3) { // some numeric responses aren't a single string
|
||||
QList<QVariant> newparams;
|
||||
newparams << params[0];
|
||||
int i;
|
||||
if(cmdNum < 300) {
|
||||
newparams << QByteArray();
|
||||
i = 1;
|
||||
} else {
|
||||
newparams << params[1];
|
||||
i = 2;
|
||||
}
|
||||
QByteArray ba;
|
||||
for(; i < params.count(); i++) ba += params[i].toByteArray() + ' ';
|
||||
newparams << ba;
|
||||
params = newparams;
|
||||
}
|
||||
} else if(command == "PRIVMSG") {
|
||||
QByteArray p2 = params[2].toByteArray();
|
||||
if(p2.size() > 0 && p2[0] == '\001') {
|
||||
message = p2.replace("\001", "");
|
||||
int spacePos = message.indexOf(' ');
|
||||
if(spacePos == -1) spacePos = message.size();
|
||||
command = "CTCP-"+message.left(spacePos);
|
||||
params[2] = message.mid(spacePos);
|
||||
}
|
||||
} else if(command == "NOTICE" && params[0].isNull()) {
|
||||
params[0] = QVariant::fromValue(IRCName(params[1].toByteArray(), "", params[1].toByteArray()));
|
||||
}
|
||||
|
||||
return qMakePair(command, params);
|
||||
}
|
||||
|
||||
IRCName IRCName::fromName(const QByteArray& name) {
|
||||
QRegExp re("([^@!]*)(?:!([^@]*)?)(?:@(.*))?");
|
||||
re.exactMatch(QString::fromUtf8(name.data()));
|
||||
return IRCName(re.cap(1).toUtf8(), re.cap(2).toUtf8(), re.cap(3).toUtf8());
|
||||
}
|
||||
|
||||
IRCName::IRCName(QByteArray nick, QByteArray ident, QByteArray host) : nick(nick), ident(ident), host(host) {}
|
||||
|
||||
QByteArray IRCName::assemble() const {
|
||||
return nick + (ident.isEmpty() ? QByteArray() : '!' + ident) + (host.isEmpty() ? QByteArray() : '@' + host);
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef QXTIRCPEER_H
|
||||
#define QXTIRCPEER_H
|
||||
|
||||
#include <QxtRPCPeer>
|
||||
#include <qxtabstractsignalserializer.h>
|
||||
|
||||
struct IRCName {
|
||||
IRCName(QByteArray nick = QByteArray(), QByteArray ident = QByteArray(), QByteArray host = QByteArray());
|
||||
QByteArray nick;
|
||||
QByteArray ident;
|
||||
QByteArray host;
|
||||
QByteArray assemble() const;
|
||||
static IRCName fromName(const QByteArray& name);
|
||||
};
|
||||
Q_DECLARE_METATYPE(IRCName)
|
||||
|
||||
class IRCSerializer : public QxtAbstractSignalSerializer {
|
||||
public:
|
||||
IRCSerializer();
|
||||
virtual QByteArray serialize(const QString& fn, const QVariant& p1 = QVariant(), const QVariant& p2 = QVariant(), const QVariant& p3 = QVariant(),
|
||||
const QVariant& p4 = QVariant(), const QVariant& p5 = QVariant(), const QVariant& p6 = QVariant(),
|
||||
const QVariant& p7 = QVariant(), const QVariant& p8 = QVariant()) const;
|
||||
virtual DeserializedData deserialize(QByteArray& data);
|
||||
virtual bool canDeserialize(const QByteArray& buffer) const;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,7 +0,0 @@
|
|||
TEMPLATE = app
|
||||
TARGET =
|
||||
CONFIG += qxt
|
||||
QXT += network
|
||||
HEADERS += mainwindow.h ircpeer.h dialog.h
|
||||
SOURCES += mainwindow.cpp ircpeer.cpp dialog.cpp
|
||||
FORMS += dialog.ui
|
|
@ -1,205 +0,0 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow() : QMainWindow(0) {
|
||||
centralwidget = new QWidget(this);
|
||||
gridLayout = new QGridLayout(centralwidget);
|
||||
tabWidget = new QTabWidget(centralwidget);
|
||||
tabWidget->setTabPosition(QTabWidget::South);
|
||||
gridLayout->addWidget(tabWidget, 0, 0, 1, 2);
|
||||
pushButton = new QPushButton("&Send", centralwidget);
|
||||
gridLayout->addWidget(pushButton, 1, 1, 1, 1);
|
||||
|
||||
lineEdit = new QLineEdit(centralwidget);
|
||||
gridLayout->addWidget(lineEdit, 1, 0, 1, 1);
|
||||
setCentralWidget(centralwidget);
|
||||
|
||||
QObject::connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(send()));
|
||||
QObject::connect(pushButton, SIGNAL(clicked()), this, SLOT(send()));
|
||||
QObject::connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabActivated(int)));
|
||||
lineEdit->installEventFilter(this);
|
||||
|
||||
irc.setSerializer(new IRCSerializer);
|
||||
irc.attachSlot("PRIVMSG",this, SLOT(receiveMessage(IRCName, QByteArray, QByteArray)));
|
||||
irc.attachSlot("NOTICE",this, SLOT(receiveNotice(IRCName, QByteArray, QByteArray)));
|
||||
irc.attachSlot("JOIN",this, SLOT(userJoin(IRCName, QByteArray)));
|
||||
irc.attachSlot("PART",this, SLOT(userPart(IRCName, QByteArray)));
|
||||
irc.attachSlot("QUIT",this, SLOT(userQuit(IRCName, QByteArray)));
|
||||
irc.attachSlot("PING",this, SLOT(pong(IRCName, QByteArray)));
|
||||
irc.attachSlot("CTCP-ACTION",this, SLOT(receiveAction(IRCName, QByteArray, QByteArray)));
|
||||
irc.attachSlot("system",this, SLOT(receiveMessage(IRCName, QByteArray, QByteArray)));
|
||||
irc.attachSlot("numeric",this, SLOT(receiveMessage(IRCName, QByteArray, QByteArray)));
|
||||
irc.attachSignal(this, SIGNAL(sendMessage(IRCName, QByteArray, QByteArray)), "PRIVMSG");
|
||||
QObject::connect(&irc, SIGNAL(connectedToServer()), this, SLOT(peerConnected()));
|
||||
QObject::connect(&irc, SIGNAL(serverError(QAbstractSocket::SocketError)), this, SLOT(peerError(QAbstractSocket::SocketError)));
|
||||
connect(this, SIGNAL(sendMessage(IRCName, QByteArray, QByteArray)), this, SLOT(receiveMessage(IRCName, QByteArray, QByteArray)));
|
||||
|
||||
setWindowTitle("Qxt RPC IRC example");
|
||||
resize(800,600);
|
||||
QTimer::singleShot(0,this,SLOT(lateInit()));
|
||||
}
|
||||
|
||||
void MainWindow::lateInit() {
|
||||
if(condiag.exec()) {
|
||||
irc.connect(condiag.hostname(), condiag.port());
|
||||
receiveMessage(IRCName(condiag.hostname()),condiag.hostname(),
|
||||
"connecting to "+condiag.hostname()+':'+QByteArray::number(condiag.port()));
|
||||
} else {
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::pong(IRCName, QByteArray key) {
|
||||
irc.call("PONG", QVariant(), key);
|
||||
}
|
||||
|
||||
void MainWindow::peerConnected() {
|
||||
irc.call("USER", QVariant(), condiag.nickname(), condiag.hostname(), condiag.hostname(), QByteArray("QxtRPCPeer"));
|
||||
irc.call("NICK", QVariant(), condiag.nickname());
|
||||
|
||||
receiveMessage(IRCName(condiag.hostname()),condiag.hostname(),"connected. type /join #channel, to join a channel");
|
||||
lineEdit->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
void MainWindow::peerError(QAbstractSocket::SocketError e) {
|
||||
receiveMessage(IRCName(condiag.hostname()),condiag.hostname(),"QAbstractSocket::SocketError "+QByteArray::number(e));
|
||||
}
|
||||
|
||||
void MainWindow::receiveMessage(IRCName nick, QByteArray channel, QByteArray message) {
|
||||
if(message.startsWith(QByteArray("\001ACTION ")))
|
||||
receiveAction(nick, channel, message.mid(8, message.size()-9));
|
||||
else
|
||||
logMessage(nick, channel, message, "<%1> %2");
|
||||
}
|
||||
|
||||
void MainWindow::receiveNotice(IRCName nick, QByteArray channel, QByteArray message) {
|
||||
logMessage(nick, channel, message, "[%1] %2");
|
||||
}
|
||||
|
||||
void MainWindow::receiveAction(IRCName nick, QByteArray channel, QByteArray message) {
|
||||
logMessage(nick, channel, message, "* %1 %2");
|
||||
}
|
||||
|
||||
void MainWindow::userJoin(IRCName nick, QByteArray channel) {
|
||||
if(channels.contains(nick.nick))
|
||||
logMessage(nick, nick.nick, channel, "! %1 joined %2");
|
||||
logMessage(nick, channel, "joined the channel", "! %1 %2");
|
||||
}
|
||||
|
||||
void MainWindow::userPart(IRCName nick, QByteArray channel) {
|
||||
if(nick.nick == condiag.nickname()) return;
|
||||
logMessage(nick, channel, "left the channel", "! %1 %2");
|
||||
}
|
||||
|
||||
void MainWindow::userQuit(IRCName nick, QByteArray message) {
|
||||
if(channels.contains(nick.nick))
|
||||
logMessage(nick, nick.nick, message, "! %1 Quit: %2");
|
||||
logMessage(nick, "", message, "! %1 Quit: %2");
|
||||
}
|
||||
|
||||
void MainWindow::logMessage(IRCName nick, QByteArray channel, QByteArray message, QString format) {
|
||||
if(channel == condiag.nickname()) {
|
||||
if(channel == nick.nick)
|
||||
channel = condiag.hostname();
|
||||
else
|
||||
channel = nick.nick;
|
||||
}
|
||||
if(channel.isEmpty() || channel == "AUTH") {
|
||||
channel = condiag.hostname();
|
||||
} else if(!channels.contains(channel)) {
|
||||
channels[channel] = new QTextBrowser();
|
||||
channels[channel]->setFrameShape(QFrame::NoFrame);
|
||||
tabWidget->addTab(channels[channel], channel);
|
||||
}
|
||||
channels[channel]->append(format.arg(QString(nick.nick)).arg(QString(message)));
|
||||
channels[channel]->moveCursor(QTextCursor::End);
|
||||
channels[channel]->ensureCursorVisible();
|
||||
int index = tabWidget->indexOf(channels[channel]);
|
||||
if(index != tabWidget->currentIndex())
|
||||
tabWidget->setTabIcon(index, qApp->style()->standardIcon(QStyle::SP_ArrowRight));
|
||||
qApp->alert(this, 250);
|
||||
}
|
||||
|
||||
void MainWindow::send() {
|
||||
QByteArray msg=lineEdit->text().toUtf8();
|
||||
if(msg.trimmed().isEmpty()) return;
|
||||
|
||||
if(msg.startsWith('/')) {
|
||||
if(msg.startsWith(QByteArray("/join "))) {
|
||||
if(msg.mid(6,1) == "#" || msg.mid(6,1) == "&")
|
||||
irc.call("JOIN", QVariant(),msg.mid(6));
|
||||
|
||||
receiveMessage(IRCName(condiag.hostname()),msg.mid(6),"you have joined "+msg.mid(6));
|
||||
tabWidget->setCurrentWidget(channels[msg.mid(6)]);
|
||||
} else if(msg.startsWith(QByteArray("/me "))) {
|
||||
emit sendMessage(IRCName(condiag.nickname().toUtf8()),
|
||||
tabWidget->tabText(tabWidget->currentIndex()).toUtf8(),
|
||||
QByteArray("\001ACTION " + msg.mid(4) + "\001"));
|
||||
} else if(msg.startsWith(QByteArray("/names"))) {
|
||||
if(msg == "/names")
|
||||
irc.call("NAMES", QVariant(), tabWidget->tabText(tabWidget->currentIndex()).toUtf8());
|
||||
else
|
||||
irc.call("NAMES", QVariant(), msg.mid(7));
|
||||
} else if(msg == "/part") {
|
||||
partCurrentChannel();
|
||||
} else if(msg.startsWith(QByteArray("/raw "))) {
|
||||
irc.call("raw", msg.mid(5));
|
||||
} else if(msg == "/quit") {
|
||||
qApp->quit();
|
||||
} else {
|
||||
receiveMessage(IRCName(condiag.hostname()),condiag.hostname(),"unknown command "+msg);
|
||||
}
|
||||
} else {
|
||||
emit sendMessage(IRCName(condiag.nickname().toUtf8()),
|
||||
tabWidget->tabText(tabWidget->currentIndex()).toUtf8(), msg);
|
||||
}
|
||||
|
||||
lineEdit->clear();
|
||||
}
|
||||
|
||||
void MainWindow::partCurrentChannel() {
|
||||
if(tabWidget->currentIndex() == 0) return;
|
||||
if(tabWidget->tabText(tabWidget->currentIndex())[0] == '#' || tabWidget->tabText(tabWidget->currentIndex())[0] == '&')
|
||||
irc.call("PART", QVariant(), tabWidget->tabText(tabWidget->currentIndex()).toUtf8());
|
||||
channels.remove(tabWidget->tabText(tabWidget->currentIndex()).toUtf8());
|
||||
tabWidget->currentWidget()->deleteLater();
|
||||
tabWidget->removeTab(tabWidget->currentIndex());
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject* obj, QEvent* event) {
|
||||
if(obj != lineEdit) return false;
|
||||
if(event->type() != QEvent::KeyPress) return false;
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(event);
|
||||
if(ke->key() == Qt::Key_PageUp || ke->key() == Qt::Key_PageDown) {
|
||||
QScrollBar* scroll = qobject_cast<QTextBrowser*>(tabWidget->currentWidget())->verticalScrollBar();
|
||||
if(ke->key() == Qt::Key_PageUp)
|
||||
scroll->triggerAction(QScrollBar::SliderPageStepSub);
|
||||
else
|
||||
scroll->triggerAction(QScrollBar::SliderPageStepAdd);
|
||||
return true;
|
||||
}
|
||||
if(ke->modifiers().testFlag(Qt::ControlModifier) && (ke->key() == Qt::Key_F4 || ke->key() == Qt::Key_W)) {
|
||||
partCurrentChannel();
|
||||
return true;
|
||||
}
|
||||
if(ke->key() != Qt::Key_Tab && ke->key() != Qt::Key_Backtab) return false;
|
||||
if(!ke->modifiers().testFlag(Qt::ControlModifier)) return false;
|
||||
int nextTab = tabWidget->currentIndex();
|
||||
if(ke->key() == Qt::Key_Backtab)
|
||||
nextTab--;
|
||||
else
|
||||
nextTab++;
|
||||
if(nextTab == -1) nextTab = tabWidget->count() - 1;
|
||||
if(nextTab == tabWidget->count()) nextTab = 0;
|
||||
tabWidget->setCurrentIndex(nextTab);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::tabActivated(int index) {
|
||||
tabWidget->setTabIcon(index, QIcon());
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
QApplication app(argc, argv);
|
||||
MainWindow main;
|
||||
main.show();
|
||||
return app.exec();
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef MAINWINDOW_H_INCLUDED
|
||||
#define MAINWINDOW_H_INCLUDED
|
||||
#include <QtGui>
|
||||
#include <QHash>
|
||||
#include "ircpeer.h"
|
||||
#include "dialog.h"
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
private slots:
|
||||
void lateInit();
|
||||
void peerConnected();
|
||||
void peerError(QAbstractSocket::SocketError);
|
||||
void receiveMessage(IRCName, QByteArray, QByteArray);
|
||||
void receiveNotice(IRCName, QByteArray, QByteArray);
|
||||
void receiveAction(IRCName, QByteArray, QByteArray);
|
||||
void userJoin(IRCName, QByteArray);
|
||||
void userPart(IRCName, QByteArray);
|
||||
void userQuit(IRCName, QByteArray);
|
||||
void logMessage(IRCName, QByteArray, QByteArray, QString);
|
||||
void send();
|
||||
void tabActivated(int index);
|
||||
void partCurrentChannel();
|
||||
void pong(IRCName, QByteArray);
|
||||
signals:
|
||||
void sendMessage(IRCName, QByteArray, QByteArray);
|
||||
private:
|
||||
QWidget *centralwidget;
|
||||
QGridLayout *gridLayout;
|
||||
QTabWidget *tabWidget;
|
||||
QLineEdit *lineEdit;
|
||||
QPushButton *pushButton;
|
||||
QMenuBar *menubar;
|
||||
QHash <QByteArray,QTextBrowser*> channels;
|
||||
QxtRPCPeer irc;
|
||||
ConnectDialog condiag;
|
||||
};
|
||||
#endif // MAINWINDOW_H_INCLUDED
|
|
@ -1,12 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
return a.exec();
|
||||
}
|
|
@ -1,445 +0,0 @@
|
|||
#include "mainwindow.h"
|
||||
#include <QxtPop3Reply>
|
||||
#include <QPair>
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QSslSocket>
|
||||
|
||||
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent): QMainWindow(parent), pop(0), msg(0)
|
||||
{
|
||||
setupUi(this);
|
||||
settings = new QSettings(QSettings::UserScope,"Qxt", "MailTest", this);
|
||||
pop = new QxtPop3(this);
|
||||
pop->sslSocket()->setProtocol(QSsl::TlsV1);
|
||||
pop->sslSocket()->setPeerVerifyMode(QSslSocket::QueryPeer);
|
||||
QString username = settings->value("username").toString();
|
||||
QString hostname = settings->value("hostname").toString();
|
||||
QString pass = settings->value("password").toString();
|
||||
int port = settings->value("port").toInt();
|
||||
bool ok;
|
||||
Encryption enc = Encryption(settings->value("encryption").toInt(&ok));
|
||||
if (!ok) enc = Clear;
|
||||
switch (enc)
|
||||
{
|
||||
case UseSSL:
|
||||
sslRadioButton->setChecked(true);
|
||||
break;
|
||||
case UseStartTLS:
|
||||
startTLSRadioButton->setChecked(true);
|
||||
break;
|
||||
case Clear:
|
||||
default:
|
||||
clearRadioButton->setChecked(true);
|
||||
break;
|
||||
}
|
||||
usernameLineEdit->setText(username);
|
||||
hostnameLineEdit->setText(hostname);
|
||||
passwordLineEdit->setText(pass);
|
||||
if (port != 0) portLineEdit->setText(QString::number(port));
|
||||
connect(connectPushButton, SIGNAL(clicked()), this, SLOT(connectToHost()));
|
||||
connect(settingsPushButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
|
||||
connect(pop, SIGNAL(disconnected()), this, SLOT(disconnected()));
|
||||
connect(pop, SIGNAL(connected()), this, SLOT(connected()));
|
||||
connect(pop, SIGNAL(connectionFailed(QByteArray)), this, SLOT(handleSslError(QByteArray)));
|
||||
connect(pop, SIGNAL(encryptionFailed(QByteArray)), this, SLOT(handleSslError(QByteArray)));
|
||||
connect(pop, SIGNAL(authenticationFailed(QByteArray)), this, SLOT(handleAuthError(QByteArray)));
|
||||
connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(newCmd()));
|
||||
help();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if (msg) delete msg;
|
||||
}
|
||||
|
||||
void MainWindow::newCmd()
|
||||
{
|
||||
QxtPop3Reply* reply = 0;
|
||||
QString line = lineEdit->text();
|
||||
lineEdit->clear();
|
||||
QStringList words = line.split(" ", QString::SkipEmptyParts);
|
||||
if (words[0] == "quit")
|
||||
{
|
||||
if (!pop->isConnected()) return;
|
||||
reply = pop->quit();
|
||||
connect(reply, SIGNAL(finished(int)), this, SLOT(handleQuit(int)));
|
||||
plainTextEdit->appendPlainText("QUIT sent");
|
||||
}
|
||||
else if (words[0] == "stat")
|
||||
{
|
||||
if (!pop->isConnected()) return;
|
||||
reply = pop->stat();
|
||||
connect(reply, SIGNAL(finished(int)), this, SLOT(handleStat(int)));
|
||||
output("STAT sent");
|
||||
}
|
||||
else if (words[0] == "list")
|
||||
{
|
||||
if (!pop->isConnected()) return;
|
||||
reply = pop->messageList();
|
||||
connect(reply, SIGNAL(finished(int)), this, SLOT(handleList(int)));
|
||||
output("LIST sent");
|
||||
}
|
||||
else if (words[0] == "retr")
|
||||
{
|
||||
if (!pop->isConnected()) return;
|
||||
if (words.length() < 2)
|
||||
{
|
||||
output("Usage: retr <which>");
|
||||
return;
|
||||
}
|
||||
int which = words[1].toInt();
|
||||
reply = pop->retrieveMessage(which);
|
||||
connect(reply, SIGNAL(finished(int)), this, SLOT(handleRetr(int)));
|
||||
connect(reply, SIGNAL(progress(int)), this, SLOT(progress(int)));
|
||||
output("RETR sent");
|
||||
}
|
||||
else if (words[0] == "dele")
|
||||
{
|
||||
if (!pop->isConnected()) return;
|
||||
if (words.length() < 2)
|
||||
{
|
||||
output("Usage: dele <which>");
|
||||
return;
|
||||
}
|
||||
int which = words[1].toInt();
|
||||
reply = pop->deleteMessage(which);
|
||||
connect(reply, SIGNAL(finished(int)), this, SLOT(handleDele(int)));
|
||||
output("DELE sent");
|
||||
}
|
||||
else if (words[0] == "reset")
|
||||
{
|
||||
if (!pop->isConnected()) return;
|
||||
reply = pop->reset();
|
||||
connect(reply, SIGNAL(finished(int)), this, SLOT(handleRset(int)));
|
||||
output("RSET sent");
|
||||
}
|
||||
else if (words[0] == "help")
|
||||
{
|
||||
help();
|
||||
}
|
||||
else if (words[0] == "saveatt")
|
||||
{
|
||||
if (msg == 0)
|
||||
{
|
||||
output("no current message.");
|
||||
return;
|
||||
}
|
||||
if (words.length() < 2)
|
||||
{
|
||||
output("Usage: saveatt <attachment name>");
|
||||
return;
|
||||
}
|
||||
if (!msg->attachments().contains(words[1]))
|
||||
{
|
||||
output(QString("no such attachment: ") + words[1]);
|
||||
return;
|
||||
}
|
||||
QxtMailAttachment att = msg->attachment(words[1]);
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Save attachment", QString("./") + words[1]);
|
||||
if (!filename.isEmpty())
|
||||
{
|
||||
QFile file(filename);
|
||||
QIODevice::OpenMode flags = QIODevice::WriteOnly;
|
||||
if (att.isText()) flags |= QIODevice::Text;
|
||||
file.open(flags);
|
||||
file.write(att.rawData());
|
||||
file.close();
|
||||
output("Attachment saved");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output("unhandled command");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::handleQuit(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case QxtPop3Reply::OK:
|
||||
output("QUIT: OK received");
|
||||
break;
|
||||
case QxtPop3Reply::Aborted:
|
||||
printError();
|
||||
output("QUIT aborted.");
|
||||
break;
|
||||
case QxtPop3Reply::Timeout:
|
||||
output("QUIT: time out.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleStat(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case QxtPop3Reply::OK:
|
||||
{
|
||||
QxtPop3StatReply* reply = dynamic_cast<QxtPop3StatReply*>(sender());
|
||||
if (reply == 0)
|
||||
{
|
||||
qWarning("MainWindow::handleStat: sender is not a QxtPop3StatReply !");
|
||||
return;
|
||||
}
|
||||
output(QString("STAT: %1 messages, %2 bytes").arg(reply->count()).arg(reply->size()));
|
||||
}
|
||||
break;
|
||||
case QxtPop3Reply::Aborted:
|
||||
printError();
|
||||
output("STAT aborted.");
|
||||
break;
|
||||
case QxtPop3Reply::Timeout:
|
||||
output("STAT: time out.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleList(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case QxtPop3Reply::OK:
|
||||
output("LIST: OK received");
|
||||
{
|
||||
QxtPop3ListReply* reply = dynamic_cast<QxtPop3ListReply*>(sender());
|
||||
if (reply == 0)
|
||||
{
|
||||
qWarning("MainWindow::handleList: sender is not a QxtPop3ListReply !");
|
||||
return;
|
||||
}
|
||||
foreach (QxtPop3Reply::MessageInfo msginfo, reply->list())
|
||||
{
|
||||
output(QString("message %1: %2 bytes").arg(msginfo.id).arg(msginfo.size));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QxtPop3Reply::Aborted:
|
||||
printError();
|
||||
output("LIST aborted.");
|
||||
break;
|
||||
case QxtPop3Reply::Timeout:
|
||||
output("LIST: time out.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleRetr(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case QxtPop3Reply::OK:
|
||||
output("RETR: OK received");
|
||||
{
|
||||
QxtPop3RetrReply* reply = dynamic_cast<QxtPop3RetrReply *>(sender());
|
||||
if (reply == 0)
|
||||
{
|
||||
qWarning("MainWindow::handleRetr: sender is not a QxtPop3RetrReply !");
|
||||
return;
|
||||
}
|
||||
if (msg)
|
||||
{
|
||||
delete msg;
|
||||
}
|
||||
msg = reply->message();
|
||||
output("------Message Headers:");
|
||||
foreach(QString key, msg->extraHeaders().keys())
|
||||
{
|
||||
output(QString("%1: %2").arg(key, msg->extraHeader(key)));
|
||||
}
|
||||
output("------Message Body:");
|
||||
output(msg->body());
|
||||
if (msg->attachments().size() > 0)
|
||||
{
|
||||
output("------Attachments:");
|
||||
foreach(QString filename, msg->attachments().keys())
|
||||
{
|
||||
output(QString("%1: Content-Type = %2, %3 bytes")
|
||||
.arg(filename)
|
||||
.arg(msg->attachment(filename).contentType())
|
||||
.arg(msg->attachment(filename).rawData().length()));
|
||||
}
|
||||
}
|
||||
output("------End of Message\n");
|
||||
}
|
||||
break;
|
||||
case QxtPop3Reply::Aborted:
|
||||
printError();
|
||||
output("RETR aborted.");
|
||||
break;
|
||||
case QxtPop3Reply::Timeout:
|
||||
output("RETR: time out.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleDele(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case QxtPop3Reply::OK:
|
||||
output("DELE: OK received");
|
||||
break;
|
||||
case QxtPop3Reply::Aborted:
|
||||
printError();
|
||||
output("DELE aborted.");
|
||||
break;
|
||||
case QxtPop3Reply::Timeout:
|
||||
output("DELE: time out.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleRset(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case QxtPop3Reply::OK:
|
||||
output("RSET: OK received");
|
||||
break;
|
||||
case QxtPop3Reply::Aborted:
|
||||
printError();
|
||||
output("RSET aborted.");
|
||||
break;
|
||||
case QxtPop3Reply::Timeout:
|
||||
output("RSET: time out.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::printError()
|
||||
{
|
||||
QObject* s = sender();
|
||||
if (s != 0)
|
||||
{
|
||||
QxtPop3Reply* reply = qobject_cast<QxtPop3Reply*>(s);
|
||||
if (reply->status() == QxtPop3Reply::Error)
|
||||
{
|
||||
output(reply->error());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::help()
|
||||
{
|
||||
output("Available commands:");
|
||||
output("help: print this help message\n"
|
||||
"quit\n"
|
||||
"stat\n"
|
||||
"list\n"
|
||||
"retr <nb>\n"
|
||||
"dele <nb>\n"
|
||||
"reset\n"
|
||||
"saveatt <attachment name>: save attachment of last retrieved message\n");
|
||||
}
|
||||
|
||||
void MainWindow::connectToHost()
|
||||
{
|
||||
QString hostname = hostnameLineEdit->text();
|
||||
bool useSSL = sslRadioButton->isChecked();
|
||||
if (startTLSRadioButton->isChecked())
|
||||
{
|
||||
pop->setStartTlsDisabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
pop->setStartTlsDisabled(true);
|
||||
}
|
||||
bool ok;
|
||||
int port = portLineEdit->text().toInt(&ok);
|
||||
if (!ok || port == 0)
|
||||
{ // default port
|
||||
if (useSSL)
|
||||
{
|
||||
port = 995;
|
||||
}
|
||||
else
|
||||
{
|
||||
port = 110;
|
||||
}
|
||||
}
|
||||
QString username = usernameLineEdit->text();
|
||||
QString pass = passwordLineEdit->text();
|
||||
pop->setUsername(username.toLocal8Bit());
|
||||
pop->setPassword(pass.toLocal8Bit());
|
||||
if (useSSL)
|
||||
{
|
||||
pop->connectToSecureHost(hostname.toLocal8Bit(), port);
|
||||
}
|
||||
else
|
||||
{
|
||||
pop->connectToHost(hostname.toLocal8Bit(), port);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::saveSettings()
|
||||
{
|
||||
QString hostname = hostnameLineEdit->text();
|
||||
settings->setValue("hostname", hostname);
|
||||
Encryption enc;
|
||||
if(sslRadioButton->isChecked())
|
||||
{
|
||||
enc = UseSSL;
|
||||
}
|
||||
else if (startTLSRadioButton->isChecked())
|
||||
{
|
||||
enc = UseStartTLS;
|
||||
}
|
||||
else
|
||||
{
|
||||
enc = Clear;
|
||||
}
|
||||
settings->setValue("Encryption", enc);
|
||||
bool ok;
|
||||
int port = portLineEdit->text().toInt(&ok);
|
||||
if (ok && port != 0) settings->setValue("port", port);
|
||||
QString username = usernameLineEdit->text();
|
||||
settings->setValue("username", username);
|
||||
QString pass = passwordLineEdit->text();
|
||||
settings->setValue("password", pass);
|
||||
settings->sync();
|
||||
}
|
||||
|
||||
void MainWindow::connected()
|
||||
{
|
||||
connectPushButton->setDisabled(true);
|
||||
output("Connected to host");
|
||||
}
|
||||
|
||||
void MainWindow::disconnected()
|
||||
{
|
||||
connectPushButton->setEnabled(true);
|
||||
output("Disconnected from Host");
|
||||
pop->clearReplies();
|
||||
}
|
||||
|
||||
void MainWindow::handleSslError(const QByteArray& msg)
|
||||
{
|
||||
output(QString("Ssl handshake error: ") + msg);
|
||||
}
|
||||
|
||||
void MainWindow::handleAuthError(const QByteArray& msg)
|
||||
{
|
||||
output(QString("Authentication error: ") + msg);
|
||||
}
|
||||
|
||||
void MainWindow::progress(int percent)
|
||||
{
|
||||
output(QString("Progress: %1%").arg(percent));
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QxtPop3>
|
||||
#include <QMainWindow>
|
||||
#include <QPair>
|
||||
#include <QSettings>
|
||||
|
||||
class QxtMailMessage;
|
||||
class MainWindow : public QMainWindow, public Ui::MainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow(QWidget* parent=0);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void connectToHost();
|
||||
void newCmd();
|
||||
void saveSettings();
|
||||
void handleQuit(int code);
|
||||
void handleStat(int code);
|
||||
void handleList(int code);
|
||||
void handleRetr(int code);
|
||||
void handleDele(int code);
|
||||
void handleRset(int code);
|
||||
void connected();
|
||||
void disconnected();
|
||||
void handleSslError(const QByteArray& msg);
|
||||
void handleAuthError(const QByteArray& msg);
|
||||
void progress(int percent);
|
||||
|
||||
private:
|
||||
enum Encryption {
|
||||
UseSSL,
|
||||
UseStartTLS,
|
||||
Clear
|
||||
};
|
||||
QSettings* settings;
|
||||
QxtPop3 *pop;
|
||||
QxtMailMessage* msg;
|
||||
void output(const QString& text) {plainTextEdit->appendPlainText(text);}
|
||||
void printError();
|
||||
void help();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
|
@ -1,194 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MailTest</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="hostnameLabel">
|
||||
<property name="text">
|
||||
<string>Host Name</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>hostnameLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="hostnameLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>portLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="portLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Encryption</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="sslRadioButton">
|
||||
<property name="text">
|
||||
<string>Use SSL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="startTLSRadioButton">
|
||||
<property name="text">
|
||||
<string>Use startTLS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="clearRadioButton">
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="usernameLabel">
|
||||
<property name="text">
|
||||
<string>User Name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>usernameLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="usernameLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>passwordLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="passwordLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="settingsPushButton">
|
||||
<property name="text">
|
||||
<string>Save Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="connectPushButton">
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Command:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>hostnameLineEdit</tabstop>
|
||||
<tabstop>portLineEdit</tabstop>
|
||||
<tabstop>sslRadioButton</tabstop>
|
||||
<tabstop>usernameLineEdit</tabstop>
|
||||
<tabstop>passwordLineEdit</tabstop>
|
||||
<tabstop>settingsPushButton</tabstop>
|
||||
<tabstop>connectPushButton</tabstop>
|
||||
<tabstop>lineEdit</tabstop>
|
||||
<tabstop>plainTextEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,12 +0,0 @@
|
|||
# -------------------------------------------------
|
||||
# Project created by QtCreator 2010-03-19T15:52:11
|
||||
# -------------------------------------------------
|
||||
CONFIG += qxt
|
||||
QXT += network
|
||||
TARGET =
|
||||
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp
|
||||
HEADERS += mainwindow.h
|
||||
FORMS += mainwindow.ui
|
|
@ -1,157 +0,0 @@
|
|||
#include "fsimagemodel.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QImage>
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
|
||||
struct FsImageModelImage
|
||||
{
|
||||
QFileInfo info;
|
||||
QImage image;
|
||||
};
|
||||
|
||||
FsImageModel::FsImageModel(QString path,QObject * parent ):QAbstractItemModel(parent)
|
||||
{
|
||||
dir = QDir::current();
|
||||
if(!path.isEmpty())
|
||||
dir = QDir(path);
|
||||
|
||||
connect(&watcher,SIGNAL(directoryChanged ( const QString & )),this,SLOT(directoryChanged ( const QString & )));
|
||||
connect(&watcher,SIGNAL(fileChanged ( const QString & )),this,SLOT(fileChanged ( const QString & )));
|
||||
watcher.addPath(dir.absolutePath());
|
||||
|
||||
|
||||
|
||||
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
FsImageModelImage * img= new FsImageModelImage;
|
||||
img->info=list.at(i);
|
||||
img->image.load(dir.absoluteFilePath(img->info.fileName()));
|
||||
files.append(img);
|
||||
watcher.addPath(dir.absoluteFilePath(img->info.fileName()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
FsImageModel::~FsImageModel()
|
||||
{
|
||||
qDeleteAll(files);
|
||||
}
|
||||
|
||||
QModelIndex FsImageModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
return createIndex ( row, column, files.at(row) );
|
||||
}
|
||||
|
||||
|
||||
QModelIndex FsImageModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int FsImageModel::rowCount(const QModelIndex & parent ) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return 0;
|
||||
return files.count();
|
||||
}
|
||||
|
||||
|
||||
int FsImageModel::columnCount(const QModelIndex & parent ) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
QVariant FsImageModel::data(const QModelIndex & index, int role ) const
|
||||
{
|
||||
FsImageModelImage* img=static_cast<FsImageModelImage*>(index.internalPointer());
|
||||
if(role==Qt::DisplayRole)
|
||||
return img->info.fileName();
|
||||
|
||||
if(role==Qt::DecorationRole)
|
||||
return img->image;
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
class Thread : public QThread
|
||||
{
|
||||
friend class FsImageModel;
|
||||
};
|
||||
|
||||
void FsImageModel::directoryChanged ( const QString & path )
|
||||
{
|
||||
|
||||
Q_ASSERT(path==dir.absolutePath());
|
||||
|
||||
QStringList org=watcher.files ();
|
||||
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
QString path= dir.absoluteFilePath(list.at(i).fileName());
|
||||
|
||||
if(org.contains(path))
|
||||
{
|
||||
org.removeAll(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
beginInsertRows (QModelIndex(),files.count(),files.count());
|
||||
FsImageModelImage * img= new FsImageModelImage;
|
||||
img->info=list.at(i);
|
||||
|
||||
|
||||
int retry=100;
|
||||
while(!img->image.load(path))
|
||||
{
|
||||
Thread::usleep(1000);
|
||||
if(--retry<0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}; ///hax
|
||||
files.append(img);
|
||||
watcher.addPath(path);
|
||||
endInsertRows ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach(const QString &a, org)
|
||||
fileChanged(a);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FsImageModel::fileChanged ( const QString & path )
|
||||
{
|
||||
int i=0;
|
||||
foreach(FsImageModelImage* img,files)
|
||||
{
|
||||
if(dir.absoluteFilePath(img->info.fileName())==path)
|
||||
{
|
||||
if(img->info.exists())
|
||||
{
|
||||
emit dataChanged ( index(i,0), index(i,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
beginRemoveRows (QModelIndex(),i,i);
|
||||
watcher.removePath(path);
|
||||
delete files.at(i);
|
||||
files.removeAt(i);
|
||||
endRemoveRows ();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#ifndef FSIMAGEMODEL_H_INCLUDED
|
||||
#define FSIMAGEMODEL_H_INCLUDED
|
||||
/**
|
||||
|
||||
warning: this model is a quick and dirty hack.
|
||||
it has major flaws and should not be used for anything but testing
|
||||
|
||||
*/
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDir>
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
struct FsImageModelImage;
|
||||
class FsImageModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FsImageModel(QString path,QObject * parent = 0);
|
||||
virtual ~FsImageModel();
|
||||
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual QModelIndex parent(const QModelIndex &index) const;
|
||||
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
|
||||
virtual int columnCount(const QModelIndex & parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
|
||||
private:
|
||||
QList<FsImageModelImage*> files;
|
||||
QDir dir;
|
||||
QFileSystemWatcher watcher;
|
||||
private slots:
|
||||
void directoryChanged ( const QString & path );
|
||||
void fileChanged ( const QString & path );
|
||||
};
|
||||
|
||||
#endif // FSIMAGEMODEL_H_INCLUDED
|
|
@ -1,29 +0,0 @@
|
|||
#include <QApplication>
|
||||
|
||||
#include "fsimagemodel.h"
|
||||
#include <QTreeView>
|
||||
#include <QxtFlowView>
|
||||
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication app ( argc, argv );
|
||||
|
||||
if(app.arguments().count()<2)
|
||||
qFatal("./qxtflowview /path/to/images");
|
||||
|
||||
FsImageModel model(app.arguments().at(1));
|
||||
|
||||
// QTreeView view;
|
||||
// view.setModel(&model);
|
||||
// view.show();
|
||||
|
||||
|
||||
QxtFlowView w;
|
||||
w.setSlideSize(QSize( 4*60,3*60));
|
||||
w.resize(800, 600);
|
||||
w.setModel(&model);
|
||||
w.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
TEMPLATE = app
|
||||
CONFIG+=qxt
|
||||
QXT=core gui
|
||||
HEADERS = fsimagemodel.h
|
||||
SOURCES = fsimagemodel.cpp main.cpp
|
||||
|
||||
|
||||
|