Revert garbage
This commit is contained in:
parent
9698e749d4
commit
5c638271c6
@ -10,7 +10,6 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QBrush>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||
@ -132,15 +131,13 @@ void MainWindow::loadData(const QString &modDir) {
|
||||
}
|
||||
remainingMods.sort(Qt::CaseInsensitive);
|
||||
|
||||
// Add remaining mods that were not in the order.json to the beginning of the list
|
||||
finalModList = remainingMods + finalModList;
|
||||
// Add remaining mods that were not in the order.json
|
||||
finalModList.append(remainingMods);
|
||||
|
||||
// Add the final ordered mods to the list widget
|
||||
for (int i = 0; i < finalModList.size(); ++i) {
|
||||
QString modName = finalModList[i];
|
||||
foreach (QString modName, finalModList) {
|
||||
QString tooltipText = modTooltips.value(modName);
|
||||
bool isNew = remainingMods.contains(modName);
|
||||
addListItem(modName, tooltipText, -1, isNew);
|
||||
addListItem(modName, tooltipText);
|
||||
}
|
||||
|
||||
initialOrder = QStringList();
|
||||
@ -149,22 +146,9 @@ void MainWindow::loadData(const QString &modDir) {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::addListItem(const QString &modName, const QString &tooltipText, int position, bool isNew) {
|
||||
void MainWindow::addListItem(const QString &modName, const QString &tooltipText, int position) {
|
||||
QListWidgetItem *listItem = new QListWidgetItem(modName);
|
||||
listItem->setToolTip(tooltipText);
|
||||
|
||||
// Set background color for new items
|
||||
if (isNew) {
|
||||
listItem->setBackground(QBrush(QColor(255, 255, 200))); // Light yellow
|
||||
}
|
||||
|
||||
// Set position indicator
|
||||
if (position == -1) {
|
||||
position = ui->listWidget->count();
|
||||
}
|
||||
QString itemText = QString("%1. %2").arg(position + 1).arg(modName);
|
||||
listItem->setText(itemText);
|
||||
|
||||
if (position == -1) {
|
||||
ui->listWidget->addItem(listItem);
|
||||
} else {
|
||||
|
@ -31,7 +31,7 @@ private:
|
||||
void loadConfig();
|
||||
bool checkModsDirectory();
|
||||
void loadData(const QString &modDir);
|
||||
void addListItem(const QString &modName, const QString &tooltipText, int position = -1, bool isNew = false);
|
||||
void addListItem(const QString &modName, const QString &tooltipText, int position = -1);
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
QListWidget *listWidget;
|
||||
|
Loading…
x
Reference in New Issue
Block a user