source: src-qt4/pc-updatecenter/syscontroller.h @ 2f75b29

releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 2f75b29 was 2f75b29, checked in by yurkis <yurkis@…>, 9 months ago

Update center: Fix for freebsd update check parsing.

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/**************************************************************************
2*   Copyright (C) 2013- by Yuri Momotyuk                                   *
3*   yurkis@gmail.com                                                      *
4*                                                                         *
5*   Permission is hereby granted, free of charge, to any person obtaining *
6*   a copy of this software and associated documentation files (the       *
7*   "Software"), to deal in the Software without restriction, including   *
8*   without limitation the rights to use, copy, modify, merge, publish,   *
9*   distribute, sublicense, and/or sell copies of the Software, and to    *
10*   permit persons to whom the Software is furnished to do so, subject to *
11*   the following conditions:                                             *
12*                                                                         *
13*   The above copyright notice and this permission notice shall be        *
14*   included in all copies or substantial portions of the Software.       *
15*                                                                         *
16*   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
17*   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
18*   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
19*   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
20*   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
21*   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
22*   OTHER DEALINGS IN THE SOFTWARE.                                       *
23***************************************************************************/
24
25#ifndef SYSCONTROLLER_H
26#define SYSCONTROLLER_H
27
28#include "updatecontroller.h"
29#include "utils.h"
30
31#include <QProcess>
32#include <QString>
33#include <QVector>
34#include <QDate>
35
36class CSysController : public CAbstractUpdateController
37{
38    Q_OBJECT
39
40
41public:
42    CSysController();
43
44    typedef enum{
45        eSYSUPDATE,
46        ePATCH,
47        eFBSDUPDATE
48    }ESysUpdate;
49
50    typedef struct _SSystemUpdate
51    {
52        ESysUpdate mType;
53        QString mName;
54        QString mTag;
55        QString mDetails; // For patch only
56        QString mSize;    // For patch only
57        QString mVersion; // For sysupdates only
58        QDate   mDate;    // For patch only       
59        bool   misStandalone;
60        bool   misRequiresReboot;
61
62        _SSystemUpdate()
63        {
64            misStandalone= false;
65            misRequiresReboot= false;
66        }
67    }SSystemUpdate;
68
69    typedef struct _SFbsdUpdatesDescription
70    {
71        QString mRelease;
72        int     mUpdateNo;
73        QString mDescription;
74
75        _SFbsdUpdatesDescription():mUpdateNo(-1){;}
76
77    }SFbsdUpdatesDescription;
78
79    typedef enum{
80        eUndefined,
81        eFilesModifyedLocally,
82        eFilesToDelete,
83        eFilesToUpdate
84    }ECheckState;
85   
86    QVector<SSystemUpdate> updates() {return mvUpdates;}
87    QStringList filesToUpdate()      {return mFilesToUpdate;}
88    QStringList filesToDelete()      {return mFilesToRemove;}
89    QStringList fileslocalyModifyed(){return mFilesLocallyModifyed;}
90    bool        rebootRequired();
91    QVector<SFbsdUpdatesDescription> updateDescriptions(QString RelName = QString(), bool isForse = false);
92
93    void updateSelected(QVector<SSystemUpdate> selectedUpdates);
94
95protected:
96    virtual void onCheckUpdates();
97    virtual void onUpdateAll();
98    virtual void checkShellCommand(QString& cmd, QStringList& args);
99    virtual void updateShellCommand(QString& cmd, QStringList& args);
100
101    void onReadCheckLine(QString line);
102    void onReadUpdateLine(QString line);
103    virtual void onReadProcessChar(char character);
104
105    virtual void onCheckProcessfinished(int exitCode);
106    virtual void onUpdateProcessfinished(int exitCode);
107    virtual void onCancel();
108
109private:
110    bool misFREEBSDCheck;
111    QVector<SSystemUpdate> mvUpdates;
112    QStringList mFilesLocallyModifyed;
113    QStringList mFilesToRemove;
114    QStringList mFilesToUpdate;
115    bool        misFBSDRebootRequired;
116    bool        misRebootRequired;
117    ECheckState mCurrCheckState;
118
119    QVector<SSystemUpdate> mvUpdatesToApply;
120    int                    mCurrentUpdate;
121
122    QVector<SFbsdUpdatesDescription> mvFbsdUpdateDescriptions;
123    QString mCurrentFbsdDescription;
124
125    void parseCheckPCBSDLine(QString line);
126    void parseCheckFREEBSDLine(QString line);
127
128    void parsePatchUpdateLine(QString line);
129    void parseUpgradeLine(QString line);
130    void parseFreeBSDUpdateLine(QString line);
131
132    QString fbsdUpdateDescription(QString line);
133
134
135};
136
137#endif // SYSCONTROLLER_H
Note: See TracBrowser for help on using the repository browser.