Compare commits
No commits in common. "main" and "dev" have entirely different histories.
@ -10,6 +10,7 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QBrush>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||
@ -131,13 +132,15 @@ void MainWindow::loadData(const QString &modDir) {
|
||||
}
|
||||
remainingMods.sort(Qt::CaseInsensitive);
|
||||
|
||||
// Add remaining mods that were not in the order.json
|
||||
finalModList.append(remainingMods);
|
||||
// Add remaining mods that were not in the order.json to the beginning of the list
|
||||
finalModList = remainingMods + finalModList;
|
||||
|
||||
// Add the final ordered mods to the list widget
|
||||
foreach (QString modName, finalModList) {
|
||||
for (int i = 0; i < finalModList.size(); ++i) {
|
||||
QString modName = finalModList[i];
|
||||
QString tooltipText = modTooltips.value(modName);
|
||||
addListItem(modName, tooltipText);
|
||||
bool isNew = remainingMods.contains(modName);
|
||||
addListItem(modName, tooltipText, -1, isNew);
|
||||
}
|
||||
|
||||
initialOrder = QStringList();
|
||||
@ -146,9 +149,22 @@ void MainWindow::loadData(const QString &modDir) {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::addListItem(const QString &modName, const QString &tooltipText, int position) {
|
||||
void MainWindow::addListItem(const QString &modName, const QString &tooltipText, int position, bool isNew) {
|
||||
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);
|
||||
void addListItem(const QString &modName, const QString &tooltipText, int position = -1, bool isNew = false);
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
QListWidget *listWidget;
|
||||
|
Loading…
x
Reference in New Issue
Block a user