Skip to content

Commit

Permalink
Merge pull request #5 from vadrian89/dev
Browse files Browse the repository at this point in the history
Merge v3.0.2 to master branch
  • Loading branch information
vadrian89 authored May 3, 2017
2 parents 4a08abf + 3af3fca commit 35ddbdb
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 224 deletions.
4 changes: 2 additions & 2 deletions ApplicationBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick 2.7
import QtQuick.Layouts 1.3

Item {
id: root
Expand Down
4 changes: 2 additions & 2 deletions ColorPalleteButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick 2.7
import QtQuick.Layouts 1.3

Item {
id: root
Expand Down
8 changes: 6 additions & 2 deletions CppFiles/DbConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DbConnection.h"
#include "Util.h"
#include <QApplication>

#include <QDebug>

DbConnection::DbConnection(QObject *parent) : QObject(parent){
QString appName = QApplication::applicationName();
QString databaseName = QApplication::applicationDirPath() + "/" + appName + "-local.db";
QString databaseName = appName + "-local.db";
if (Util::osType() != "android") {
databaseName = QApplication::applicationDirPath() + "/" + appName + "-local.db";
}
db = QSqlDatabase::database();
if (db.isValid() == false) {
db = QSqlDatabase::addDatabase("QSQLITE");
Expand Down
34 changes: 17 additions & 17 deletions CppFiles/TrayController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TrayController.h"
#include "Util.h"

#include <QDebug>
TrayController::TrayController(QObject *parent) : QObject(parent) {
trayIcon = NULL;
m_trayVisibility = false;
}

QString TrayController::icon() const {
Expand All @@ -29,35 +34,26 @@ QString TrayController::icon() const {

void TrayController::setIcon(const QString &icon) {
if (m_icon != icon && icon.trimmed().size() > 0) {
m_icon = icon;
setTrayIcon(icon);
emit iconChanged();
}
}

bool TrayController::startUp() const {
return m_startUp;
}

void TrayController::setStartUp(const bool &startUp) {
if (m_startUp != startUp) {
if (startUp == true) {
initialiseTray();
}
emit startUpChanged();
}
}

bool TrayController::trayVisibility() const {
return m_trayVisibility;
}

void TrayController::setTrayVisibility(const bool &trayVisibility) {
if (m_trayVisibility != trayVisibility) {
void TrayController::setTrayVisibility(const bool &trayVisibility) {
if (m_trayVisibility != trayVisibility) {
if (trayVisibility == true) {
if (trayIcon == NULL)
initialiseTray();
enableTray();
}
else {
disableTray();
if (trayIcon != NULL)
disableTray();
}
m_trayVisibility = trayVisibility;
emit trayVisibilityChanged();
Expand All @@ -77,7 +73,8 @@ void TrayController::setTrayIcon(const QString &weather) {
}

void TrayController::setTrayIcon(const QImage &image) {
trayIcon->setIcon(QIcon(QPixmap::fromImage(image)));
if (trayIcon != NULL)
trayIcon->setIcon(QIcon(QPixmap::fromImage(image)));
thread->quit();
thread->wait();
}
Expand All @@ -101,12 +98,15 @@ void TrayController::initialiseTray() {
void TrayController::enableTray() {
if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon->show();
setTrayIcon(m_icon);
}
}

void TrayController::disableTray() {
if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon->hide();
delete trayIcon;
trayIcon = NULL;
}
}

Expand Down
4 changes: 1 addition & 3 deletions CppFiles/TrayController.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@
class TrayController : public QObject {
Q_OBJECT
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
Q_PROPERTY(bool startUp READ startUp WRITE setStartUp NOTIFY startUpChanged)
Q_PROPERTY(bool trayVisibility READ trayVisibility WRITE setTrayVisibility NOTIFY trayVisibilityChanged)

QString m_icon;
bool m_startUp, m_trayVisibility;
bool m_trayVisibility;
QSystemTrayIcon *trayIcon;

void initialiseTray();
Expand All @@ -66,7 +65,6 @@ private slots:
void setTrayIcon(const QImage &image);
signals:
void iconChanged();
void startUpChanged();
void trayVisibilityChanged();
void closeApp();
void showGui();
Expand Down
4 changes: 2 additions & 2 deletions CppFiles/YWeatherController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ YWeatherController::YWeatherController(QObject *parent) : AbstractWeatherControl

void YWeatherController::searchByLocation(QString &location) {
operationData = OperationData::GetLocationId;
dataController->getDataFromUrl("https://query.yahooapis.com/v1/public/yql?q=select woeid from geo.places(1) where text='" + location + "'&format=json&env=store://datatables.org/alltableswithkeys");
dataController->getDataFromUrl("https://query.yahooapis.com/v1/public/yql?q=select woeid from geo.places(1) where text='" + location + "'&format=json");
}

void YWeatherController::searchBycode(QString &code) {
operationData = OperationData::GetWeather;
dataController->getDataFromUrl("https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=" + code +"&format=json&env=store://datatables.org/alltableswithkeys");
dataController->getDataFromUrl("https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=" + code +"&format=json");
}

void YWeatherController::readJsonData(QJsonObject jsonObject) {
Expand Down
58 changes: 30 additions & 28 deletions CreditsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3

Item {
id: rootDialog
visible: false
property string appVersion: "3.0.1"
property string appVersion: "3.0.2"
property string textColor: util.textColor()
property string backgroundColor: util.backgroundColor()
property int contentWidth: rootDialog.width * 90 / 100
Expand All @@ -37,20 +36,22 @@ Item {
color: backgroundColor
width: rootDialog.width
height: rootDialog.height
ScrollView {
id: rootScrollView
Flickable {
id: rootView
anchors.fill: parent
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
ColumnLayout {
width: rootDialog.width
height: rootDialog.height
contentWidth: rootDialog.width
contentHeight: contentItem.height
Rectangle {
id: contentItem
color: "transparent"
width: rootDialog.width
spacing: 0
height: childrenRect.height
LinkedText {
id: versionText
Layout.fillHeight: false
Layout.preferredHeight: 60
Layout.fillWidth: false
Layout.preferredWidth: rootDialog.contentWidth
Layout.alignment: Qt.AlignCenter
height: 60
width: rootDialog.contentWidth
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
Expand All @@ -60,10 +61,11 @@ Item {
url: "https://vadrian89.github.io/cumulus-qt/"
}
LinkedText {
Layout.fillHeight: true
Layout.fillWidth: false
Layout.preferredWidth: rootDialog.contentWidth
Layout.alignment: Qt.AlignCenter
id: fontCreditsText
anchors.top: versionText.bottom
anchors.left: parent.left
anchors.leftMargin: (rootDialog.width - fontCreditsText.width) / 2
width: rootDialog.contentWidth
font.pixelSize: 14
color: rootDialog.textColor
wrapMode: Text.Wrap
Expand All @@ -72,10 +74,10 @@ Item {
}
Text {
id: creditsText
Layout.fillHeight: true
Layout.fillWidth: false
Layout.preferredWidth: rootDialog.contentWidth
Layout.alignment: Qt.AlignCenter
anchors.top: fontCreditsText.bottom
anchors.left: parent.left
anchors.leftMargin: (rootDialog.width - creditsText.width) / 2
width: rootDialog.contentWidth
font.pixelSize: 14
color: rootDialog.textColor
wrapMode: Text.Wrap
Expand All @@ -90,11 +92,11 @@ Item {
}
ListView {
id: iconCreditsList
Layout.fillHeight: false
Layout.preferredHeight: 200
Layout.fillWidth: false
Layout.preferredWidth: rootDialog.contentWidth
Layout.alignment: Qt.AlignCenter
anchors.top: creditsText.bottom
anchors.left: parent.left
anchors.leftMargin: (rootDialog.width - iconCreditsList.width) / 2
height: 300
width: rootDialog.contentWidth
orientation: ListView.Vertical
clip: true
spacing: 0
Expand Down
46 changes: 0 additions & 46 deletions CustomBorder.qml

This file was deleted.

2 changes: 1 addition & 1 deletion ForecastDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick 2.7

Item {
property string forecastDay
Expand Down
5 changes: 4 additions & 1 deletion ForecastView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtQuick 2.7

Item {
id: root
Expand Down Expand Up @@ -53,5 +53,8 @@ Item {
forecastTemperature: model.modelData.tempHigh + "° / " + model.modelData.tempLow + "°"
forecastDesc: util.firstLetterUp(model.modelData.forecastDesc)
}
onModelChanged: positionViewAtBeginning()
onWidthChanged: positionViewAtBeginning()
onHeightChanged: positionViewAtBeginning()
}
}
2 changes: 1 addition & 1 deletion LinkedText.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.5
import QtQuick 2.7

Text {
id: root
Expand Down
18 changes: 7 additions & 11 deletions SearchLocation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick.Window 2.0
import QtQuick.Controls 1.4
import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.2
import QtQuick.Controls.Styles 1.4

import ownTypes.searchLocation 0.4

Expand Down Expand Up @@ -54,13 +53,10 @@ Item {
anchors.topMargin: 10
anchors.left: parent.left
anchors.leftMargin: (parent.width - width) / 2
style: TextFieldStyle {
textColor: root.textColor
placeholderTextColor: root.textColor
background: Rectangle {
border.width: 0
color: "transparent"
}
color: root.textColor
background: Rectangle {
border.width: 0
color: "transparent"
}

onTextChanged: {
Expand Down
4 changes: 2 additions & 2 deletions SelectionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick 2.7
import QtQuick.Controls 2.1

Item {
id: rootItem
Expand Down
4 changes: 2 additions & 2 deletions SettingsOptionItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick 2.7
import QtQuick.Layouts 1.3

Item {
id: root
Expand Down
Loading

0 comments on commit 35ddbdb

Please sign in to comment.