mirror of
https://github.com/YACReader/yacreader
synced 2025-07-22 15:04:40 -04:00
colorized empty label widget and fixed label info on insert
This commit is contained in:
@ -55,7 +55,7 @@ AddLabelDialog::AddLabelDialog(QWidget *parent) :
|
||||
|
||||
YACReader::LabelColors AddLabelDialog::selectedColor()
|
||||
{
|
||||
return YACReader::LabelColors(list->currentRow());
|
||||
return YACReader::LabelColors(list->currentRow()+1);
|
||||
}
|
||||
|
||||
QString AddLabelDialog::name()
|
||||
|
@ -73,6 +73,12 @@ QVariant ReadingListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant(ReadingListModel::Separator);
|
||||
}
|
||||
|
||||
if (role == ReadingListModel::LabelColorRole && typeid(*item) == typeid(LabelItem) )
|
||||
{
|
||||
LabelItem * labelItem = static_cast<LabelItem*>(item);
|
||||
return QVariant(labelItem->colorid());
|
||||
}
|
||||
|
||||
if (role == ReadingListModel::IDRole)
|
||||
return item->getId();
|
||||
|
||||
|
@ -52,7 +52,8 @@ public:
|
||||
|
||||
enum Roles {
|
||||
TypeListsRole = Qt::UserRole + 1,
|
||||
IDRole
|
||||
IDRole,
|
||||
LabelColorRole
|
||||
};
|
||||
|
||||
enum TypeList {
|
||||
|
@ -36,10 +36,10 @@ EmptyLabelWidget::EmptyLabelWidget(QWidget *parent) :
|
||||
|
||||
void EmptyLabelWidget::setColor(YACReader::LabelColors color)
|
||||
{
|
||||
//TODO tint the widget depending on color
|
||||
//backgroundColor = "#FF0000";
|
||||
|
||||
//repaint();
|
||||
QPixmap p(":/images/empty_label.png");
|
||||
QImage img = p.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
YACReader::colorize(img,QColor(YACReader::labelColorToRGBString(color)));
|
||||
iconLabel->setPixmap(QPixmap::fromImage(img));
|
||||
}
|
||||
|
||||
void EmptyLabelWidget::paintEvent(QPaintEvent * event)
|
||||
|
@ -80,32 +80,31 @@ void YACReaderNavigationController::loadFolderInfo(const QModelIndex &modelIndex
|
||||
|
||||
void YACReaderNavigationController::loadListInfo(const QModelIndex &modelIndex)
|
||||
{
|
||||
qulonglong id = modelIndex.data(ReadingListModel::IDRole).toULongLong();
|
||||
|
||||
switch(modelIndex.data(ReadingListModel::TypeListsRole).toInt())
|
||||
{
|
||||
case ReadingListModel::SpecialList:
|
||||
loadSpecialListInfo(id);
|
||||
loadSpecialListInfo(modelIndex);
|
||||
break;
|
||||
|
||||
case ReadingListModel::Label:
|
||||
loadLabelInfo(id);
|
||||
loadLabelInfo(modelIndex);
|
||||
break;
|
||||
|
||||
case ReadingListModel::ReadingList:
|
||||
loadReadingListInfo(id);
|
||||
loadReadingListInfo(modelIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void YACReaderNavigationController::loadSpecialListInfo(const qulonglong id)
|
||||
void YACReaderNavigationController::loadSpecialListInfo(const QModelIndex &modelIndex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void YACReaderNavigationController::loadLabelInfo(const qulonglong id)
|
||||
void YACReaderNavigationController::loadLabelInfo(const QModelIndex &modelIndex)
|
||||
{
|
||||
//check comics in folder with id = folderId
|
||||
qulonglong id = modelIndex.data(ReadingListModel::IDRole).toULongLong();
|
||||
//check comics in label with id = id
|
||||
libraryWindow->comicsModel->setupLabelModelData(id,libraryWindow->foldersModel->getDatabase());
|
||||
libraryWindow->comicsView->setModel(libraryWindow->comicsModel);
|
||||
|
||||
@ -119,13 +118,13 @@ void YACReaderNavigationController::loadLabelInfo(const qulonglong id)
|
||||
else{
|
||||
//showEmptyFolder
|
||||
//loadEmptyLabelInfo(); //there is no info in an empty label by now, TODO design something
|
||||
//TODO libraryWindow->emptyLabelWidget->setColor(YACReader::YRed);
|
||||
libraryWindow->emptyLabelWidget->setColor((YACReader::LabelColors)modelIndex.data(ReadingListModel::LabelColorRole).toInt());
|
||||
libraryWindow->showEmptyLabelView();
|
||||
libraryWindow->disableComicsActions(true);
|
||||
}
|
||||
}
|
||||
|
||||
void YACReaderNavigationController::loadReadingListInfo(const qulonglong id)
|
||||
void YACReaderNavigationController::loadReadingListInfo(const QModelIndex &modelIndex)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ public slots:
|
||||
|
||||
void loadFolderInfo(const QModelIndex & modelIndex);
|
||||
void loadListInfo(const QModelIndex & modelIndex);
|
||||
void loadSpecialListInfo(const qulonglong id);
|
||||
void loadLabelInfo(const qulonglong id);
|
||||
void loadReadingListInfo(const qulonglong id);
|
||||
void loadSpecialListInfo(const QModelIndex & modelIndex);
|
||||
void loadLabelInfo(const QModelIndex & modelIndex);
|
||||
void loadReadingListInfo(const QModelIndex & modelIndex);
|
||||
|
||||
void loadPreviousStatus();
|
||||
|
||||
|
Reference in New Issue
Block a user