commit 0233e130a151d01b66b8afd2986e1acd6dd852c0 Author: Mikko Ahlroth Date: Wed Jan 29 11:25:18 2014 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2bd457 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +harbour-weechatrelay.pro.user diff --git a/harbour-weechatrelay.desktop b/harbour-weechatrelay.desktop new file mode 100644 index 0000000..896241f --- /dev/null +++ b/harbour-weechatrelay.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +X-Nemo-Application-Type=silica-qt5 +Name=WeeCRApp +Icon=harbour-weechatrelay +Exec=harbour-weechatrelay + diff --git a/harbour-weechatrelay.png b/harbour-weechatrelay.png new file mode 100644 index 0000000..4c883a0 Binary files /dev/null and b/harbour-weechatrelay.png differ diff --git a/harbour-weechatrelay.pro b/harbour-weechatrelay.pro new file mode 100644 index 0000000..933b184 --- /dev/null +++ b/harbour-weechatrelay.pro @@ -0,0 +1,28 @@ +# The name of your app. +# NOTICE: name defined in TARGET has a corresponding QML filename. +# If name defined in TARGET is changed, following needs to be +# done to match new name: +# - corresponding QML filename must be changed +# - desktop icon filename must be changed +# - desktop filename must be changed +# - icon definition filename in desktop file must be changed +TARGET = harbour-weechatrelay + +CONFIG += sailfishapp c++11 + +SOURCES += src/harbour-weechatrelay.cpp \ + src/relayconnection.cpp + +OTHER_FILES += qml/harbour-weechatrelay.qml \ + qml/cover/CoverPage.qml \ + qml/pages/FirstPage.qml \ + qml/pages/SecondPage.qml \ + rpm/harbour-weechatrelay.spec \ + rpm/harbour-weechatrelay.yaml \ + harbour-weechatrelay.desktop + +HEADERS += \ + src/relayconnection.h + +QT += network + diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml new file mode 100644 index 0000000..6f8e4a4 --- /dev/null +++ b/qml/cover/CoverPage.qml @@ -0,0 +1,54 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + All rights reserved. + + You may use this file under the terms of BSD license as follows: + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Jolla Ltd nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 + +CoverBackground { + Label { + id: label + anchors.centerIn: parent + text: "My Cover" + } + + CoverActionList { + id: coverAction + + CoverAction { + iconSource: "image://theme/icon-cover-next" + } + + CoverAction { + iconSource: "image://theme/icon-cover-pause" + } + } +} + + diff --git a/qml/harbour-weechatrelay.qml b/qml/harbour-weechatrelay.qml new file mode 100644 index 0000000..bb031a4 --- /dev/null +++ b/qml/harbour-weechatrelay.qml @@ -0,0 +1,41 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + All rights reserved. + + You may use this file under the terms of BSD license as follows: + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Jolla Ltd nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "pages" + +ApplicationWindow +{ + initialPage: Component { FirstPage { } } + cover: Qt.resolvedUrl("cover/CoverPage.qml") +} + + diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml new file mode 100644 index 0000000..32e2d6f --- /dev/null +++ b/qml/pages/FirstPage.qml @@ -0,0 +1,73 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + All rights reserved. + + You may use this file under the terms of BSD license as follows: + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Jolla Ltd nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 + + +Page { + id: page + + // To enable PullDownMenu, place our content in a SilicaFlickable + SilicaFlickable { + anchors.fill: parent + + // PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView + PullDownMenu { + MenuItem { + text: "Show Page 2" + onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml")) + } + } + + // Tell SilicaFlickable the height of its content. + contentHeight: column.height + + // Place our content in a Column. The PageHeader is always placed at the top + // of the page, followed by our content. + Column { + id: column + + width: page.width + spacing: Theme.paddingLarge + PageHeader { + title: "UI Template" + } + Label { + x: Theme.paddingLarge + text: "Hello Sailors" + color: Theme.secondaryHighlightColor + font.pixelSize: Theme.fontSizeExtraLarge + } + } + } +} + + diff --git a/qml/pages/SecondPage.qml b/qml/pages/SecondPage.qml new file mode 100644 index 0000000..ead18dd --- /dev/null +++ b/qml/pages/SecondPage.qml @@ -0,0 +1,62 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + All rights reserved. + + You may use this file under the terms of BSD license as follows: + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Jolla Ltd nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 + + +Page { + id: page + SilicaListView { + id: listView + model: 20 + anchors.fill: parent + header: PageHeader { + title: "Nested Page" + } + delegate: BackgroundItem { + id: delegate + + Label { + x: Theme.paddingLarge + text: "Item " + index + anchors.verticalCenter: parent.verticalCenter + color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor + } + onClicked: console.log("Clicked " + index) + } + VerticalScrollDecorator {} + } +} + + + + + diff --git a/rpm/harbour-weechatrelay.spec b/rpm/harbour-weechatrelay.spec new file mode 100644 index 0000000..b097a16 --- /dev/null +++ b/rpm/harbour-weechatrelay.spec @@ -0,0 +1,75 @@ +# +# Do NOT Edit the Auto-generated Part! +# Generated by: spectacle version 0.27 +# + +Name: harbour-weechatrelay + +# >> macros +# << macros + +%{!?qtc_qmake:%define qtc_qmake %qmake} +%{!?qtc_qmake5:%define qtc_qmake5 %qmake5} +%{!?qtc_make:%define qtc_make make} +%{?qtc_builddir:%define _builddir %qtc_builddir} +Summary: WeeChat Relay +Version: 0.1 +Release: 1 +Group: Qt/Qt +License: LICENSE +URL: http://example.org/ +Source0: %{name}-%{version}.tar.bz2 +Source100: harbour-weechatrelay.yaml +Requires: sailfishsilica-qt5 >= 0.10.9 +BuildRequires: pkgconfig(Qt5Quick) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(sailfishapp) >= 0.0.10 +BuildRequires: desktop-file-utils + +%description +Short description of my SailfishOS Application + + +%prep +%setup -q -n %{name}-%{version} + +# >> setup +# << setup + +%build +# >> build pre +# << build pre + +%qtc_qmake5 + +%qtc_make %{?_smp_mflags} + +# >> build post +# << build post + +%install +rm -rf %{buildroot} +# >> install pre +# << install pre +%qmake5_install + +# >> install post +# << install post + +desktop-file-install --delete-original \ + --dir %{buildroot}%{_datadir}/applications \ + %{buildroot}%{_datadir}/applications/*.desktop + +%files +%defattr(-,root,root,-) +%{_bindir} +%{_datadir}/%{name}/qml +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/86x86/apps/%{name}.png +/usr/bin +/usr/share/harbour-weechatrelay +/usr/share/applications +/usr/share/icons/hicolor/86x86/apps +# >> files +# << files diff --git a/rpm/harbour-weechatrelay.yaml b/rpm/harbour-weechatrelay.yaml new file mode 100644 index 0000000..37ff4b4 --- /dev/null +++ b/rpm/harbour-weechatrelay.yaml @@ -0,0 +1,29 @@ +Name: harbour-weechatrelay +Summary: WeeCRApp +Version: 0.1 +Release: 1 +Group: Qt/Qt +URL: http://example.org/ +License: LICENSE +Sources: +- '%{name}-%{version}.tar.bz2' +Description: "" +Configure: none +Builder: qtc5 +PkgConfigBR: +- Qt5Quick +- Qt5Qml +- Qt5Core +- sailfishapp >= 0.0.10 +Requires: +- sailfishsilica-qt5 >= 0.10.9 +Files: +- '%{_bindir}' +- '%{_datadir}/%{name}/qml' +- '%{_datadir}/applications/%{name}.desktop' +- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png' +- /usr/bin +- /usr/share/harbour-weechatrelay +- /usr/share/applications +- /usr/share/icons/hicolor/86x86/apps +PkgBR: [] diff --git a/src/harbour-weechatrelay.cpp b/src/harbour-weechatrelay.cpp new file mode 100644 index 0000000..1d58d72 --- /dev/null +++ b/src/harbour-weechatrelay.cpp @@ -0,0 +1,50 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + All rights reserved. + + You may use this file under the terms of BSD license as follows: + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Jolla Ltd nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef QT_QML_DEBUG +#include +#endif + +#include + +int main(int argc, char *argv[]) +{ + // SailfishApp::main() will display "qml/template.qml", if you need more + // control over initialization, you can use: + // + // - SailfishApp::application(int, char *[]) to get the QGuiApplication * + // - SailfishApp::createView() to get a new QQuickView * instance + // - SailfishApp::pathTo(QString) to get a QUrl to a resource file + // + // To display the view, call "show()" (will show fullscreen on device). + + return SailfishApp::main(argc, argv); +} + diff --git a/src/relayconnection.cpp b/src/relayconnection.cpp new file mode 100644 index 0000000..5f97fb4 --- /dev/null +++ b/src/relayconnection.cpp @@ -0,0 +1,36 @@ +#include "relayconnection.h" +#include + +/*QSslSocket socket; +socket.connectToHostEncrypted("nytsoi.net", 5555); +if (!socket.waitForEncrypted()) { + qDebug() << socket.errorString(); + QSslCertificate cert = socket.peerCertificate(); + QStringList info = cert.issuerInfo(QSslCertificate::Organization); + + for (QString str : info) + { + qDebug() << "Info: " << str; + } + + qDebug() << cert.effectiveDate().toString(); + qDebug() << cert.expiryDate().toString(); + qDebug() << cert.publicKey().toPem(); + qDebug() << "SHA-256 digest: " << cert.digest(QCryptographicHash::Sha256).toHex(); + return 1; +}*/ + +RelayConnection::RelayConnection(QTcpSocket* socket): + socket(socket) +{ +} + +void RelayConnection::readForever() +{ + while (true) + { + QByteArray readBytes = this->socket->readAll(); + QByteArray pe = readBytes.toPercentEncoding(); + qDebug(pe.constData()); + } +} diff --git a/src/relayconnection.h b/src/relayconnection.h new file mode 100644 index 0000000..a38670e --- /dev/null +++ b/src/relayconnection.h @@ -0,0 +1,19 @@ +#ifndef RELAYCONNECTION_H +#define RELAYCONNECTION_H + +#include + +class RelayConnection +{ +public: + RelayConnection(QTcpSocket* socket); + + void readForever(); + + + +private: + QTcpSocket* socket; +}; + +#endif // RELAYCONNECTION_H