5 #define ALL_CHANNEL "all"
6 #define MAX_TEMP_CHANNELS 30
14 mChannelToIgnore = {
"UserStudy"};
56 case static_cast<int>(ColumnNumber::NameColumn):
72 if (!mPermanentItems.empty())
74 if (row <= mPermanentItems.size() - 1)
75 return createIndex(row, column, mPermanentItems.at(row));
77 if (!mTemporaryItems.empty())
79 if ((
unsigned long)row <= (
unsigned long)(mPermanentItems.size() + mTemporaryItems.size() - 1))
80 return createIndex(row, column, mTemporaryItems.at(row - mPermanentItems.size()));
91 return mPermanentItems.size() + mTemporaryItems.size();
104 int offset = mPermanentItems.size() + mTemporaryItems.size();
109 delete mTemporaryItems.last();
110 mTemporaryItems.removeLast();
116 mTemporaryItems.prepend(item);
121 bool ChannelModel::channelExists(
const QString&
name)
const
124 if (item->name() ==
name)
return true;
126 if (item->name() ==
name)
return true;
135 if(msg_text == channel_name +
" has manually been added to channellist")
145 for (
auto element : mPermanentItems)
149 all_channel = element;
151 if (element->name().toStdString() == channel_name)
156 if (item ==
nullptr || all_channel ==
nullptr)
158 for (
auto element : mTemporaryItems)
162 all_channel = element;
164 if (element->name().toStdString() == channel_name)
170 if (all_channel ==
nullptr)
179 std::string shown_text = msg_text;
180 if (shown_text.length() > 255)
182 shown_text = shown_text.substr(0, 255) +
"...";
#define MAX_TEMP_CHANNELS
This class represents a channel in the channel model. It primarily holds the channel name and its ent...
void appendEntry(ChannelEntry *entry)
const QString name() const
Table model for log channels.
void handleLogmanagerCallback(const spdlog::level::level_enum &t, const std::string &channel_name, const std::string &msg_text)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
void updated(spdlog::level::level_enum t, const std::string &logger_name, std::string const &msg)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
static ChannelModel * instance()
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
QVariant data(const QModelIndex &index, int role) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
ChannelItem * addChannel(const QString name)
CallbackHook< void(const spdlog::level::level_enum &, const std::string &, const std::string &)> & get_gui_callback()
static LogManager * get_instance(const std::filesystem::path &file_name="")
void beginInsertRows(const QModelIndex &parent, int first, int last)
void beginRemoveRows(const QModelIndex &parent, int first, int last)
QModelIndex createIndex(int row, int column, void *ptr) const const
virtual Qt::ItemFlags flags(const QModelIndex &index) const const
bool hasIndex(int row, int column, const QModelIndex &parent) const const
bool contains(const T &value) const const
void * internalPointer() const const
bool isValid() const const
QObject * parent() const const
QString fromStdString(const std::string &str)
The ChannelEntry struct is used by the ChannelItem class to store a single entry.