~diegosarmentero/clickmanager-plugin/trunk

« back to all changes in this revision

Viewing changes to application.cpp

  • Committer: Diego Sarmentero
  • Date: 2013-09-10 19:01:19 UTC
  • Revision ID: diego.sarmentero@gmail.com-20130910190119-5zlm3s38txxpzipg
adding files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of version 3 of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public
 
14
 * License along with this library; if not, write to the
 
15
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
16
 * Boston, MA 02110-1301, USA.
 
17
 */
 
18
 
 
19
#include "application.h"
 
20
#include <QStringList>
 
21
#include <apt-pkg/debversion.h>
 
22
#include <QDebug>
 
23
 
 
24
Application::Application(QQuickItem *parent) :
 
25
    QQuickItem(parent)
 
26
{
 
27
    this->m_packagename = "";
 
28
    this->m_title = "";
 
29
    this->m_local_version = "";
 
30
    this->m_remote_version = "";
 
31
    this->m_dbuspath = "";
 
32
    this->m_update = false;
 
33
    this->m_update_state = false;
 
34
    this->m_selected = false;
 
35
    this->m_icon_url = "";
 
36
    this->m_binary_filesize = 0;
 
37
}
 
38
 
 
39
void Application::initializeApplication(QString packagename, QString title, QString version)
 
40
{
 
41
    this->m_packagename = packagename;
 
42
    this->m_title = title;
 
43
    this->m_local_version = version;
 
44
}
 
45
 
 
46
void Application::setRemoteVersion(QString& version)
 
47
{
 
48
    this->m_remote_version = version;
 
49
 
 
50
    debVersioningSystem debVersion;
 
51
 
 
52
    int result = debVersion.CmpVersion(this->m_local_version.toUtf8().data(),
 
53
                                       this->m_remote_version.toUtf8().data());
 
54
    if(result == -1) {
 
55
        this->m_update = true;
 
56
    }else{
 
57
        this->m_update = false;
 
58
    }
 
59
}