PDA

View Full Version : How to use plugins in Qt?



kremuwa
24th February 2010, 23:08
Hello there.

I am real newbie here and I'm not experienced in Unix-like systems. I'm using Windows and Qt 4.6.2. I'd like to use an algorithm to encrypt logins and passwords to mailboxes (to make simple p2m client) and i thought AES algorithm will be a good choice. I've found such a plugin:
http://delta.affinix.com/qca/
...downloaded the source but don't know how to "merge" it with my Qt installation, and how to use it after that.

1. Is it a good choice? I mean both: the algorithm and the plugin.
2. How to use plugins for Qt? Please, just don't beat me too hard. :)

Michal (PL, 17 y.o.)

bender86
27th February 2010, 09:13
After compiled it you should put the supplied crypto.prf.in inside your %QTDIR%/makespec/features (rename it to crypto.prf). Then in your .pro file just add CONFIG += crypto.
You should also prepend definitions for QCA_INCDIR/QCA_LIBDIR in the file, and maybe you will have make some changes. See mine for an example (I use it on windows with msvc2008).

Otherwise, you can also add manually in your .pro file the variables:
INCLUDEPATH = "/path/to/qca/include"
LIBS = "/path/to/qca/lib/qca.lib" # Or whatever is called the library.

My crypto.prf (I added a condition for release build):

QCA_INCDIR = "C:\QCA\2.0.2\x64\include"
QCA_LIBDIR = "C:\QCA\2.0.2\x64\lib"

# NOTE: any changes made to this file need to be tracked in qcm/qca.qcm

CONFIG *= qt

# if we are including crypto.prf from the qca tree (and not utilizing it as
# an installed qmake CONFIG feature), then point to the tree. this allows our
# qca tree apps to build before qca itself is installed.
exists($$PWD/qca.pro) {
QCA_INCDIR = $$PWD/include
QCA_LIBDIR = $$PWD/lib
}

LINKAGE =

# on mac, if qca was built as a framework, link against it
mac: {
framework_dir = $$QCA_LIBDIR
exists($$framework_dir/qca.framework) {
#QMAKE_FRAMEWORKPATH *= $$framework_dir
LIBS += -F$$framework_dir
INCLUDEPATH += $$framework_dir/qca.framework/Headers
LINKAGE = -framework qca
}
}

# else, link normally
isEmpty(LINKAGE) {
INCLUDEPATH += $$QCA_INCDIR/QtCrypto
LIBS += -L$$QCA_LIBDIR
LINKAGE = -lqca
CONFIG(debug, debug|release) {
windows:LINKAGE = -lqcad
mac:LINKAGE = -lqca_debug
}
CONFIG(release, debug|release) {
windows:LINKAGE = -lqca
mac:LINKAGE = -lqca
}
}

LIBS += $$LINKAGE