Compare commits

..
Author SHA1 Message Date
Tannin 7722a9b6df - main window is now actually disabled while integrated boss is running
- bugfix: integrated boss sorting couldn't recognize plugins specified via regular expression
2014-02-02 14:26:24 +01:00
Tannin 48704877ca - bugfix: upon moving files between mods, an attempt was made to access origins
for both, even if one (or both) mods weren't active
- bugfix: plugin-list should now deal with nested "layoutAboutToBeChanged" calls
gracefully. May be the reason of a bug.
2014-02-02 00:09:03 +01:00
Tannin 48c944c737 - bugfix: elevation dialog didn't offer a "yes" option
- bugfix: python plugins crashed the application when trying to create a nexus bridge
- bugfix: python plugins couldn't register for failed requests correctly
2014-01-29 21:06:55 +01:00
Tannin af50eedbe2 - bugfix: dds preview or transparent textures looked odd
- bugfix: lazy loaded data tree deleted the placeholder
2014-01-29 00:23:16 +01:00
Tannin 52e5dd3c57 Added tag release v1.1.0 for changeset 87c2eea95307 2014-01-29 00:20:47 +01:00
Tannin ccd5d1294f - bugfix: accessing profile without loading one when starting an app through the commandline
- bugfix: locked-dialog was disabled
2014-01-27 21:31:10 +01:00
6 changed files with 87 additions and 31 deletions
+34 -17
View File
@@ -1046,9 +1046,9 @@ bool MainWindow::registerPlugin(QObject *plugin, const QString &fileName)
QObject *proxiedPlugin = proxy->instantiate(pluginName);
if (proxiedPlugin != NULL) {
if (registerPlugin(proxiedPlugin, pluginName)) {
qDebug("loaded plugin \"%s\"", QDir::toNativeSeparators(pluginName).toUtf8().constData());
qDebug("loaded plugin \"%s\"", qPrintable(pluginName));
} else {
qWarning("plugin \"%s\" failed to load", pluginName.toUtf8().constData());
qWarning("plugin \"%s\" failed to load", qPrintable(pluginName));
}
}
} catch (const std::exception &e) {
@@ -1121,13 +1121,13 @@ void MainWindow::loadPlugins()
if (pluginLoader.instance() == NULL) {
m_UnloadedPlugins.push_back(pluginName);
qCritical("failed to load plugin %s: %s",
pluginName.toUtf8().constData(), pluginLoader.errorString().toUtf8().constData());
qPrintable(pluginName), qPrintable(pluginLoader.errorString()));
} else {
if (registerPlugin(pluginLoader.instance(), pluginName)) {
qDebug("loaded plugin \"%s\"", QDir::toNativeSeparators(pluginName).toUtf8().constData());
qDebug("loaded plugin \"%s\"", qPrintable(pluginName));
} else {
m_UnloadedPlugins.push_back(pluginName);
qWarning("plugin \"%s\" failed to load", pluginName.toUtf8().constData());
qWarning("plugin \"%s\" failed to load", qPrintable(pluginName));
}
}
}
@@ -1289,7 +1289,7 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg
storeSettings();
if (!binary.exists()) {
reportError(tr("\"%1\" not found").arg(binary.fileName()));
reportError(tr("Executable \"%1\" not found").arg(binary.fileName()));
return INVALID_HANDLE_VALUE;
}
@@ -1317,7 +1317,9 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg
QCoreApplication::processEvents();
}
m_CurrentProfile->writeModlistNow(true);
if (m_CurrentProfile != nullptr) {
m_CurrentProfile->writeModlistNow(true);
}
// TODO: should also pass arguments
if (m_AboutToRun(binary.absoluteFilePath())) {
@@ -1365,6 +1367,8 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments,
close();
} else {
this->setEnabled(false);
// re-enable the locked dialog because what'd be the point otherwise?
dialog->setEnabled(true);
QCoreApplication::processEvents();
@@ -1574,6 +1578,13 @@ void MainWindow::updateTo(QTreeWidgetItem *subTree, const std::wstring &director
subTree->sortChildren(0, Qt::AscendingOrder);
}
void MainWindow::delayedRemove()
{
foreach (QTreeWidgetItem *item, m_RemoveWidget) {
item->removeChild(item->child(0));
}
m_RemoveWidget.clear();
}
void MainWindow::expandDataTreeItem(QTreeWidgetItem *item)
{
@@ -1582,7 +1593,6 @@ void MainWindow::expandDataTreeItem(QTreeWidgetItem *item)
QTreeWidgetItem *onDemandDataItem = item->child(0);
std::wstring path = ToWString(onDemandDataItem->data(0, Qt::UserRole + 1).toString());
bool conflictsOnly = onDemandDataItem->data(0, Qt::UserRole + 2).toBool();
item->removeChild(onDemandDataItem);
std::wstring virtualPath = (path + L"\\").substr(6) + ToWString(item->text(0));
DirectoryEntry *dir = m_DirectoryStructure->findSubDirectoryRecursive(virtualPath);
@@ -1591,7 +1601,8 @@ void MainWindow::expandDataTreeItem(QTreeWidgetItem *item)
} else {
qWarning("failed to update view of %ls", path.c_str());
}
m_RemoveWidget.push_back(item);
QTimer::singleShot(5, this, SLOT(delayedRemove()));
}
}
@@ -2838,17 +2849,21 @@ void MainWindow::fileMoved(const QString &filePath, const QString &oldOriginName
const FileEntry::Ptr filePtr = m_DirectoryStructure->findFile(ToWString(filePath));
if (filePtr.get() != NULL) {
try {
FilesOrigin &oldOrigin = m_DirectoryStructure->getOriginByName(ToWString(oldOriginName));
FilesOrigin &newOrigin = m_DirectoryStructure->getOriginByName(ToWString(newOriginName));
if (m_DirectoryStructure->originExists(ToWString(newOriginName))) {
FilesOrigin &newOrigin = m_DirectoryStructure->getOriginByName(ToWString(newOriginName));
QString fullNewPath = ToQString(newOrigin.getPath()) + "\\" + filePath;
WIN32_FIND_DATAW findData;
::FindFirstFileW(ToWString(fullNewPath).c_str(), &findData);
QString fullNewPath = ToQString(newOrigin.getPath()) + "\\" + filePath;
WIN32_FIND_DATAW findData;
::FindFirstFileW(ToWString(fullNewPath).c_str(), &findData);
filePtr->addOrigin(newOrigin.getID(), findData.ftCreationTime, L"");
filePtr->removeOrigin(oldOrigin.getID());
filePtr->addOrigin(newOrigin.getID(), findData.ftCreationTime, L"");
}
if (m_DirectoryStructure->originExists(ToWString(oldOriginName))) {
FilesOrigin &oldOrigin = m_DirectoryStructure->getOriginByName(ToWString(oldOriginName));
filePtr->removeOrigin(oldOrigin.getID());
}
} catch (const std::exception &e) {
reportError(tr("Failed to move \"%1\" from mod \"%2\" to \"%3\": %4").arg(filePath).arg(oldOriginName).arg(newOriginName).arg(e.what()));
reportError(tr("failed to move \"%1\" from mod \"%2\" to \"%3\": %4").arg(filePath).arg(oldOriginName).arg(newOriginName).arg(e.what()));
}
} else {
// this is probably not an error, the specified path is likely a directory
@@ -5131,6 +5146,8 @@ void MainWindow::on_showHiddenBox_toggled(bool checked)
void MainWindow::on_bossButton_clicked()
{
try {
this->setEnabled(false);
ON_BLOCK_EXIT([&] () { this->setEnabled(true); });
LockedDialog dialog(this, tr("BOSS working"), false);
dialog.show();
qApp->processEvents();
+3
View File
@@ -372,6 +372,8 @@ private:
QFileSystemWatcher m_SavesWatcher;
std::vector<QTreeWidgetItem*> m_RemoveWidget;
private slots:
void showMessage(const QString &message);
@@ -529,6 +531,7 @@ private slots:
void refreshSavesIfOpen();
void expandDataTreeItem(QTreeWidgetItem *item);
void about();
void delayedRemove();
private slots: // ui slots
// actions
+9 -8
View File
@@ -132,7 +132,8 @@ void PluginList::refresh(const QString &profileName, const DirectoryEntry &baseD
const QString &pluginsFile, const QString &loadOrderFile,
const QString &lockedOrderFile)
{
emit layoutAboutToBeChanged();
ChangeBracket<PluginList> layoutChange(this);
m_ESPsByName.clear();
m_ESPsByPriority.clear();
m_ESPs.clear();
@@ -213,7 +214,8 @@ void PluginList::refresh(const QString &profileName, const DirectoryEntry &baseD
readLockedOrderFrom(lockedOrderFile);
emit layoutChanged();
layoutChange.finish();
refreshLoadOrder();
emit dataChanged(this->index(0, 0), this->index(m_ESPs.size(), columnCount()));
@@ -557,7 +559,7 @@ void PluginList::syncLoadOrder()
void PluginList::refreshLoadOrder()
{
emit layoutAboutToBeChanged();
ChangeBracket<PluginList> layoutChange(this);
syncLoadOrder();
// set priorities according to locked load order
std::map<int, QString> lockedLoadOrder;
@@ -593,7 +595,6 @@ void PluginList::refreshLoadOrder()
}
}
}
emit layoutChanged();
}
@@ -748,7 +749,7 @@ void PluginList::bossSort()
qDebug("%d sorted, %d unrecognized", sizeSorted, sizeUnrecognized);
emit layoutAboutToBeChanged();
ChangeBracket<PluginList> layoutChange(this);
int priority = 0;
applyBOSSSorting(sortedPlugins, sizeSorted, priority, true, "esm");
@@ -758,7 +759,7 @@ void PluginList::bossSort()
// inform view of the changed data
updateIndices();
emit layoutChanged();
layoutChange.finish();
syncLoadOrder();
emit dataChanged(this->index(0, 0), this->index(m_ESPs.size(), columnCount()));
@@ -1089,7 +1090,7 @@ void PluginList::setPluginPriority(int row, int &newPriority)
void PluginList::changePluginPriority(std::vector<int> rows, int newPriority)
{
emit layoutAboutToBeChanged();
ChangeBracket<PluginList> layoutChange(this);
// sort rows to insert by their old priority (ascending) and insert them move them in that order
const std::vector<ESPInfo> &esp = m_ESPs;
std::sort(rows.begin(), rows.end(),
@@ -1111,7 +1112,7 @@ void PluginList::changePluginPriority(std::vector<int> rows, int newPriority)
setPluginPriority(*iter, newPriority);
}
emit layoutChanged();
layoutChange.finish();
refreshLoadOrder();
startSaveTime();
+36 -2
View File
@@ -33,13 +33,46 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <BOSS-API.h>
template <class C>
class ChangeBracket {
public:
ChangeBracket(C *model)
: m_Model(nullptr)
{
QVariant var = model->property("__aboutToChange");
bool aboutToChange = var.isValid() && var.toBool();
if (!aboutToChange) {
model->layoutAboutToBeChanged();
model->setProperty("__aboutToChange", true);
m_Model = model;
}
}
~ChangeBracket() {
finish();
}
void finish() {
if (m_Model != nullptr) {
m_Model->layoutChanged();
m_Model->setProperty("__aboutToChange", false);
m_Model = nullptr;
}
}
private:
C *m_Model;
};
/**
* @brief model representing the plugins (.esp/.esm) in the current virtual data folder
**/
class PluginList : public QAbstractTableModel, public MOBase::IPluginList
{
Q_OBJECT
friend class ChangeBracket<PluginList>;
public:
enum EColumn {
@@ -225,7 +258,6 @@ private:
friend bool ByDate(const ESPInfo& LHS, const ESPInfo& RHS);
friend bool ByPriority(const ESPInfo& LHS, const ESPInfo& RHS);
class BossDLL : public PDLL {
DECLARE_CLASS(BossDLL)
@@ -353,4 +385,6 @@ private:
};
#endif // PLUGINLIST_H
+3 -2
View File
@@ -117,9 +117,10 @@ HANDLE startBinary(const QFileInfo &binary, const QString &arguments, const QStr
"can be installed to work without elevation.\n\n"
"Start elevated anyway? "
"(you will be asked if you want to allow ModOrganizer.exe to make changes to the system)").arg(
QDir::toNativeSeparators(binary.absoluteFilePath()))) == QMessageBox::Yes) {
QDir::toNativeSeparators(binary.absoluteFilePath())),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
::ShellExecuteW(NULL, L"runas", ToWString(QCoreApplication::applicationFilePath()).c_str(),
(binaryName + L" " + ToWString(arguments)).c_str(), currentDirectoryName.c_str(), SW_SHOWNORMAL);
(std::wstring(L"\"") + binaryName + L"\" " + ToWString(arguments)).c_str(), currentDirectoryName.c_str(), SW_SHOWNORMAL);
return INVALID_HANDLE_VALUE;
} else {
return INVALID_HANDLE_VALUE;
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Winver.h"
#define VER_FILEVERSION 1,1,0,0
#define VER_FILEVERSION_STR "1,1,0,0\0"
#define VER_FILEVERSION 1,1,1,0
#define VER_FILEVERSION_STR "1,1,1,0\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION