chore(cpn): Refactor component updates (#3218)
* Refactoring * Fix current release id and process dlg events * enh: Process updates dialog add select/deselect all components * Change Expression to Pattern
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "repodatamodels.h"
|
||||
#include "repometadata.h"
|
||||
|
||||
class ReleasesItemModels
|
||||
{
|
||||
public:
|
||||
explicit ReleasesItemModels() {}
|
||||
virtual ~ReleasesItemModels() {}
|
||||
|
||||
enum ReleaseFlag {
|
||||
RELFLG_None = 0,
|
||||
RELFLG_Stable = 1 << 1,
|
||||
RELFLG_PreRelease = 1 << 2,
|
||||
RELFLG_Nightly = 1 << 3,
|
||||
};
|
||||
|
||||
static const QString flagsToString(const int flags);
|
||||
static const QString flagToString(const int flag);
|
||||
};
|
||||
|
||||
class ReleasesRawItemModel : public RepoRawItemModel, public ReleasesItemModels
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReleasesRawItemModel();
|
||||
virtual ~ReleasesRawItemModel() {}
|
||||
|
||||
protected:
|
||||
friend class RepoReleases;
|
||||
|
||||
virtual void parseJsonObject(const QJsonObject & obj);
|
||||
|
||||
void setNightlyName(const QString name);
|
||||
|
||||
private:
|
||||
QString m_nightlyName;
|
||||
};
|
||||
|
||||
class ReleasesFilteredItemModel: public RepoFilteredItemModel, public ReleasesItemModels
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReleasesFilteredItemModel(ReleasesRawItemModel * releasesRawItemModel);
|
||||
virtual ~ReleasesFilteredItemModel() {}
|
||||
|
||||
protected:
|
||||
friend class RepoReleases;
|
||||
|
||||
const int channelLatestId() const;
|
||||
void setChannel(const int channel);
|
||||
const QString version(const int id) const;
|
||||
};
|
||||
|
||||
class RepoReleases : public QObject, public RepoMetaData
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RepoReleases(QObject * parent, UpdateStatus * status, UpdateNetwork * network);
|
||||
virtual ~RepoReleases() {}
|
||||
|
||||
virtual void init(const QString & repoPath, const QString & nightly, const int resultsPerPage);
|
||||
virtual int setId(const int id) override;
|
||||
virtual bool retrieveMetaDataAll();
|
||||
virtual bool retrieveMetaDataOne(const int id) { return false; } // not implemented
|
||||
|
||||
int channelLatestId();
|
||||
void setChannel(const int channel);
|
||||
const QString version() const;
|
||||
|
||||
signals:
|
||||
void idChanged(int id);
|
||||
|
||||
private:
|
||||
ReleasesRawItemModel* const m_rawItemModel;
|
||||
ReleasesFilteredItemModel* const m_filteredItemModel;
|
||||
|
||||
virtual void dumpItemModel(const QString modelName, const QAbstractItemModel * itemModel) const;
|
||||
};
|
||||
Reference in New Issue
Block a user