ConnectionManager overhaul
- connection settings are now changed by seperate component currently called in a seperate window - old settings pane on the right of the connections had been removed - new edit config button added between new connection and remove connection
This commit is contained in:
parent
78247c7abe
commit
b09e8a6d4b
20 changed files with 836 additions and 733 deletions
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "ConnectionConfig.h"
|
||||
#include "Expected.h"
|
||||
#include <QVector>
|
||||
|
||||
class ConnectionList;
|
||||
|
||||
/** \brief Model class for the list of connections.
|
||||
*
|
||||
|
|
@ -30,30 +30,44 @@ public:
|
|||
ColCount
|
||||
};
|
||||
|
||||
ConnectionListModel(ConnectionList *conns, QObject *parent);
|
||||
ConnectionListModel(QObject *parent);
|
||||
ConnectionListModel(const ConnectionListModel&) = delete;
|
||||
~ConnectionListModel() override;
|
||||
|
||||
|
||||
// BEGIN Model/View related functions
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual int columnCount(const QModelIndex &/*parent*/) const override;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
// virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
// END Model/View related functions
|
||||
|
||||
void newItem();
|
||||
Expected<ConnectionConfig> get(size_t row);
|
||||
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
Expected<ConnectionConfig> get(int row);
|
||||
|
||||
void load();
|
||||
// Writes all entries to storage
|
||||
void save();
|
||||
void save(size_t index);
|
||||
void save(size_t index, const ConnectionConfig &cc);
|
||||
// Writes the specified entry to storage
|
||||
void save(int index);
|
||||
// // Save changes to the config
|
||||
// void save(size_t index, const ConnectionConfig &cc);
|
||||
/** Matches cc to the list by looking at its uuid.
|
||||
*
|
||||
* If it is not in the list it is added. If the uuid is in the list that entry is updated.
|
||||
* In both cases the data is also directly written to long term storage.
|
||||
*/
|
||||
void save(const ConnectionConfig &cc);
|
||||
static QString makeLongDescription(const ConnectionConfig &cfg);
|
||||
private:
|
||||
|
||||
ConnectionList *m_connections;
|
||||
|
||||
using ConnectionList = QVector<ConnectionConfig>;
|
||||
ConnectionList m_connections;
|
||||
|
||||
QString iniFileName();
|
||||
};
|
||||
|
||||
#endif // CONNECTIONLISTMODEL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue