Skip to content

Commit fe8c3aa

Browse files
committed
some fixes and removed obsolete code
1 parent dda9e11 commit fe8c3aa

File tree

5 files changed

+12
-288
lines changed

5 files changed

+12
-288
lines changed

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ bool bootstrap()
123123

124124
// cycle logfile
125125
removeOldFiles(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()),
126-
"ModOrganizer*.log", 5, QDir::Name);
126+
"usvfs*.log", 5, QDir::Name);
127127

128128
createAndMakeWritable(AppConfig::profilesPath());
129129
createAndMakeWritable(AppConfig::modsPath());

src/mainwindow.cpp

Lines changed: 5 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ MainWindow::MainWindow(const QString &exeName
186186
m_RefreshProgress->setVisible(false);
187187
statusBar()->addWidget(m_RefreshProgress, 1000);
188188
statusBar()->clearMessage();
189+
statusBar()->hide();
189190

190191
ui->actionEndorseMO->setVisible(false);
191192

@@ -233,8 +234,6 @@ MainWindow::MainWindow(const QString &exeName
233234
}
234235
ui->espList->installEventFilter(m_OrganizerCore.pluginList());
235236

236-
ui->bsaList->setLocalMoveOnly(true);
237-
238237
ui->splitter->setStretchFactor(0, 3);
239238
ui->splitter->setStretchFactor(1, 2);
240239

@@ -302,9 +301,6 @@ MainWindow::MainWindow(const QString &exeName
302301

303302
connect(this, SIGNAL(styleChanged(QString)), this, SLOT(updateStyle(QString)));
304303

305-
m_CheckBSATimer.setSingleShot(true);
306-
connect(&m_CheckBSATimer, SIGNAL(timeout()), this, SLOT(checkBSAList()));
307-
308304
m_UpdateProblemsTimer.setSingleShot(true);
309305
connect(&m_UpdateProblemsTimer, SIGNAL(timeout()), this, SLOT(updateProblemsButton()));
310306

@@ -1317,157 +1313,6 @@ static QStringList toStringList(InputIterator current, InputIterator end)
13171313
return result;
13181314
}
13191315

1320-
void MainWindow::updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives)
1321-
{
1322-
m_DefaultArchives = defaultArchives;
1323-
ui->bsaList->clear();
1324-
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
1325-
ui->bsaList->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
1326-
#else
1327-
ui->bsaList->header()->setResizeMode(QHeaderView::ResizeToContents);
1328-
#endif
1329-
1330-
std::vector<std::pair<UINT32, QTreeWidgetItem*>> items;
1331-
1332-
IPluginGame *gamePlugin = qApp->property("managed_game").value<IPluginGame*>();
1333-
BSAInvalidation *invalidation = gamePlugin->feature<BSAInvalidation>();
1334-
std::vector<FileEntry::Ptr> files = m_OrganizerCore.directoryStructure()->getFiles();
1335-
1336-
QStringList plugins = m_OrganizerCore.findFiles("", [] (const QString &fileName) -> bool {
1337-
return fileName.endsWith(".esp", Qt::CaseInsensitive)
1338-
|| fileName.endsWith(".esm", Qt::CaseInsensitive);
1339-
});
1340-
1341-
auto hasAssociatedPlugin = [&](const QString &bsaName) -> bool {
1342-
for (const QString &pluginName : plugins) {
1343-
QFileInfo pluginInfo(pluginName);
1344-
if (bsaName.startsWith(QFileInfo(pluginName).baseName(), Qt::CaseInsensitive)
1345-
&& (m_OrganizerCore.pluginList()->state(pluginInfo.fileName()) == IPluginList::STATE_ACTIVE)) {
1346-
return true;
1347-
}
1348-
}
1349-
return false;
1350-
};
1351-
1352-
for (FileEntry::Ptr current : files) {
1353-
QFileInfo fileInfo(ToQString(current->getName().c_str()));
1354-
1355-
if (fileInfo.suffix().toLower() == "bsa") {
1356-
int index = activeArchives.indexOf(fileInfo.fileName());
1357-
if (index == -1) {
1358-
index = 0xFFFF;
1359-
} else {
1360-
index += 2;
1361-
}
1362-
1363-
if ((invalidation != nullptr) && invalidation->isInvalidationBSA(fileInfo.fileName())) {
1364-
index = 1;
1365-
}
1366-
1367-
int originId = current->getOrigin();
1368-
FilesOrigin &origin = m_OrganizerCore.directoryStructure()->getOriginByID(originId);
1369-
1370-
QTreeWidgetItem *newItem = new QTreeWidgetItem(QStringList()
1371-
<< fileInfo.fileName()
1372-
<< ToQString(origin.getName()));
1373-
newItem->setData(0, Qt::UserRole, index);
1374-
newItem->setData(1, Qt::UserRole, originId);
1375-
newItem->setFlags(newItem->flags() & ~Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable);
1376-
newItem->setCheckState(0, (index != -1) ? Qt::Checked : Qt::Unchecked);
1377-
newItem->setData(0, Qt::UserRole, false);
1378-
if (m_OrganizerCore.settings().forceEnableCoreFiles()
1379-
&& defaultArchives.contains(fileInfo.fileName())) {
1380-
newItem->setCheckState(0, Qt::Checked);
1381-
newItem->setDisabled(true);
1382-
newItem->setData(0, Qt::UserRole, true);
1383-
} else if (fileInfo.fileName().compare("update.bsa", Qt::CaseInsensitive) == 0) {
1384-
newItem->setCheckState(0, Qt::Checked);
1385-
newItem->setDisabled(true);
1386-
} else if (hasAssociatedPlugin(fileInfo.fileName())) {
1387-
newItem->setCheckState(0, Qt::Checked);
1388-
newItem->setDisabled(true);
1389-
}
1390-
1391-
if (index < 0) index = 0;
1392-
1393-
UINT32 sortValue = ((origin.getPriority() & 0xFFFF) << 16) | (index & 0xFFFF);
1394-
items.push_back(std::make_pair(sortValue, newItem));
1395-
}
1396-
}
1397-
1398-
std::sort(items.begin(), items.end(), BySortValue);
1399-
1400-
for (auto iter = items.begin(); iter != items.end(); ++iter) {
1401-
int originID = iter->second->data(1, Qt::UserRole).toInt();
1402-
1403-
FilesOrigin origin = m_OrganizerCore.directoryStructure()->getOriginByID(originID);
1404-
QString modName("data");
1405-
unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName()));
1406-
if (modIndex != UINT_MAX) {
1407-
ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex);
1408-
modName = modInfo->name();
1409-
}
1410-
QList<QTreeWidgetItem*> items = ui->bsaList->findItems(modName, Qt::MatchFixedString);
1411-
QTreeWidgetItem *subItem = nullptr;
1412-
if (items.length() > 0) {
1413-
subItem = items.at(0);
1414-
} else {
1415-
subItem = new QTreeWidgetItem(QStringList(modName));
1416-
subItem->setFlags(subItem->flags() & ~Qt::ItemIsDragEnabled);
1417-
ui->bsaList->addTopLevelItem(subItem);
1418-
}
1419-
subItem->addChild(iter->second);
1420-
subItem->setExpanded(true);
1421-
}
1422-
1423-
checkBSAList();
1424-
}
1425-
1426-
1427-
void MainWindow::checkBSAList()
1428-
{
1429-
DataArchives *archives = m_OrganizerCore.managedGame()->feature<DataArchives>();
1430-
1431-
if (archives != nullptr) {
1432-
ui->bsaList->blockSignals(true);
1433-
ON_BLOCK_EXIT([&] () { ui->bsaList->blockSignals(false); });
1434-
1435-
QStringList defaultArchives = archives->archives(m_OrganizerCore.currentProfile());
1436-
1437-
bool warning = false;
1438-
1439-
for (int i = 0; i < ui->bsaList->topLevelItemCount(); ++i) {
1440-
bool modWarning = false;
1441-
QTreeWidgetItem *tlItem = ui->bsaList->topLevelItem(i);
1442-
for (int j = 0; j < tlItem->childCount(); ++j) {
1443-
QTreeWidgetItem *item = tlItem->child(j);
1444-
QString filename = item->text(0);
1445-
item->setIcon(0, QIcon());
1446-
item->setToolTip(0, QString());
1447-
1448-
if (item->checkState(0) == Qt::Unchecked) {
1449-
if (defaultArchives.contains(filename)) {
1450-
item->setIcon(0, QIcon(":/MO/gui/warning"));
1451-
item->setToolTip(0, tr("This bsa is enabled in the ini file so it may be required!"));
1452-
modWarning = true;
1453-
}
1454-
}
1455-
}
1456-
if (modWarning) {
1457-
ui->bsaList->expandItem(ui->bsaList->topLevelItem(i));
1458-
warning = true;
1459-
}
1460-
}
1461-
1462-
if (warning) {
1463-
ui->tabWidget->setTabIcon(1, QIcon(":/MO/gui/warning"));
1464-
} else {
1465-
ui->tabWidget->setTabIcon(1, QIcon());
1466-
}
1467-
}
1468-
}
1469-
1470-
14711316
void MainWindow::saveModMetas()
14721317
{
14731318
for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
@@ -1476,7 +1321,6 @@ void MainWindow::saveModMetas()
14761321
}
14771322
}
14781323

1479-
14801324
void MainWindow::fixCategories()
14811325
{
14821326
for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
@@ -1856,8 +1700,10 @@ void MainWindow::setESPListSorting(int index)
18561700
void MainWindow::refresher_progress(int percent)
18571701
{
18581702
if (percent == 100) {
1859-
// m_RefreshProgress->setVisible(false);
1703+
m_RefreshProgress->setVisible(false);
1704+
statusBar()->hide();
18601705
} else if (!m_RefreshProgress->isVisible()) {
1706+
statusBar()->show();
18611707
m_RefreshProgress->setVisible(true);
18621708
m_RefreshProgress->setRange(0, 100);
18631709
m_RefreshProgress->setValue(percent);
@@ -3815,8 +3661,7 @@ void MainWindow::updateDownloadListDelegate()
38153661

38163662
void MainWindow::modDetailsUpdated(bool)
38173663
{
3818-
--m_ModsToUpdate;
3819-
if (m_ModsToUpdate == 0) {
3664+
if (--m_ModsToUpdate == 0) {
38203665
statusBar()->hide();
38213666
m_ModListSortProxy->setCategoryFilter(boost::assign::list_of(CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE));
38223667
for (int i = 0; i < ui->categoriesList->topLevelItemCount(); ++i) {
@@ -4022,19 +3867,6 @@ void MainWindow::displayColumnSelection(const QPoint &pos)
40223867
}
40233868
}
40243869

4025-
4026-
void MainWindow::on_bsaList_customContextMenuRequested(const QPoint &pos)
4027-
{
4028-
m_ContextItem = ui->bsaList->itemAt(pos);
4029-
4030-
// m_ContextRow = ui->bsaList->indexOfTopLevelItem(ui->bsaList->itemAt(pos));
4031-
4032-
QMenu menu;
4033-
menu.addAction(tr("Extract..."), this, SLOT(extractBSATriggered()));
4034-
4035-
menu.exec(ui->bsaList->mapToGlobal(pos));
4036-
}
4037-
40383870
void MainWindow::on_actionProblems_triggered()
40393871
{
40403872
ProblemsDialog problems(m_PluginContainer.plugins<IPluginDiagnose>(), this);
@@ -4610,12 +4442,6 @@ void MainWindow::on_categoriesOrBtn_toggled(bool checked)
46104442
}
46114443
}
46124444

4613-
void MainWindow::on_managedArchiveLabel_linkHovered(const QString&)
4614-
{
4615-
QToolTip::showText(QCursor::pos(),
4616-
ui->managedArchiveLabel->toolTip());
4617-
}
4618-
46194445
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
46204446
{
46214447
//Accept copy or move drags to the download window. Link drags are not

src/mainwindow.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class MainWindow : public QMainWindow, public IUserInterface
8888
virtual bool unlockClicked() override;
8989

9090
bool addProfile();
91-
void updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives);
9291
void refreshDataTree();
9392
void refreshSaveList();
9493

@@ -439,8 +438,6 @@ private slots:
439438

440439
void startExeAction();
441440

442-
void checkBSAList();
443-
444441
void updateProblemsButton();
445442

446443
void saveModMetas();
@@ -494,7 +491,6 @@ private slots: // ui slots
494491
void on_actionUpdate_triggered();
495492
void on_actionEndorseMO_triggered();
496493

497-
void on_bsaList_customContextMenuRequested(const QPoint &pos);
498494
void on_btnRefreshData_clicked();
499495
void on_categoriesList_customContextMenuRequested(const QPoint &pos);
500496
void on_conflictsCheckBox_toggled(bool checked);
@@ -522,7 +518,6 @@ private slots: // ui slots
522518
void on_actionCopy_Log_to_Clipboard_triggered();
523519
void on_categoriesAndBtn_toggled(bool checked);
524520
void on_categoriesOrBtn_toggled(bool checked);
525-
void on_managedArchiveLabel_linkHovered(const QString &link);
526521
};
527522

528523

0 commit comments

Comments
 (0)