@@ -991,6 +991,8 @@ void GameListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
991
991
return ;
992
992
}
993
993
994
+ bool isLView = gameList->listMode == " LargeIcons" ;
995
+
994
996
QString gameName = gameList->getViewString (index , COL_NAME);
995
997
GameInfo *gameInfo = gameList->getGameInfo (index , gameName);
996
998
@@ -1037,7 +1039,14 @@ void GameListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
1037
1039
const bool isLargeIcon = pmIcon.width () > 16 ;
1038
1040
const bool isZooming = win->actionRowDelegate ->isChecked ();
1039
1041
1040
- if (isLargeIcon)
1042
+ if (isLView)
1043
+ {
1044
+ if (currentGame == gameName)
1045
+ pmFinal.load (isDarkBg ? " :/res/mamegui/deco-darkbg.png" : " :/res/mamegui/deco-brightbg.png" );
1046
+ else
1047
+ pmFinal = pmIcon = pmIcon.scaled (QSize (32 , 32 ), Qt::KeepAspectRatio, Qt::SmoothTransformation);
1048
+ }
1049
+ else if (isLargeIcon)
1041
1050
{
1042
1051
if (currentGame == gameName && isZooming)
1043
1052
pmFinal.load (isDarkBg ? " :/res/mamegui/deco-darkbg.png" : " :/res/mamegui/deco-brightbg.png" );
@@ -1051,7 +1060,12 @@ void GameListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
1051
1060
QPainter p;
1052
1061
p.begin (&pmFinal);
1053
1062
1054
- if (currentGame == gameName && isLargeIcon && isZooming)
1063
+ if (isLView)
1064
+ {
1065
+ if (currentGame == gameName)
1066
+ p.drawPixmap (3 , 3 , 32 , 32 , pmIcon);
1067
+ }
1068
+ else if (currentGame == gameName && isLargeIcon && isZooming)
1055
1069
p.drawPixmap (3 , 3 , 32 , 32 , pmIcon);
1056
1070
1057
1071
// paint the unavailable icon on top of original icon
@@ -1066,31 +1080,54 @@ void GameListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
1066
1080
1067
1081
p.end ();
1068
1082
1069
- // save it for zooming
1070
- int icoSize, decoSize;
1071
1083
1072
- if (pmFinal. width () > 16 )
1084
+ if (isLView )
1073
1085
{
1074
- icoSize = 32 ;
1075
- decoSize = 38 ;
1076
-
1077
1086
gameList->pmDeco = pmFinal;
1087
+
1088
+ rectDeco.setTop (rectDeco.top () + 16 );
1089
+ rectText.setTop (rectDeco.top () + 20 );
1090
+ rectText.setLeft (rectDeco.left () - 32 );
1091
+ rectText.setWidth (72 );
1092
+ rectText.setHeight (32 );
1093
+ drawDisplay (painter, option, rectText, gameList->getViewString (index , COL_DESC));
1094
+ drawDecoration (painter, option, rectDeco, pmFinal);
1078
1095
}
1079
1096
else
1080
1097
{
1081
- icoSize = decoSize = 16 ;
1098
+ // save it for zooming
1099
+ int icoSize, decoSize;
1082
1100
1083
- if (currentGame == gameName)
1084
- gameList->pmDeco = QPixmap ();
1085
- }
1101
+ if (pmFinal.width () > 16 )
1102
+ {
1103
+ icoSize = 32 ;
1104
+ decoSize = 38 ;
1086
1105
1087
- rectDeco.setLeft (rectDeco.left () + cloneOffset);
1088
- rectDeco.setWidth (icoSize + 6 );
1106
+ gameList->pmDeco = pmFinal;
1107
+ }
1108
+ else
1109
+ {
1110
+ icoSize = decoSize = 16 ;
1111
+
1112
+ if (currentGame == gameName)
1113
+ gameList->pmDeco = QPixmap ();
1114
+ }
1115
+
1116
+ rectDeco.setLeft (rectDeco.left () + cloneOffset);
1117
+ rectDeco.setWidth (icoSize + 6 );
1118
+
1119
+ if (currentGame == gameName && isLargeIcon && isZooming)
1120
+ rectText.setLeft (rectText.left () + decoSize);
1121
+ else
1122
+ rectText.setLeft (rectText.left () + decoSize + cloneOffset + 6 );
1123
+ drawDisplay (painter, option, rectText, gameList->getViewString (index , COL_DESC));
1124
+
1125
+ // paint item icon
1126
+ if (currentGame != gameName || !isZooming ||
1127
+ (currentGame == gameName && !isLargeIcon))
1128
+ drawDecoration (painter, option, rectDeco, pmFinal);
1129
+ }
1089
1130
1090
- if (currentGame == gameName && isLargeIcon && isZooming)
1091
- rectText.setLeft (rectText.left () + decoSize);
1092
- else
1093
- rectText.setLeft (rectText.left () + decoSize + cloneOffset + 6 );
1094
1131
1095
1132
// paint item text
1096
1133
/* QColor foreColor;
@@ -1100,12 +1137,6 @@ void GameListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
1100
1137
foreColor = QColor((isDarkBg) ? Qt::white : Qt::black);
1101
1138
painter->setPen(foreColor);
1102
1139
//*/
1103
- drawDisplay (painter, option, rectText, gameList->getViewString (index , COL_DESC));
1104
-
1105
- // paint item icon
1106
- if (currentGame != gameName || !isZooming ||
1107
- (currentGame == gameName && !isLargeIcon))
1108
- drawDecoration (painter, option, rectDeco, pmFinal);
1109
1140
1110
1141
return ;
1111
1142
}
@@ -1320,8 +1351,8 @@ void Gamelist::restoreGameSelection()
1320
1351
void Gamelist::centerGameSelection (QModelIndex index)
1321
1352
{
1322
1353
bool isLView = false ;
1323
- // if (win->actionLargeIcons->isChecked())
1324
- // isLView = true;
1354
+ if (win->actionLargeIcons ->isChecked ())
1355
+ isLView = true ;
1325
1356
1326
1357
// fixme: time consuming?
1327
1358
if (isLView)
@@ -1470,11 +1501,11 @@ void Gamelist::init(bool toggleState, int initMethod)
1470
1501
{
1471
1502
listMode = " Details" ;
1472
1503
}
1473
- // else if (win->actionLargeIcons->isChecked())
1474
- // {
1475
- // listMode = "LargeIcons";
1476
- // isLView = true;
1477
- // }
1504
+ else if (win->actionLargeIcons ->isChecked ())
1505
+ {
1506
+ listMode = " LargeIcons" ;
1507
+ isLView = true ;
1508
+ }
1478
1509
else
1479
1510
listMode = " Grouped" ;
1480
1511
@@ -1496,6 +1527,11 @@ void Gamelist::init(bool toggleState, int initMethod)
1496
1527
win->layMainView ->addWidget (win->lvGameList );
1497
1528
win->lvGameList ->show ();
1498
1529
win->lvGameList ->setModel (gameListPModel);
1530
+
1531
+ if (defaultGameListDelegate == NULL )
1532
+ defaultGameListDelegate = win->lvGameList ->itemDelegate ();
1533
+
1534
+ win->lvGameList ->setItemDelegate (&gamelistDelegate);
1499
1535
}
1500
1536
else
1501
1537
{
@@ -1813,8 +1849,8 @@ void Gamelist::loadMMO(int msgCat)
1813
1849
void Gamelist::initMenus ()
1814
1850
{
1815
1851
bool isLView = false ;
1816
- // if (win->actionLargeIcons->isChecked())
1817
- // isLView = true;
1852
+ if (win->actionLargeIcons ->isChecked ())
1853
+ isLView = true ;
1818
1854
1819
1855
colSortActionGroup = new QActionGroup (win->menuArrangeIcons );
1820
1856
0 commit comments