Skip to content

Commit

Permalink
moved to lowerspot.com
Browse files Browse the repository at this point in the history
  • Loading branch information
Damiano Lombardi committed May 1, 2016
1 parent 2082a20 commit d058f09
Show file tree
Hide file tree
Showing 13 changed files with 254 additions and 132 deletions.
8 changes: 5 additions & 3 deletions MobileClient/QtProject/MobileClientQml.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ QT += qml quick widgets positioning multimedia

CONFIG += console debug

# Hight dpi support
# Hight dpi support off
QT_AUTO_SCREEN_SCALE_FACTOR=1

# Android specific
Expand Down Expand Up @@ -61,7 +61,8 @@ SOURCES += src/cpp/main.cpp \
src/cpp/WebApi/PictureRepository.cpp \
src/cpp/WebApi/PicturesModel.cpp \
src/cpp/WebApi/SpotsModel.cpp \
src/cpp/External/SimpleCrypt.cpp
src/cpp/External/SimpleCrypt.cpp \
src/cpp/HelperClasses/Application.cpp

HEADERS += \
src/cpp/WebApi/Picture.h \
Expand All @@ -84,7 +85,8 @@ HEADERS += \
src/cpp/WebApi/PictureRepository.h \
src/cpp/WebApi/PicturesModel.h \
src/cpp/WebApi/SpotsModel.h \
src/cpp/External/SimpleCrypt.h
src/cpp/External/SimpleCrypt.h \
src/cpp/HelperClasses/Application.h

RESOURCES += src/qml.qrc

Expand Down
2 changes: 1 addition & 1 deletion MobileClient/QtProject/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.lowerspot" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.5" android:versionCode="5" android:installLocation="auto">
<manifest package="com.lowerspot" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.6" android:versionCode="6" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="portrait" android:launchMode="singleTop">
<intent-filter>
Expand Down
162 changes: 162 additions & 0 deletions MobileClient/QtProject/src/cpp/HelperClasses/Application.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/********************************************************************
* *
* Lowerspot *
* *
* Author: Damiano Lombardi *
* Created: 01.05.2016 *
* *
* Copiright (c) 2016 Damiano Lombardi *
* *
********************************************************************/

// Files includes --------------------------
#include "Application.h"

// Projects includes -----------------------
#include "ApplicationHelper.h"
#include "Logger.h"
#include "PlateformDetail.h"
#include "LocationManager.h"
#include "PictureCacher.h"
#include "../Settings/Settings.h"
#include "../WebApi/SpotRepository.h"
#include "../WebApi/SpotsModel.h"
#include "../WebApi/Spot.h"
#include "../WebApi/PictureRepository.h"
#include "../WebApi/PicturesModel.h"
#include "../WebApi/Picture.h"
#include "../WebApi/User.h"
#include "../WebApi/PictureUploader.h"

// Qt includes -----------------------------
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QtQml>

//-----------------------------------------------------------------------------------------------------------------------------

const QString Application::CONST_COMMANDLINEARGUMENT_DEVELOPMENTMODE("developmentMode");

//-----------------------------------------------------------------------------------------------------------------------------

Application::Application(int argc, char *argv[]) :
QApplication(argc, argv),
m_Settings (NULL),
m_PlateformDetail (NULL),
m_ApplicationHelper (NULL),
m_LocationManager (NULL),
m_PictureCacher (NULL),
m_User (NULL),
m_PictureUploader (NULL),
m_QQmlApplicationEngine (NULL)
{
// Application informations
QApplication::setOrganizationName ("Lowerspot");
QApplication::setOrganizationDomain ("lowerspot.com");
QApplication::setApplicationName ("Lowerspot");
QApplication::setApplicationVersion ("V0.0.6");

// Command line arguments
QMap<QString, QVariant> qMap_Arguments = parseCommandLineArguments();


// Settings
m_Settings = new Settings(this);

// Logger
Logger::instanziate(Logger::LOG_VERBOSE);
Logger::instance()->setLogLevel(m_Settings->get_Logger_LogLevel());

// Plateform detail
m_PlateformDetail = new PlateformDetail(this);

// Application helper
m_ApplicationHelper = new ApplicationHelper(m_Settings,
m_PlateformDetail);
m_ApplicationHelper->setDevelopmentMode(qMap_Arguments.value(CONST_COMMANDLINEARGUMENT_DEVELOPMENTMODE).toBool());
m_ApplicationHelper->startupTimerStart();

m_LocationManager = new LocationManager(m_Settings,
m_PlateformDetail);
m_PictureCacher = new PictureCacher(this);

PictureRepository::instanziate();
SpotRepository::instanziate(m_LocationManager);

m_User = new User(m_Settings,
this);
m_PictureUploader = new PictureUploader(this);

m_QQmlApplicationEngine = new QQmlApplicationEngine();
m_QQmlApplicationEngine->rootContext()->setContextProperty("hc_Application", m_ApplicationHelper);
m_QQmlApplicationEngine->rootContext()->setContextProperty("hc_PlateformDetail", m_PlateformDetail);
m_QQmlApplicationEngine->rootContext()->setContextProperty("hc_LocationManager", m_LocationManager);
m_QQmlApplicationEngine->rootContext()->setContextProperty("hc_PictureCacher", m_PictureCacher);
m_QQmlApplicationEngine->rootContext()->setContextProperty("hc_Logger", Logger::instance());
m_QQmlApplicationEngine->rootContext()->setContextProperty("hc_Settings", m_Settings);

m_QQmlApplicationEngine->rootContext()->setContextProperty("wa_User", m_User );
m_QQmlApplicationEngine->rootContext()->setContextProperty("wa_PictureUploader", m_PictureUploader);

m_QQmlApplicationEngine->rootContext()->setContextProperty("re_PictureRepository", PictureRepository::instance());
m_QQmlApplicationEngine->rootContext()->setContextProperty("re_SpotRepository", SpotRepository::instance());

qmlRegisterType<PicturesModel> ("PicturesModel", 1, 0, "PicturesModel");
qmlRegisterType<Picture> ("Picture", 1, 0, "Picture");
qmlRegisterType<SpotsModel> ("SpotsModel", 1, 0, "SpotsModel");
qmlRegisterType<Spot> ("Spot", 1, 0, "Spot");

Logger::info("Load main.qml...");
m_QQmlApplicationEngine->load(QUrl(QStringLiteral("qrc:///qml/main.qml")));


}

//-----------------------------------------------------------------------------------------------------------------------------

Application::~Application()
{
// Set and save settings
m_Settings->set_Application_LastVersion(QApplication::applicationVersion());
m_Settings->set_Logger_LogLevel(Logger::instance()->getLogLevel());
m_Settings->set_Location_LastCoordinate(m_LocationManager->coordinate());
m_Settings->sync();

// Delete objects
delete m_QQmlApplicationEngine;
delete m_PictureUploader;
delete m_User;
delete m_PictureCacher;
delete m_LocationManager;
delete m_ApplicationHelper;
delete m_PlateformDetail;
delete m_Settings;

// Destroy singletons
Logger::destroy();
SpotRepository::destroy();
PictureRepository::destroy();
}

//-----------------------------------------------------------------------------------------------------------------------------

QMap<QString, QVariant> Application::parseCommandLineArguments()
{
QCommandLineParser qCommandLineParser;
qCommandLineParser.setApplicationDescription(QApplication::applicationName());
qCommandLineParser.addHelpOption();
qCommandLineParser.addVersionOption();

// Development mode
QCommandLineOption qCommandLineOption_development(QStringList() << "d" << "development",
"Run in development mode.");
qCommandLineParser.addOption(qCommandLineOption_development);

qCommandLineParser.process(QApplication::arguments());

QMap<QString, QVariant> qMap_Arguments;

qMap_Arguments.insert(CONST_COMMANDLINEARGUMENT_DEVELOPMENTMODE, qCommandLineParser.isSet(qCommandLineOption_development));

return qMap_Arguments;
}
60 changes: 60 additions & 0 deletions MobileClient/QtProject/src/cpp/HelperClasses/Application.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/********************************************************************
* *
* Lowerspot *
* *
* Author: Damiano Lombardi *
* Created: 15.01.2015 *
* *
* Copiright (c) 2016 Damiano Lombardi *
* *
********************************************************************/

#ifndef APPLICATION_H
#define APPLICATION_H

// Qt includes -----------------------------
#include <QApplication>

// Forward declarations --------------------
class Settings;
class PlateformDetail;
class ApplicationHelper;
class LocationManager;
class PictureCacher;
class User;
class PictureUploader;
class QQmlApplicationEngine;

class Application : public QApplication
{
Q_OBJECT
public:

explicit Application(int argc,
char *argv[]);
~Application();

private:

static const QString CONST_COMMANDLINEARGUMENT_DEVELOPMENTMODE;

// Settings
Settings *m_Settings;

// Plateform detail
PlateformDetail *m_PlateformDetail;

// Application helper
ApplicationHelper *m_ApplicationHelper;
LocationManager *m_LocationManager;
PictureCacher *m_PictureCacher;

User *m_User;
PictureUploader *m_PictureUploader;

QQmlApplicationEngine *m_QQmlApplicationEngine;

QMap<QString, QVariant> parseCommandLineArguments();
};

#endif // APPLICATION_H
2 changes: 1 addition & 1 deletion MobileClient/QtProject/src/cpp/Settings/Settings.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/********************************************************************
* *
* InstaSpots *
* Lowerspot *
* *
* Author: Damiano Lombardi *
* Created: 26.05.2015 *
Expand Down
2 changes: 1 addition & 1 deletion MobileClient/QtProject/src/cpp/Settings/Settings.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/********************************************************************
* *
* InstaSpots *
* Lowerspot *
* *
* Author: Damiano Lombardi *
* Created: 26.05.2015 *
Expand Down
2 changes: 1 addition & 1 deletion MobileClient/QtProject/src/cpp/WebApi/WebApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Location of the web service
//const QString WebApi::URL_DEVELOPMENT ("http://localhost/Symfony/web/app_dev.php/webservice");
const QString WebApi::URL_DEVELOPMENT ("http://127.0.0.1:8000/webservice/webservice/");
const QString WebApi::URL_PRODUCTION ("http://spots.lowerclassclothing.com/web/webservice");
const QString WebApi::URL_PRODUCTION ("https://lowerspot.com/web/webservice");


const QString WebApi::CONST::GENERAL_PARAMS::COMMAND ("command");
Expand Down
Loading

0 comments on commit d058f09

Please sign in to comment.