Initial commit

This commit is contained in:
Morgan McMillian 2016-09-22 16:21:20 -07:00
commit f8f3149d94
36 changed files with 4595 additions and 0 deletions

212
.cproject Normal file
View file

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="com.qnx.qcc.toolChain.6436256">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.6436256" moduleId="org.eclipse.cdt.core.settings" name="Device-Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.6436256" name="Device-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.6436256.1067233621" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.667170479" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.1663213421" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.883156207" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.1599063325" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.1171303826" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.2067288219" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder autoBuildTarget="Device-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.6436256.225354830" incrementalBuildTarget="Device-Debug" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="device-debug builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="qml.device-debug"/>
<tool id="com.qnx.qcc.tool.compiler.798411193" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.optlevel.2057518538" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.includePath.1927876358" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1293946085" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.765743325" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.1523601258" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.923937265" name="QCC Linker" superClass="com.qnx.qcc.tool.linker">
<option id="com.qnx.qcc.option.linker.langcpp.1038648633" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraries.2006021805" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
<listOptionValue builtIn="false" value="kqoauth"/>
</option>
<option id="com.qnx.qcc.option.linker.libraryPaths.579329698" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7"/>
</option>
</tool>
<tool id="com.qnx.qcc.tool.archiver.1027686286" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.qnx.qcc.toolChain.11270187">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.11270187" moduleId="org.eclipse.cdt.core.settings" name="Device-Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.11270187" name="Device-Release" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.11270187.2029850402" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.1007494263" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.1631449047" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.620148614" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.124011685" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.1392217867" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.659861604" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder autoBuildTarget="Device-Release" enableAutoBuild="true" id="com.qnx.qcc.toolChain.11270187.1488569850" incrementalBuildTarget="Device-Release" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="device-release builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="qml.device-release"/>
<tool id="com.qnx.qcc.tool.compiler.1991066453" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.optlevel.69707806" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.includePath.1046297223" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.536509549" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.541162191" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.763307174" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.260170765" name="QCC Linker" superClass="com.qnx.qcc.tool.linker">
<option id="com.qnx.qcc.option.linker.langcpp.1010761128" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraries.1632225239" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
<listOptionValue builtIn="false" value="kqoauth"/>
</option>
<option id="com.qnx.qcc.option.linker.libraryPaths.1328267929" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7"/>
</option>
</tool>
<tool id="com.qnx.qcc.tool.archiver.850632792" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.qnx.qcc.toolChain.432090368">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.432090368" moduleId="org.eclipse.cdt.core.settings" name="Device-Profile">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.432090368" name="Device-Profile" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.432090368.849803312" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.1647537799" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.858106472" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.108544161" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.642118667" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.57973672" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.129151912" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder autoBuildTarget="Device-Profile" enableAutoBuild="true" id="com.qnx.qcc.toolChain.432090368.91215247" incrementalBuildTarget="Device-Profile" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="device-profile builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="qml.device-profile"/>
<tool id="com.qnx.qcc.tool.compiler.194983389" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.optlevel.535567233" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.includePath.713543541" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1181595712" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.1885561135" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.2077407431" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.95970603" name="QCC Linker" superClass="com.qnx.qcc.tool.linker">
<option id="com.qnx.qcc.option.linker.langcpp.2117264173" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraries.1122266132" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
<listOptionValue builtIn="false" value="kqoauth"/>
</option>
<option id="com.qnx.qcc.option.linker.libraryPaths.836842235" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7"/>
</option>
</tool>
<tool id="com.qnx.qcc.tool.archiver.1644117066" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.qnx.qcc.toolChain.657559883">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.657559883" moduleId="org.eclipse.cdt.core.settings" name="Simulator-Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.657559883" name="Simulator-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.657559883.1428020783" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.25379792" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.1337943912" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.79006866" name="Target CPU:" superClass="com.qnx.qcc.option.cpu"/>
<option id="com.qnx.qcc.option.compiler.430661012" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.1940261907" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.1680360612" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder autoBuildTarget="Simulator-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.657559883.1589851227" incrementalBuildTarget="Simulator-Debug" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="simulator-debug builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="qml.simulator-debug"/>
<tool id="com.qnx.qcc.tool.compiler.826546126" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.optlevel.720044842" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
<inputType id="com.qnx.qcc.inputType.compiler.513729261" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.29727750" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.834695584" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.376624714" name="QCC Linker" superClass="com.qnx.qcc.tool.linker">
<option id="com.qnx.qcc.option.linker.langcpp.1137072057" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
</tool>
<tool id="com.qnx.qcc.tool.archiver.1621834322" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="Goober.null.541325103" name="Goober"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.657559883">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.432090368">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.11270187">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.6436256">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
</cproject>

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
x86/
arm/
translations/*.qm
.settings/
src/globals.h

45
.project Normal file
View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Goober</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.qt.core.qtNature</nature>
<nature>com.rim.tad.tools.qml.core.qmlNature</nature>
</natures>
</projectDescription>

7
Goober.pro Normal file
View file

@ -0,0 +1,7 @@
APP_NAME = Goober
CONFIG += qt warn_on cascades10
LIBS += -lbbdata
QT += network
include(config.pri)

0
LICENSE Normal file
View file

6
Makefile Normal file
View file

@ -0,0 +1,6 @@
QMAKE_TARGET = Goober
PROJECT_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
I18N_DIR := $(PROJECT_DIR)/translations
include mk/cs-base.mk

15
assets/.assets.index Normal file
View file

@ -0,0 +1,15 @@
1
13
icons/globe.png
icons/ic_add.png
icons/ic_reload.png
icons/ic_reply.png
icons/ic_reply_all.png
icons/ic_to_bottom.png
icons/ic_to_top.png
icons/laughing_man.png
main.qml
moment.js
NewPostSheet.qml
PostItem.qml
StreamTab.qml

77
assets/NewPostSheet.qml Normal file
View file

@ -0,0 +1,77 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import bb.cascades 1.4
Sheet {
id: postSheet
property alias input: postText
property alias text: postText.text
property int count: 256
signal sendPost(string text)
Page {
titleBar: TitleBar {
acceptAction: ActionItem {
id: sendAction
title: qsTr("Send")
enabled: false
onTriggered: {
sendPost(postText.text);
postText.text = "";
postSheet.close();
}
}
dismissAction: ActionItem {
title: qsTr("Cancel")
onTriggered: {
postText.text = "";
postSheet.close();
}
}
title: qsTr("New Post")
}
Container {
Container {
TextArea {
id: postText
preferredHeight: 350.0
onTextChanging: {
if (postText.text.length > 0) {
sendAction.enabled = true;
} else {
sendAction.enabled = false;
}
count = 256 - postText.text.length
if (count < 0) sendAction.enabled = false;
}
}
}
Container {
horizontalAlignment: HorizontalAlignment.Right
Label {
text: count.toString()
}
}
}
}
}

137
assets/PostItem.qml Normal file
View file

@ -0,0 +1,137 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import bb.cascades 1.4
import org.labsquare 1.0
import "moment.js" as Moment
Container {
id: postitem
leftPadding: 20.0
rightPadding: 20.0
topPadding: 10.0
bottomPadding: 10.0
property string lorem: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse non enim tellus. Donec vestibulum enim urna, eget faucibus diam commodo a. Donec eget hendrerit metus. Pellentesque vehicula nisi nec vehicula ullamcorper. Aliquam a elit eget mi fringilla porta fermentum eget eros. Phasellus vestibulum nulla sed elit congue adipiscing. Cras imperdiet urna ac ipsum volutpat lobortis. Maecenas vehicula tortor at viverra convallis. Curabitur nibh massa, tristique id felis ut, venenatis faucibus dui. Donec fringilla, mi nec tincidunt dignissim, neque nunc semper mi, quis rutrum diam turpis sit amet erat. Cras a sodales nisi. Nunc sit amet diam sed lectus molestie cursus convallis et erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vitae varius leo. Mauris eu leo a nunc bibendum rutrum euismod et ipsum. "
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Container {
WebImageView {
id: avatar
url: ListItemData.user.content.avatar_image.link
maxWidth: 100.0
maxHeight: avatar.maxWidth
//imageSource: "asset:///laughing_man.png"
}
}
Container {
leftMargin: 20.0
Container {
Label {
id: name
text: ListItemData.user.name
textStyle.fontWeight: FontWeight.Bold
}
}
Container {
Label {
id: username
text: ListItemData.user.username
}
}
}
}
Container {
topMargin: 20.0
bottomMargin: 20.0
Label {
text: ListItemData.content.text
multiline: true
}
}
Container {
layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill
Container {
horizontalAlignment: HorizontalAlignment.Left
Label {
text: Moment.moment(ListItemData.created_at).format("lll")
textStyle.fontSize: FontSize.XSmall
}
}
Container {
horizontalAlignment: HorizontalAlignment.Right
Label {
text: ListItemData.source.name
textStyle.fontSize: FontSize.XSmall
}
}
}
Divider {}
contextActions: [
ActionSet {
title: ListItemData.user.username
ActionItem {
title: qsTr("Reply")
onTriggered: {
replySheet.text = "@" + ListItemData.user.username + " ";
replySheet.open();
replySheet.input.requestFocus();
}
imageSource: "asset:///icons/ic_reply.png"
}
ActionItem {
title: "Reply All"
onTriggered: {
replySheet.text = "@" + ListItemData.user.username + " " + parseMentions(ListItemData.content.entities.mentions);
console.log(JSON.stringify(ListItemData.content.entities.mentions))
replySheet.open();
replySheet.input.requestFocus();
}
imageSource: "asset:///icons/ic_reply_all.png"
}
}
]
attachedObjects: [
NewPostSheet {
id: replySheet
onSendPost: {
postitem.ListItem.view.sendReply(text, ListItemData.id);
}
}
]
function parseMentions(mentions) {
console.log("blarp")
var mtext = ""
for(var i = 0; i < mentions.length; i++) {
var mu = mentions[i].text
if (mu !== "thrrgilag") {
mtext += "@" + mu + " "
}
}
if (mtext.length > 0) {
return "\n/" + mtext
} else {
return ""
}
}
}

162
assets/StreamTab.qml Normal file
View file

@ -0,0 +1,162 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import bb.cascades 1.4
import com.monkeystew.pnut 1.0
import com.monkeystew.qtimer 1.0
NavigationPane {
id: nav
property string stream_type
property string endpoint
Page {
Container {
ListView {
id: streamView
dataModel: ArrayDataModel {
id: postModel
}
listItemComponents: [
ListItemComponent {
id: root
PostItem {}
}
]
function sendReply(text, pid) {
pnut.sendReply(text, pid);
}
}
}
actions: [
ActionItem {
title: qsTr("New Post")
ActionBar.placement: ActionBarPlacement.Signature
onTriggered: {
newPostSheet.open();
newPostSheet.input.requestFocus();
}
imageSource: "asset:///icons/ic_add.png"
},
ActionItem {
title: qsTr("Load Newer")
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
pnut.getStream(endpoint, Pnut.STREAM_NEWER);
}
imageSource: "asset:///icons/ic_to_top.png"
},
ActionItem {
title: qsTr("Reload")
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
postModel.clear()
pnut.beforeId = 0
pnut.sinceId = 0
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
}
imageSource: "asset:///icons/ic_reload.png"
},
ActionItem {
title: qsTr("Load Older")
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
}
imageSource: "asset:///icons/ic_to_bottom.png"
},
ActionItem {
title: qsTr("Logout")
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
postModel.clear()
pnut.beforeId = 0
pnut.sinceId = 0
_app.setSetting("access_token", "");
}
}
]
actionBarAutoHideBehavior: ActionBarAutoHideBehavior.HideOnScroll
}
attachedObjects: [
ComponentDefinition {
id: itemPageDefinition
source: "ItemPage.qml"
},
NewPostSheet {
id: newPostSheet
onSendPost: {
console.log("send: " + text);
pnut.sendPost(text);
}
},
QTimer {
id: timer
interval: 30000
onTimeout: {
pnut.getStream(endpoint, Pnut.STREAM_NEWER);
}
},
Pnut {
id: pnut
onStreamReceived: {
// console.log("- got a result -");
// console.log("- type: " + rtype);
// console.log(stream);
switch (rtype) {
case Pnut.STREAM_OLDER:
postModel.append(stream);
break;
case Pnut.STREAM_NEWER:
postModel.insert(0, stream);
break;
}
pnut.beforeId = postModel.value(postModel.size() - 1).id;
pnut.sinceId = postModel.value(0).id;
}
onAuthorizationReceived: {
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
timer.start();
}
}
]
onPopTransitionEnded: {
page.destroy();
}
onCreationCompleted: {
switch (stream_type) {
case "Home":
endpoint = "/posts/streams/me";
break;
case "Global":
default:
endpoint = "/posts/streams/global"
break;
}
if (_app.setting("access_token") && _app.setting("access_token").length > 0) {
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
timer.start();
} else {
pnut.authorize();
}
}
}

BIN
assets/icons/globe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
assets/icons/ic_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/icons/ic_reload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
assets/icons/ic_reply.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/icons/ic_to_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

48
assets/main.qml Normal file
View file

@ -0,0 +1,48 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import bb.cascades 1.4
TabbedPane {
id: main
showTabsOnActionBar: false
Tab {
id: globalStream
title: qsTr("Global")
delegate: Delegate {
StreamTab {
stream_type: "Global"
}
}
imageSource: "asset:///icons/globe.png"
}
// Tab {
// id: homeStream
// title: qsTr("Home")
// delegate: Delegate {
// StreamTab {
// stream_type: "Home"
// }
// }
// imageSource: "asset:///icons/ic_home.png"
// }
}

2940
assets/moment.js Normal file

File diff suppressed because it is too large Load diff

103
bar-descriptor.xml Normal file
View file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--
Copyright (c) 2011-2015 BlackBerry Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<!-- BlackBerry 10 application descriptor file.
Specifies parameters for identifying, installing, and launching native applications on BlackBerry 10.
-->
<!-- A universally unique application identifier. Must be unique across all BlackBerry 10 applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.monkeystew.Goober</id>
<configuration name="Device-Debug">
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm/o.le-v7-g/Goober" entry="true" type="Qnx/Elf">Goober</asset>
<asset path="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7/libkqoauth.so" type="Qnx/Elf">lib/libkqoauth.so.1</asset>
</configuration>
<configuration name="Device-Release">
<entryPointType>Qnx/Cascades</entryPointType>
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm/o.le-v7/Goober.so" entry="true" type="Qnx/Elf">Goober.so</asset>
<asset path="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7/libkqoauth.so" type="Qnx/Elf">lib/libkqoauth.so.1</asset>
</configuration>
<configuration name="Device-Profile">
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm-p/o.le-v7-g/Goober" entry="true" type="Qnx/Elf">Goober</asset>
<asset path="C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7/libkqoauth.so" type="Qnx/Elf">lib/libkqoauth.so.1</asset>
</configuration>
<configuration name="Simulator-Debug">
<platformArchitecture>x86</platformArchitecture>
<asset path="x86/o-g/Goober" entry="true" type="Qnx/Elf">Goober</asset>
</configuration>
<!-- The name that is displayed in the BlackBerry 10 application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<name>Goober</name>
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required. -->
<versionNumber>0.1.0</versionNumber>
<!-- Fourth digit segment of the package version. First three segments are taken from the
<versionNumber> element. Must be an integer from 0 to 2^16-1 -->
<description>the Goober application, a client for pnut.io</description>
<authorId>gYAAgP-_4D6fs0QDWOhZdtQjf2I</authorId>
<author>Morgan McMillian</author>
<buildIdFile>buildnum</buildIdFile>
<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
<!-- <versionLabel></versionLabel> -->
<!-- Description, displayed in the BlackBerry 10 application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<!-- Copyright information. Optional. -->
<!-- <copyright></copyright> -->
<!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
<!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
<!-- <authorId>ABC1234YjsnUk235h</authorId> -->
<initialWindow>
<autoOrients>true</autoOrients>
<systemChrome>none</systemChrome>
</initialWindow>
<!-- The icon for the application, which should be 114x114. -->
<icon>
<image>icon.png</image>
</icon>
<asset path="icon.png">icon.png</asset>
<asset path="assets">assets</asset>
<!-- Locale support -->
<asset path="translations" dest="qm">
<include name="*.qm"/>
</asset>
<!-- Request permission to execute native code. Required for native applications. -->
<permission system="true">run_native</permission>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
</qnx>

1
buildnum Normal file
View file

@ -0,0 +1 @@
3

125
config.pri Normal file
View file

@ -0,0 +1,125 @@
# Config.pri file version 2.0. Auto-generated by IDE. Any changes made by user will be lost!
BASEDIR = $$quote($$_PRO_FILE_PWD_)
device {
CONFIG(debug, debug|release) {
profile {
INCLUDEPATH += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth)
DEPENDPATH += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth)
LIBS += -lkqoauth
LIBS += $$quote(-LC:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7)
PRE_TARGETDEPS += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7)
CONFIG += \
config_pri_assets \
config_pri_source_group1
} else {
INCLUDEPATH += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth)
DEPENDPATH += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth)
LIBS += -lkqoauth
LIBS += $$quote(-LC:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7)
PRE_TARGETDEPS += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7)
CONFIG += \
config_pri_assets \
config_pri_source_group1
}
}
CONFIG(release, debug|release) {
!profile {
INCLUDEPATH += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth)
DEPENDPATH += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth)
LIBS += -lkqoauth
LIBS += $$quote(-LC:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7)
PRE_TARGETDEPS += $$quote(C:/Users/morga/workspace/momentics-workspace/bb-cascades-oauth/oauth/o.le-v7)
CONFIG += \
config_pri_assets \
config_pri_source_group1
}
}
}
simulator {
CONFIG(debug, debug|release) {
!profile {
CONFIG += \
config_pri_assets \
config_pri_source_group1
}
}
}
config_pri_assets {
OTHER_FILES += \
$$quote($$BASEDIR/assets/NewPostSheet.qml) \
$$quote($$BASEDIR/assets/PostItem.qml) \
$$quote($$BASEDIR/assets/StreamTab.qml) \
$$quote($$BASEDIR/assets/icons/globe.png) \
$$quote($$BASEDIR/assets/icons/ic_add.png) \
$$quote($$BASEDIR/assets/icons/ic_reload.png) \
$$quote($$BASEDIR/assets/icons/ic_reply.png) \
$$quote($$BASEDIR/assets/icons/ic_reply_all.png) \
$$quote($$BASEDIR/assets/icons/ic_to_bottom.png) \
$$quote($$BASEDIR/assets/icons/ic_to_top.png) \
$$quote($$BASEDIR/assets/icons/laughing_man.png) \
$$quote($$BASEDIR/assets/main.qml) \
$$quote($$BASEDIR/assets/moment.js)
}
config_pri_source_group1 {
SOURCES += \
$$quote($$BASEDIR/src/Pnut.cpp) \
$$quote($$BASEDIR/src/Pnut_test.cpp) \
$$quote($$BASEDIR/src/WebImageView.cpp) \
$$quote($$BASEDIR/src/applicationui.cpp) \
$$quote($$BASEDIR/src/main.cpp)
HEADERS += \
$$quote($$BASEDIR/src/Pnut.h) \
$$quote($$BASEDIR/src/WebImageView.h) \
$$quote($$BASEDIR/src/applicationui.hpp) \
$$quote($$BASEDIR/src/globals.h)
}
CONFIG += precompile_header
PRECOMPILED_HEADER = $$quote($$BASEDIR/precompiled.h)
lupdate_inclusion {
SOURCES += \
$$quote($$BASEDIR/../src/*.c) \
$$quote($$BASEDIR/../src/*.c++) \
$$quote($$BASEDIR/../src/*.cc) \
$$quote($$BASEDIR/../src/*.cpp) \
$$quote($$BASEDIR/../src/*.cxx) \
$$quote($$BASEDIR/../assets/*.qml) \
$$quote($$BASEDIR/../assets/*.js) \
$$quote($$BASEDIR/../assets/*.qs) \
$$quote($$BASEDIR/../assets/icons/*.qml) \
$$quote($$BASEDIR/../assets/icons/*.js) \
$$quote($$BASEDIR/../assets/icons/*.qs)
HEADERS += \
$$quote($$BASEDIR/../src/*.h) \
$$quote($$BASEDIR/../src/*.h++) \
$$quote($$BASEDIR/../src/*.hh) \
$$quote($$BASEDIR/../src/*.hpp) \
$$quote($$BASEDIR/../src/*.hxx)
}
TRANSLATIONS = $$quote($${TARGET}.ts)

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

5
precompiled.h Normal file
View file

@ -0,0 +1,5 @@
// This file is used to store precompiled headers.
#include <QObject>
#include <QString>
#include <QVariant>

219
src/Pnut.cpp Normal file
View file

@ -0,0 +1,219 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Pnut.h"
#include "globals.h"
#include <QDebug>
#include <bb/data/JsonDataAccess>
const QString Pnut::PNUT_API_ROOT = QString("https://api.pnut.io/v0");
const QString Pnut::PNUT_AUTH_URL = QString("https://pnut.io/oauth/authenticate");
Pnut::Pnut()
{
req_id = 0;
before_id = 0;
since_id = 0;
m_appSettings = new QSettings("Morgan McMillian", "Goober");
oauthRequest = new KQOAuthRequest;
oauthManager = new KQOAuthManager(this);
bool auth_req = connect(oauthManager, SIGNAL(authorizationReceived(QString,QString)),
this, SLOT(onAuthorizationReceived(QString,QString)));
Q_ASSERT(auth_req);
bool conn_req = connect(oauthManager, SIGNAL(authorizedRequestReady(QByteArray,int)),
this, SLOT(onAuthorizedRequestReady(QByteArray,int)));
Q_ASSERT(conn_req);
qDebug() << "Pnut created, I am life.";
}
Pnut::~Pnut()
{
delete oauthRequest;
delete oauthManager;
qDebug() << "Pnut destroyed,, I am death.";
}
int Pnut::sinceId() const
{
return since_id;
}
void Pnut::setSinceId(const int& id)
{
since_id = id;
}
int Pnut::beforeId() const
{
return before_id;
}
void Pnut::setBeforeId(const int& id)
{
before_id = id;
}
void Pnut::authorize()
{
QUrl url(PNUT_AUTH_URL);
KQOAuthParameters parameters;
parameters.insert("scope", "basic stream write_post follow update_profile presence");
oauthManager->getOauth2UserAuthorization(url, PNUT_CLIENT_ID, parameters);
}
void Pnut::getRequest(QUrl url, KQOAuthParameters parameters, int id)
{
oauthRequest->clearRequest();
oauthRequest->initRequest(KQOAuthRequest::AuthorizedRequest, url);
oauthRequest->setToken(m_appSettings->value("access_token").toString());
oauthRequest->setHttpMethod(KQOAuthRequest::GET);
oauthRequest->setRequestOAuthMethod(KQOAuthRequest::OAUTH2);
oauthRequest->setAdditionalParameters(parameters);
oauthManager->executeAuthorizedRequest(oauthRequest, id);
}
void Pnut::postRequest(QUrl url, KQOAuthParameters parameters, int id, QByteArray data)
{
oauthRequest->clearRequest();
oauthRequest->initRequest(KQOAuthRequest::AuthorizedRequest, url);
oauthRequest->setToken(m_appSettings->value("access_token").toString());
oauthRequest->setHttpMethod(KQOAuthRequest::POST);
oauthRequest->setRequestOAuthMethod(KQOAuthRequest::OAUTH2);
oauthRequest->setContentType("application/json");
oauthRequest->setAdditionalParameters(parameters);
oauthRequest->setRawData(data);
oauthManager->executeAuthorizedRequest(oauthRequest, id);
}
void Pnut::onAuthorizationReceived(QString token, QString verifier)
{
switch (oauthManager->lastError())
{
case KQOAuthManager::NoError:
qDebug() << "- authorization received -";
m_appSettings->setValue("access_token", token);
emit authorizationReceived();
break;
default:
qDebug() << "- authorization error -";
qDebug() << oauthManager->lastError();
}
}
void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
{
QString endpoint = req_map[id];
// qDebug() << "- onAuthorizedRequestReady";
// qDebug() << "- id: " << id;
// qDebug() << "- endpoint: " << endpoint;
// qDebug() << data;
QVariant variant;
bb::data::JsonDataAccess jda;
variant = jda.loadFromBuffer(data);
QVariantMap meta = variant.toMap()["meta"].toMap();
int code = meta["code"].toInt();
switch (code)
{
case Pnut::OK:
{
// qDebug() << ":: OK";
if (endpoint.startsWith("/posts/streams/"))
{
Pnut::RequestType rtype = rtype_map[id];
emit streamReceived(variant.toMap()["data"].toList(), rtype);
req_map.remove(id);
rtype_map.remove(id);
}
break;
}
case Pnut::CREATED:
{
if (endpoint == "/posts")
{
qDebug() << "Success!";
req_map.remove(id);
}
break;
}
default:
{
qDebug() << ":: Error - " << code;
qDebug() << meta;
}
}
}
void Pnut::getStream(QString endpoint, Pnut::RequestType rtype)
{
QUrl url(PNUT_API_ROOT + endpoint);
KQOAuthParameters parameters;
switch (rtype)
{
case Pnut::STREAM_NEWER:
if (since_id > 0) parameters.insert("since_id", QString::number(since_id));
break;
case Pnut::STREAM_OLDER:
if (before_id > 0) parameters.insert("before_id", QString::number(before_id));
break;
}
req_map[++req_id] = endpoint;
rtype_map[req_id] = rtype;
getRequest(url, parameters, req_id);
}
void Pnut::sendPost(QString text)
{
QByteArray post;
QVariantMap map;
map["text"] = text;
QVariant data(map);
bb::data::JsonDataAccess jda;
jda.saveToBuffer(data, &post);
QUrl url(PNUT_API_ROOT + "/posts");
KQOAuthParameters parameters;
req_map[++req_id] = "/posts";
postRequest(url, parameters, req_id, post);
}
void Pnut::sendReply(QString text, int pid)
{
QByteArray post;
QVariantMap map;
map["text"] = text;
map["reply_to"] = pid;
QVariant data(map);
bb::data::JsonDataAccess jda;
jda.saveToBuffer(data, &post);
QUrl url(PNUT_API_ROOT + "/posts");
KQOAuthParameters parameters;
req_map[++req_id] = "/posts";
postRequest(url, parameters, req_id, post);
}

100
src/Pnut.h Normal file
View file

@ -0,0 +1,100 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PNUT_H_
#define PNUT_H_
#include <kqoauthrequest.h>
#include <kqoauthmanager.h>
#include <QSettings>
class KQOauthManager;
class KQOauthRequest;
class Pnut: public QObject
{
Q_OBJECT
Q_PROPERTY(int sinceId READ sinceId WRITE setSinceId)
Q_PROPERTY(int beforeId READ beforeId WRITE setBeforeId)
public:
enum StatusCode {
OK = 200,
CREATED = 201,
NO_CONTENT = 204,
FOUND = 302,
BAD_REQUEST = 400,
UNAUTHORIZED = 401,
FORBIDDEN = 403,
NOT_FOUND = 404,
METHOD_NOT_ALLOWED = 405,
TOO_MANY_REQUESTS = 429,
INTERNAL_SERVER_ERROR = 500,
INSUFFICIENT_STORAGE = 507
};
enum RequestType {
STREAM_NEWER = 0,
STREAM_OLDER = 1
};
Q_ENUMS(RequestType)
Pnut();
virtual ~Pnut();
int sinceId() const;
void setSinceId(const int &id);
int beforeId() const;
void setBeforeId(const int &id);
Q_INVOKABLE void authorize();
Q_INVOKABLE void getStream(QString endpoint, Pnut::RequestType rtype);
Q_INVOKABLE void sendPost(QString text);
Q_INVOKABLE void sendReply(QString text, int pid);
public slots:
void onAuthorizedRequestReady(QByteArray data, int id);
void onAuthorizationReceived(QString token, QString verifier);
Q_SIGNALS:
void authorizationReceived();
void streamReceived(QVariantList stream, Pnut::RequestType rtype);
private:
static const QString PNUT_API_ROOT;
static const QString PNUT_AUTH_URL;
static const QString PNUT_USERS_URL;
QSettings *m_appSettings;
KQOAuthManager *oauthManager;
KQOAuthRequest *oauthRequest;
int before_id;
int since_id;
int req_id;
QMap<int,QString> req_map;
QMap<int,Pnut::RequestType> rtype_map;
void getRequest(QUrl url, KQOAuthParameters parameters, int id);
void postRequest(QUrl url, KQOAuthParameters parameters, int id, QByteArray data);
};
#endif /* PNUT_H_ */

21
src/Pnut_test.cpp Normal file
View file

@ -0,0 +1,21 @@
/*
* Copyright (C) 2016 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Pnut.h"

71
src/WebImageView.cpp Normal file
View file

@ -0,0 +1,71 @@
#include "WebImageView.h"
#include <bb/cascades/Image>
QNetworkAccessManager * WebImageView::mNetManager = new QNetworkAccessManager;
QNetworkDiskCache * WebImageView::mNetworkDiskCache = new QNetworkDiskCache();
WebImageView::WebImageView() {
mNetworkDiskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
mNetManager->setCache(mNetworkDiskCache);
}
const QUrl& WebImageView::url() const {
return mUrl;
}
void WebImageView::setUrl(const QUrl& url) {
mUrl = url;
mLoading = 0;
resetImage();
QNetworkRequest request;
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
request.setUrl(url);
QNetworkReply * reply = mNetManager->get(QNetworkRequest(request));
connect(reply,SIGNAL(finished()), this, SLOT(imageLoaded()));
connect(reply,SIGNAL(downloadProgress ( qint64 , qint64 )), this, SLOT(dowloadProgressed(qint64,qint64)));
emit urlChanged();
}
double WebImageView::loading() const {
return mLoading;
}
void WebImageView::imageLoaded() {
QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());
QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
mRedirectUrl = this->redirectUrl(possibleRedirectUrl.toUrl(),mRedirectUrl);
if (!mRedirectUrl.isEmpty()) {
this->setUrl(mRedirectUrl);
} else {
setImage(Image(reply->readAll()));
}
reply->deleteLater();
}
void WebImageView::dowloadProgressed(qint64 bytes,qint64 total) {
mLoading = double(bytes)/double(total);
emit loadingChanged();
}
QUrl WebImageView::redirectUrl(const QUrl& possibleRedirectUrl, const QUrl& oldRedirectUrl) const {
QUrl redirectUrl;
if (!possibleRedirectUrl.isEmpty() && possibleRedirectUrl != oldRedirectUrl) {
redirectUrl = possibleRedirectUrl;
}
return redirectUrl;
}

41
src/WebImageView.h Normal file
View file

@ -0,0 +1,41 @@
#ifndef WEBIMAGEVIEW_H_
#define WEBIMAGEVIEW_H_
#include <bb/cascades/ImageView>
#include <QUrl>
using namespace bb::cascades;
class QNetworkAccessManager;
class WebImageView: public bb::cascades::ImageView {
Q_OBJECT
Q_PROPERTY (QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY (float loading READ loading NOTIFY loadingChanged)
public:
WebImageView();
const QUrl& url() const;
double loading() const;
public Q_SLOTS:
void setUrl(const QUrl& url);
private Q_SLOTS:
void imageLoaded();
void dowloadProgressed(qint64,qint64);
signals:
void urlChanged();
void loadingChanged();
private:
static QNetworkAccessManager * mNetManager;
static QNetworkDiskCache * mNetworkDiskCache;
QUrl mUrl;
QUrl mRedirectUrl;
float mLoading;
QUrl redirectUrl(const QUrl& possibleRedirectUrl, const QUrl& oldRedirectUrl) const;
};
#endif /* WEBIMAGEVIEW_H_ */

83
src/applicationui.cpp Normal file
View file

@ -0,0 +1,83 @@
/*
* Copyright (c) 2011-2015 BlackBerry Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applicationui.hpp"
#include "Pnut.h"
#include "WebImageView.h"
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/LocaleHandler>
using namespace bb::cascades;
ApplicationUI::ApplicationUI() :
QObject()
{
// prepare the localization
m_pTranslator = new QTranslator(this);
m_pLocaleHandler = new LocaleHandler(this);
bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
// This is only available in Debug builds
Q_ASSERT(res);
// Since the variable is not used in the app, this is added to avoid a
// compiler warning
Q_UNUSED(res);
// initial load
onSystemLanguageChanged();
qmlRegisterType<Pnut>("com.monkeystew.pnut", 1, 0, "Pnut");
qmlRegisterType<QTimer> ("com.monkeystew.qtimer", 1, 0, "QTimer");
qmlRegisterType<WebImageView>("org.labsquare", 1, 0, "WebImageView");
m_appSettings = new QSettings("Morgan McMillian", "Goober");
// Create scene document from main.qml asset, the parent is set
// to ensure the document gets destroyed properly at shut down.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("_app", this);
// Create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// Set created root object as the application scene
Application::instance()->setScene(root);
}
QVariant ApplicationUI::setting(const QString& key)
{
return m_appSettings->value(key);
}
void ApplicationUI::setSetting(const QString& key, const QString& value)
{
m_appSettings->setValue(key, value);
}
void ApplicationUI::onSystemLanguageChanged()
{
QCoreApplication::instance()->removeTranslator(m_pTranslator);
// Initiate, load and install the application translation files.
QString locale_string = QLocale().name();
QString file_name = QString("Goober_%1").arg(locale_string);
if (m_pTranslator->load(file_name, "app/native/qm")) {
QCoreApplication::instance()->installTranslator(m_pTranslator);
}
}

55
src/applicationui.hpp Normal file
View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 2011-2015 BlackBerry Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_
#include <QObject>
#include <QSettings>
namespace bb
{
namespace cascades
{
class LocaleHandler;
}
}
class QTranslator;
/*!
* @brief Application UI object
*
* Use this object to create and init app UI, to create context objects, to register the new meta types etc.
*/
class ApplicationUI : public QObject
{
Q_OBJECT
public:
ApplicationUI();
virtual ~ApplicationUI() {}
Q_INVOKABLE QVariant setting(const QString &key);
Q_INVOKABLE void setSetting(const QString &key, const QString &value);
private slots:
void onSystemLanguageChanged();
private:
QTranslator* m_pTranslator;
bb::cascades::LocaleHandler* m_pLocaleHandler;
QSettings* m_appSettings;
};
#endif /* ApplicationUI_HPP_ */

38
src/main.cpp Normal file
View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2011-2015 BlackBerry Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applicationui.hpp"
#include <bb/cascades/Application>
#include <QLocale>
#include <QTranslator>
#include <Qt/qdeclarativedebug.h>
using namespace bb::cascades;
Q_DECL_EXPORT int main(int argc, char **argv)
{
Application app(argc, argv);
// Create the Application UI object, this is where the main.qml file
// is loaded and the application scene is set.
ApplicationUI appui;
// Enter the application main event loop.
return Application::exec();
}

1
translations/Goober.pro Normal file
View file

@ -0,0 +1 @@
include (../Goober.pro)

66
translations/Goober.ts Normal file
View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0">
<context>
<name>NewPostSheet</name>
<message>
<location filename="../assets/NewPostSheet.qml" line="35"/>
<source>Send</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/NewPostSheet.qml" line="44"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/NewPostSheet.qml" line="50"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="94"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="50"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="59"/>
<source>Load Newer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="67"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="78"/>
<source>Load Older</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="86"/>
<source>Logout</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../assets/main.qml" line="28"/>
<source>Global</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

12
translations/Makefile Normal file
View file

@ -0,0 +1,12 @@
QMAKE_TARGET = Goober
LUPDATE = $(QNX_HOST)/usr/bin/lupdate
LRELEASE = $(QNX_HOST)/usr/bin/lrelease
update: $(QMAKE_TARGET).pro FORCE
$(LUPDATE) $(QMAKE_TARGET).pro
release: $(QMAKE_TARGET).pro $(QMAKE_TARGET).ts
$(LRELEASE) $(QMAKE_TARGET).pro
FORCE: