Mercurial > minori
comparison src/gui/pages/anime_list.cc @ 105:6d8da6e64d61
theme: add dark stylesheet, make it actually usable
win32: make the titlebar black where available
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 03:54:26 -0500 |
parents | b315f3759c56 |
children | c8c72278f6fd |
comparison
equal
deleted
inserted
replaced
104:27455104ea37 | 105:6d8da6e64d61 |
---|---|
280 action->setCheckable(true); | 280 action->setCheckable(true); |
281 action->setChecked(!tree_view->isColumnHidden(i)); | 281 action->setChecked(!tree_view->isColumnHidden(i)); |
282 } | 282 } |
283 | 283 |
284 menu->addSeparator(); | 284 menu->addSeparator(); |
285 QAction* resetAction = menu->addAction(tr("Reset to defaults"), this, [this]() { | 285 menu->addAction(tr("Reset to defaults"), this, [this]() { |
286 for (int i = 0, count = tree_view->header()->count(); i < count; ++i) { | 286 for (int i = 0, count = tree_view->header()->count(); i < count; ++i) { |
287 SetColumnDefaults(); | 287 SetColumnDefaults(); |
288 } | 288 } |
289 // SaveSettings(); | 289 // SaveSettings(); |
290 }); | 290 }); |
291 menu->popup(QCursor::pos()); | 291 menu->popup(QCursor::pos()); |
292 (void)(resetAction); | |
293 } | 292 } |
294 | 293 |
295 void AnimeListPage::DisplayListMenu() { | 294 void AnimeListPage::DisplayListMenu() { |
296 QMenu* menu = new QMenu(this); | 295 QMenu* menu = new QMenu(this); |
297 menu->setAttribute(Qt::WA_DeleteOnClose); | 296 menu->setAttribute(Qt::WA_DeleteOnClose); |
310 Anime::Anime* anime = source_model->GetAnimeFromIndex(index); | 309 Anime::Anime* anime = source_model->GetAnimeFromIndex(index); |
311 if (anime) | 310 if (anime) |
312 animes.insert(anime); | 311 animes.insert(anime); |
313 } | 312 } |
314 | 313 |
315 QAction* action = menu->addAction(tr("Information"), [this, animes] { | 314 menu->addAction(tr("Information"), [this, animes] { |
316 for (auto& anime : animes) { | 315 for (auto& anime : animes) { |
317 InformationDialog* dialog = new InformationDialog( | 316 InformationDialog* dialog = new InformationDialog( |
318 *anime, [this, anime] { UpdateAnime(anime->GetId()); }, this); | 317 *anime, [this, anime] { UpdateAnime(anime->GetId()); }, this); |
319 | 318 |
320 dialog->show(); | 319 dialog->show(); |
321 dialog->raise(); | 320 dialog->raise(); |
322 dialog->activateWindow(); | 321 dialog->activateWindow(); |
323 } | 322 } |
324 }); | 323 }); |
325 menu->addSeparator(); | 324 menu->addSeparator(); |
326 action = menu->addAction(tr("Delete from list..."), [this, animes] { | 325 menu->addAction(tr("Delete from list..."), [this, animes] { |
327 for (auto& anime : animes) { | 326 for (auto& anime : animes) { |
328 RemoveAnime(anime->GetId()); | 327 RemoveAnime(anime->GetId()); |
329 } | 328 } |
330 }); | 329 }); |
331 menu->popup(QCursor::pos()); | 330 menu->popup(QCursor::pos()); |
385 if (!option) | 384 if (!option) |
386 return; | 385 return; |
387 | 386 |
388 InitBasicStyle(option); | 387 InitBasicStyle(option); |
389 | 388 |
390 // int exth = style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr, this); | |
391 QSize t(0, tree_view->frameWidth()); | 389 QSize t(0, tree_view->frameWidth()); |
392 if (tab_bar->isVisibleTo(this)) { | 390 if (tab_bar->isVisibleTo(this)) { |
393 t = tab_bar->sizeHint(); | 391 t = tab_bar->sizeHint(); |
394 t.setWidth(width()); | 392 t.setWidth(width()); |
395 } | 393 } |
419 AnimeListPage::AnimeListPage(QWidget* parent) : QWidget(parent) { | 417 AnimeListPage::AnimeListPage(QWidget* parent) : QWidget(parent) { |
420 /* Tab bar */ | 418 /* Tab bar */ |
421 tab_bar = new QTabBar(this); | 419 tab_bar = new QTabBar(this); |
422 tab_bar->setExpanding(false); | 420 tab_bar->setExpanding(false); |
423 tab_bar->setDrawBase(false); | 421 tab_bar->setDrawBase(false); |
424 tab_bar->setAutoFillBackground(true); | |
425 | |
426 if (parent) { | |
427 QPalette pal(parent->palette()); | |
428 setPalette(pal); | |
429 } | |
430 | 422 |
431 /* Tree view... */ | 423 /* Tree view... */ |
432 QWidget* tree_widget = new QWidget(this); | 424 QWidget* tree_widget = new QWidget(this); |
433 tree_view = new QTreeView(tree_widget); | 425 tree_view = new QTreeView(tree_widget); |
434 tree_view->setItemDelegate(new AnimeListPageDelegate(tree_view)); | 426 tree_view->setItemDelegate(new AnimeListPageDelegate(tree_view)); |