forked from Silverfish/proton-bridge
Other: bridge-gui-tester.
WIP: Added bridge-gui-test app. WIP: goos. WIP: event sending. WIP: include bridge-gui-tester in frontend project WIP: app end login event buttons. WIP: login events. . WIP: moved and renamed tab code WIP: wired login logic. WIP: setColorScheme and loginAbort. WIP: more calls implemented + random users and numbers. WIP: mail calls. WIP: bug reports. WIP: more signal send via the grpc Qt proxy. WIP: Qt proxy on the event stream tab. WIP: user change events wiring. WIP: GUI changes. WIP: minor refactoring. WIP: remove event stream tab. WIP: GUI changes. WIP: separate logs, cache and keychain implemented. WIP: Automatic update. Other: fix linux build. WIP: fix for live addition/modification/removal of users on the server side.
This commit is contained in:
61
internal/frontend/bridge-gui/bridge-gui-tester/UserTable.h
Normal file
61
internal/frontend/bridge-gui/bridge-gui-tester/UserTable.h
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2022 Proton AG
|
||||
//
|
||||
// This file is part of Proton Mail Bridge.
|
||||
//
|
||||
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Proton Mail Bridge 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
#ifndef BRIDGE_GUI_TESTER_USER_TABLE_H
|
||||
#define BRIDGE_GUI_TESTER_USER_TABLE_H
|
||||
|
||||
|
||||
#include <bridgepp/User/User.h>
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \brief User table model class
|
||||
//****************************************************************************************************************************************************
|
||||
|
||||
class UserTable : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public: // member functions.
|
||||
explicit UserTable(QObject *parent); ///< Default constructor.
|
||||
UserTable(UserTable const &) = delete; ///< Disabled copy-constructor.
|
||||
UserTable(UserTable &&) = delete; ///< Disabled assignment copy-constructor.
|
||||
~UserTable() = default; ///< Destructor.
|
||||
UserTable &operator=(UserTable const &) = delete; ///< Disabled assignment operator.
|
||||
UserTable &operator=(UserTable &&) = delete; ///< Disabled move assignment operator.
|
||||
qint32 userCount() const; ///< Return the number of users in the table.
|
||||
void append(bridgepp::SPUser const& user); ///< Append a user.
|
||||
bridgepp::SPUser userAtIndex(qint32 index); ///< Return the user at the given index.
|
||||
bridgepp::SPUser userWithID(QString const &userID); ///< Return the user with a given id.
|
||||
qint32 indexOfUser(QString const& userID); ///< Return the index of a given User.
|
||||
void touch(qint32 index); ///< touch the user at a given index (indicates it has been modified).
|
||||
void remove(qint32 index); ///< Remove the user at a given index.
|
||||
QList<bridgepp::SPUser> users() const; ///< Return a copy of the user list.
|
||||
|
||||
private: // data members.
|
||||
int rowCount(QModelIndex const &parent) const override; ///< Get the number of rows in the table.
|
||||
int columnCount(QModelIndex const &parent) const override; ///< Get the number of columns in the table.
|
||||
QVariant data(QModelIndex const &index, int role) const override; ///< Get the data for a role at a given index.
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override; ///< Get header data.
|
||||
bool isIndexValid(qint32 index) const; ///< return true iff the index is valid.
|
||||
|
||||
public:
|
||||
QList<bridgepp::SPUser> users_;
|
||||
};
|
||||
|
||||
|
||||
#endif //BRIDGE_GUI_TESTER_USER_TABLE_H
|
||||
Reference in New Issue
Block a user