Compare commits

...
24 changed files with 138 additions and 535 deletions
+11 -1
View File
@@ -46,7 +46,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="about">
<attribute name="title">
@@ -183,6 +183,11 @@
<string>Ren (Korean)</string>
</property>
</item>
<item>
<property name="text">
<string>... more (Can't track)</string>
</property>
</item>
</widget>
</item>
</layout>
@@ -249,6 +254,11 @@
<string notr="true">z929669</string>
</property>
</item>
<item>
<property name="text">
<string>thosrtanner</string>
</property>
</item>
</widget>
</item>
</layout>
+9 -3
View File
@@ -20,6 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "downloadlistsortproxy.h"
#include "downloadlist.h"
#include "downloadmanager.h"
#include "settings.h"
DownloadListSortProxy::DownloadListSortProxy(const DownloadManager *manager, QObject *parent)
: QSortFilterProxyModel(parent), m_Manager(manager), m_CurrentFilter()
@@ -55,12 +56,17 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left,
}
bool DownloadListSortProxy::filterAcceptsRow(int source_row, const QModelIndex&) const
bool DownloadListSortProxy::filterAcceptsRow(int sourceRow, const QModelIndex&) const
{
if (m_CurrentFilter.length() == 0) {
return true;
} else if (source_row < m_Manager->numTotalDownloads()) {
return sourceModel()->index(source_row, 0).data().toString().contains(m_CurrentFilter, Qt::CaseInsensitive);
} else if (sourceRow < m_Manager->numTotalDownloads()) {
int downloadIndex = sourceModel()->index(sourceRow, 0).data().toInt();
QString displayedName = Settings::instance().metaDownloads()
? m_Manager->getDisplayName(downloadIndex)
: m_Manager->getFileName(downloadIndex);
return displayedName.contains(m_CurrentFilter, Qt::CaseInsensitive);
} else {
return false;
}
+1 -1
View File
@@ -41,7 +41,7 @@ public slots:
protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
bool filterAcceptsRow(int sourceRow, const QModelIndex &source_parent) const;
signals:
+8 -11
View File
@@ -53,7 +53,8 @@ DownloadListWidgetCompactDelegate::DownloadListWidgetCompactDelegate(DownloadMan
m_DoneLabel->setVisible(false);
connect(manager, SIGNAL(stateChanged(int,DownloadManager::DownloadState)), this, SLOT(stateChanged(int,DownloadManager::DownloadState)));
connect(manager, SIGNAL(stateChanged(int,DownloadManager::DownloadState)),
this, SLOT(stateChanged(int,DownloadManager::DownloadState)));
connect(manager, SIGNAL(downloadRemoved(int)), this, SLOT(resetCache(int)));
}
@@ -116,24 +117,20 @@ void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex)
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
m_DoneLabel->setVisible(true);
m_Progress->setVisible(false);
m_DoneLabel->setText(tr("Paused"));
m_DoneLabel->setForegroundRole(QPalette::Link);
m_DoneLabel->setText(QString("%1<img src=\":/MO/gui/inactive\">").arg(tr("Paused")));
} else if (state == DownloadManager::STATE_FETCHINGMODINFO) {
m_DoneLabel->setText(tr("Fetching Info 1"));
m_DoneLabel->setText(QString("%1").arg(tr("Fetching Info 1")));
} else if (state == DownloadManager::STATE_FETCHINGFILEINFO) {
m_DoneLabel->setText(tr("Fetching Info 2"));
m_DoneLabel->setText(QString("%1").arg(tr("Fetching Info 2")));
} else if (state >= DownloadManager::STATE_READY) {
m_DoneLabel->setVisible(true);
m_Progress->setVisible(false);
if (state == DownloadManager::STATE_INSTALLED) {
m_DoneLabel->setText(tr("Installed"));
m_DoneLabel->setForegroundRole(QPalette::Mid);
m_DoneLabel->setText(QString("%1<img src=\":/MO/gui/check\">").arg(tr("Installed")));
} else if (state == DownloadManager::STATE_UNINSTALLED) {
m_DoneLabel->setText(tr("Uninstalled"));
m_DoneLabel->setForegroundRole(QPalette::Dark);
m_DoneLabel->setText(QString("%1<img src=\":/MO/gui/awaiting\">").arg(tr("Uninstalled")));
} else {
m_DoneLabel->setText(tr("Done"));
m_DoneLabel->setForegroundRole(QPalette::WindowText);
m_DoneLabel->setText(QString("%1<img src=\":/MO/gui/active\">").arg(tr("Done")));
}
if (m_Manager->isInfoIncomplete(downloadIndex)) {
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\"/> " + m_NameLabel->text());
+7 -2
View File
@@ -1354,7 +1354,9 @@ void DownloadManager::downloadFinished()
if (info->m_State == STATE_CANCELING) {
setState(info, STATE_CANCELED);
} else if (info->m_State == STATE_PAUSING) {
info->m_Output.write(info->m_Reply->readAll());
if (info->m_Output.isOpen()) {
info->m_Output.write(info->m_Reply->readAll());
}
if (error) {
setState(info, STATE_ERROR);
@@ -1426,7 +1428,10 @@ void DownloadManager::downloadFinished()
void DownloadManager::downloadError(QNetworkReply::NetworkError error)
{
if (error != QNetworkReply::OperationCanceledError) {
qWarning("Download error occured: %d", error);
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
qWarning("%s (%d)", reply != nullptr ? qPrintable(reply->errorString())
: "Download error occured",
error);
}
}
+1 -1
View File
@@ -129,7 +129,7 @@ char LogBuffer::msgTypeID(QtMsgType type)
void LogBuffer::log(QtMsgType type, const QMessageLogContext &context, const QString &message)
{
// QMutexLocker doesn't support timeout...
if (!s_Mutex.tryLock(50)) {
if (!s_Mutex.tryLock(100)) {
fprintf(stderr, "failed to log: %s", qPrintable(message));
return;
}
+4 -3
View File
@@ -516,7 +516,8 @@ int main(int argc, char *argv[])
// if we have a command line parameter, it is either a nxm link or
// a binary to start
if ((arguments.size() > 1) && (!isNxmLink(arguments.at(1)))) {
if ((arguments.size() > 1)
&& !isNxmLink(arguments.at(1))) {
QString exeName = arguments.at(1);
qDebug("starting %s from command line", qPrintable(exeName));
arguments.removeFirst(); // remove application name (ModOrganizer.exe)
@@ -553,8 +554,8 @@ int main(int argc, char *argv[])
qDebug("displaying main window");
mainWindow.show();
if ((arguments.size() > 1) &&
(isNxmLink(arguments.at(1)))) {
if ((arguments.size() > 1)
&& isNxmLink(arguments.at(1))) {
qDebug("starting download from command line: %s", qPrintable(arguments.at(1)));
organizer.externalMessage(arguments.at(1));
}
+43 -32
View File
@@ -1301,6 +1301,7 @@ static QStringList toStringList(InputIterator current, InputIterator end)
}
return result;
}
void MainWindow::updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives)
{
m_DefaultArchives = defaultArchives;
@@ -1311,33 +1312,31 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString
ui->bsaList->header()->setResizeMode(QHeaderView::ResizeToContents);
#endif
std::vector<std::pair<UINT32, QTreeWidgetItem*> > items;
std::vector<std::pair<UINT32, QTreeWidgetItem*>> items;
std::vector<FileEntry::Ptr> files = m_OrganizerCore.directoryStructure()->getFiles();
for (auto iter = files.begin(); iter != files.end(); ++iter) {
FileEntry::Ptr current = *iter;
for (FileEntry::Ptr current : m_OrganizerCore.directoryStructure()->getFiles()) {
QFileInfo fileInfo(ToQString(current->getName().c_str()));
QString filename = ToQString(current->getName().c_str());
QString extension = filename.right(3).toLower();
if (extension == "bsa") {
int index = activeArchives.indexOf(filename);
if (fileInfo.suffix().toLower() == "bsa") {
int index = activeArchives.indexOf(fileInfo.fileName());
if (index == -1) {
index = 0xFFFF;
}
QString basename = filename.left(filename.indexOf("."));
QStringList strings(filename);
bool isArchive = false;
int origin = current->getOrigin(isArchive);
strings.append(ToQString(m_OrganizerCore.directoryStructure()->getOriginByID(origin).getName()));
QTreeWidgetItem *newItem = new QTreeWidgetItem(strings);
QString basename = fileInfo.baseName();
int originId = current->getOrigin();
FilesOrigin &origin = m_OrganizerCore.directoryStructure()->getOriginByID(originId);
QTreeWidgetItem *newItem = new QTreeWidgetItem(QStringList()
<< fileInfo.fileName()
<< ToQString(origin.getName()));
newItem->setData(0, Qt::UserRole, index);
newItem->setData(1, Qt::UserRole, origin);
newItem->setData(1, Qt::UserRole, originId);
newItem->setFlags(newItem->flags() & ~Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable);
newItem->setCheckState(0, (index != -1) ? Qt::Checked : Qt::Unchecked);
newItem->setData(0, Qt::UserRole, false);
if (m_OrganizerCore.settings().forceEnableCoreFiles()
&& defaultArchives.contains(filename)) {
&& defaultArchives.contains(fileInfo.fileName())) {
newItem->setCheckState(0, Qt::Checked);
newItem->setDisabled(true);
newItem->setData(0, Qt::UserRole, true);
@@ -1356,7 +1355,7 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString
if (index < 0) index = 0;
UINT32 sortValue = ((m_OrganizerCore.directoryStructure()->getOriginByID(origin).getPriority() & 0xFFFF) << 16) | (index & 0xFFFF);
UINT32 sortValue = ((origin.getPriority() & 0xFFFF) << 16) | (index & 0xFFFF);
items.push_back(std::make_pair(sortValue, newItem));
}
}
@@ -2061,7 +2060,7 @@ void MainWindow::refreshFilters()
ui->modList->setCurrentIndex(QModelIndex());
QStringList selectedItems;
foreach (QTreeWidgetItem *item, ui->categoriesList->selectedItems()) {
for (QTreeWidgetItem *item : ui->categoriesList->selectedItems()) {
selectedItems.append(item->text(0));
}
@@ -2091,7 +2090,7 @@ void MainWindow::refreshFilters()
addCategoryFilters(nullptr, categoriesUsed, 0);
foreach (const QString &item, selectedItems) {
for (const QString &item : selectedItems) {
QList<QTreeWidgetItem*> matches = ui->categoriesList->findItems(item, Qt::MatchFixedString | Qt::MatchRecursive);
if (matches.size() > 0) {
matches.at(0)->setSelected(true);
@@ -2246,8 +2245,9 @@ void MainWindow::resumeDownload(int downloadIndex)
} else {
QString username, password;
if (m_OrganizerCore.settings().getNexusLogin(username, password)) {
//m_PostLoginTasks.push_back(boost::bind(&MainWindow::resumeDownload, _1, downloadIndex));
m_OrganizerCore.doAfterLogin([this, downloadIndex] () { this->resumeDownload(downloadIndex); });
m_OrganizerCore.doAfterLogin([this, downloadIndex] () {
this->resumeDownload(downloadIndex);
});
NexusInterface::instance()->getAccessManager()->login(username, password);
} else {
MessageDialog::showMessage(tr("You need to be logged in with Nexus to resume a download"), this);
@@ -2618,7 +2618,7 @@ void MainWindow::addRemoveCategoriesFromMenu(QMenu *menu, int modRow, int refere
{
if (referenceRow != -1 && referenceRow != modRow) {
ModInfo::Ptr editedModInfo = ModInfo::getByIndex(referenceRow);
foreach (QAction* action, menu->actions()) {
for (QAction* action : menu->actions()) {
if (action->menu() != nullptr) {
addRemoveCategoriesFromMenu(action->menu(), modRow, referenceRow);
} else {
@@ -2648,25 +2648,29 @@ void MainWindow::addRemoveCategories_MenuHandler() {
return;
}
QModelIndexList selectedTemp = ui->modList->selectionModel()->selectedRows();
QList<QPersistentModelIndex> selected;
foreach (const QModelIndex &idx, selectedTemp) {
for (const QModelIndex &idx : ui->modList->selectionModel()->selectedRows()) {
selected.append(QPersistentModelIndex(idx));
}
if (selected.size() > 0) {
foreach (const QPersistentModelIndex &idx, selected) {
qDebug("change categories on: %s (ref: %s)", qPrintable(idx.data().toString()), qPrintable(m_ContextIdx.data().toString()));
int minRow = INT_MAX;
int maxRow = -1;
for (const QPersistentModelIndex &idx : selected) {
qDebug("change categories on: %s", qPrintable(idx.data().toString()));
QModelIndex modIdx = mapToModel(m_OrganizerCore.modList(), idx);
if (modIdx.row() != m_ContextIdx.row()) {
addRemoveCategoriesFromMenu(menu, modIdx.row(), m_ContextIdx.row());
}
if (idx.row() < minRow) minRow = idx.row();
if (idx.row() > maxRow) maxRow = idx.row();
}
replaceCategoriesFromMenu(menu, m_ContextIdx.row());
m_OrganizerCore.modList()->notifyChange(-1);
m_OrganizerCore.modList()->notifyChange(minRow, maxRow + 1);
foreach (const QPersistentModelIndex &idx, selected) {
for (const QPersistentModelIndex &idx : selected) {
ui->modList->selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
} else {
@@ -2685,21 +2689,28 @@ void MainWindow::replaceCategories_MenuHandler() {
return;
}
QModelIndexList selected = ui->modList->selectionModel()->selectedRows();
QList<QPersistentModelIndex> selected;
for (const QModelIndex &idx : ui->modList->selectionModel()->selectedRows()) {
selected.append(QPersistentModelIndex(idx));
}
if (selected.size() > 0) {
QStringList selectedMods;
int minRow = INT_MAX;
int maxRow = -1;
for (int i = 0; i < selected.size(); ++i) {
QModelIndex temp = mapToModel(m_OrganizerCore.modList(), selected.at(i));
selectedMods.append(temp.data().toString());
replaceCategoriesFromMenu(menu, mapToModel(m_OrganizerCore.modList(), selected.at(i)).row());
if (temp.row() < minRow) minRow = temp.row();
if (temp.row() > maxRow) maxRow = temp.row();
}
m_OrganizerCore.modList()->notifyChange(-1);
m_OrganizerCore.modList()->notifyChange(minRow, maxRow + 1);
// find mods by their name because indices are invalidated
QAbstractItemModel *model = ui->modList->model();
Q_FOREACH(const QString &mod, selectedMods) {
for (const QString &mod : selectedMods) {
QModelIndexList matches = model->match(model->index(0, 0), Qt::DisplayRole, mod, 1,
Qt::MatchFixedString | Qt::MatchCaseSensitive | Qt::MatchRecursive);
if (matches.size() > 0) {
+1
View File
@@ -102,6 +102,7 @@ bool MOApplication::setStyleFile(const QString &styleName)
updateStyle(styleName);
}
} else {
setStyle(new ProxyStyle(QStyleFactory::create(m_DefaultStyle)));
setStyleSheet("");
}
return true;
+1
View File
@@ -83,6 +83,7 @@ void ModList::setProfile(Profile *profile)
{
m_Profile = profile;
}
int ModList::rowCount(const QModelIndex &parent) const
{
if (!parent.isValid()) {
+1 -1
View File
@@ -169,7 +169,7 @@ void NXMAccessManager::loginTimeout()
emit loginFailed(tr("timeout"));
m_LoginReply->deleteLater();
m_LoginReply = nullptr;
m_LoginAttempted = false; // this usually means we might have usccess later
m_LoginAttempted = false; // this usually means we might have success later
m_LoginTimeout.stop();
m_Username.clear();
m_Password.clear();
+10 -8
View File
@@ -528,7 +528,6 @@ void OrganizerCore::setCurrentProfile(const QString &profileName)
m_ModList.setProfile(newProfile);
connect(m_CurrentProfile, SIGNAL(modStatusChanged(uint)), this, SLOT(modStatusChanged(uint)));
refreshDirectoryStructure();
}
@@ -928,7 +927,7 @@ HANDLE OrganizerCore::spawnBinaryDirect(const QFileInfo &binary, const QString &
prepareStart();
if (!binary.exists()) {
reportError(tr("Executable \"%1\" not found").arg(binary.fileName()));
reportError(tr("Executable \"%1\" not found").arg(binary.absoluteFilePath()));
return INVALID_HANDLE_VALUE;
}
@@ -1223,7 +1222,9 @@ void OrganizerCore::updateModInDirectoryStructure(unsigned int index, ModInfo::P
if (m_UserInterface != nullptr) {
m_UserInterface->archivesWriter().write();
}
m_DirectoryRefresher.setMods(m_CurrentProfile->getActiveMods(), enabledArchives());
std::vector<QString> archives = enabledArchives();
m_DirectoryRefresher.setMods(m_CurrentProfile->getActiveMods(),
std::set<QString>(archives.begin(), archives.end()));
// finally also add files from bsas to the directory structure
m_DirectoryRefresher.addModBSAToStructure(m_DirectoryStructure
@@ -1290,13 +1291,13 @@ IPluginGame *OrganizerCore::managedGame() const
return m_GamePlugin;
}
std::set<QString> OrganizerCore::enabledArchives()
std::vector<QString> OrganizerCore::enabledArchives()
{
std::set<QString> result;
std::vector<QString> result;
QFile archiveFile(m_CurrentProfile->getArchivesFileName());
if (archiveFile.open(QIODevice::ReadOnly)) {
while (!archiveFile.atEnd()) {
result.insert(QString::fromUtf8(archiveFile.readLine()).trimmed());
result.push_back(QString::fromUtf8(archiveFile.readLine()).trimmed());
}
archiveFile.close();
}
@@ -1310,8 +1311,9 @@ void OrganizerCore::refreshDirectoryStructure()
m_DirectoryUpdate = true;
std::vector<std::tuple<QString, QString, int> > activeModList = m_CurrentProfile->getActiveMods();
m_DirectoryRefresher.setMods(activeModList, enabledArchives());
auto archives = enabledArchives();
m_DirectoryRefresher.setMods(activeModList,
std::set<QString>(archives.begin(), archives.end()));
QTimer::singleShot(0, &m_DirectoryRefresher, SLOT(refresh()));
}
+1 -1
View File
@@ -92,7 +92,7 @@ public:
Profile *currentProfile() { return m_CurrentProfile; }
void setCurrentProfile(const QString &profileName);
std::set<QString> enabledArchives();
std::vector<QString> enabledArchives();
MOBase::VersionInfo getVersion() const { return m_Updater.getVersion(); }
-1
View File
@@ -576,7 +576,6 @@ void PluginList::lockESPIndex(int index, bool lock)
m_LockedOrder.erase(iter);
}
}
qDebug(__FUNCTION__);
emit writePluginsList();
}
+5 -1
View File
@@ -272,7 +272,7 @@ void Profile::refreshModStatus()
ModInfo::Ptr info = ModInfo::getByIndex(modIndex);
if ((modIndex < m_ModStatus.size())
&& (info->getFixedPriority() == INT_MIN)) {
m_ModStatus[modIndex].m_Enabled = enabled || info->alwaysEnabled();
m_ModStatus[modIndex].m_Enabled = enabled;
if (m_ModStatus[modIndex].m_Priority == -1) {
if (static_cast<size_t>(index) >= m_ModStatus.size()) {
throw MyException(tr("invalid index %1").arg(index));
@@ -302,6 +302,10 @@ void Profile::refreshModStatus()
// give priorities to mods not referenced in the profile
for (size_t i = 0; i < m_ModStatus.size(); ++i) {
ModInfo::Ptr modInfo = ModInfo::getByIndex(i);
if (modInfo->alwaysEnabled()) {
m_ModStatus[i].m_Enabled = true;
}
if (modInfo->getFixedPriority() == INT_MAX) {
continue;
}
+4 -1
View File
@@ -25,7 +25,7 @@
<file alias="refresh">resources/view-refresh_16.png</file>
<file alias="update_available">resources/software-update-available.png</file>
<file alias="important">resources/emblem-important.png</file>
<file>resources/check.png</file>
<file alias="check">resources/check.png</file>
<file>mo_icon.ico</file>
<file alias="warning">resources/dialog-warning.png</file>
<file alias="emblem_backup">resources/symbol-backup.png</file>
@@ -65,6 +65,9 @@
<file alias="badge_8">resources/badge_8.png</file>
<file alias="badge_9">resources/badge_9.png</file>
<file alias="badge_more">resources/badge_more.png</file>
<file alias="active">resources/status_active.png</file>
<file alias="awaiting">resources/status_awaiting.png</file>
<file alias="inactive">resources/status_inactive.png</file>
</qresource>
<qresource prefix="/MO/gui/content">
<file alias="plugin">resources/contents/jigsaw-piece.png</file>
Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

+3 -1
View File
@@ -25,11 +25,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
SaveGameInfoWidget::SaveGameInfoWidget(QWidget *parent)
: QWidget(parent), ui(new Ui::SaveGameInfoWidget)
: QWidget(parent)
, ui(new Ui::SaveGameInfoWidget)
{
ui->setupUi(this);
this->setWindowFlags(Qt::ToolTip | Qt::BypassGraphicsProxyWidget);
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / qreal(255.0));
ui->gameFrame->setStyleSheet("background-color: transparent;");
// installEventFilter(this);
}

Some files were not shown because too many files have changed in this diff Show More