diff options
| author | Tannin <devnull@localhost> | 2013-03-01 13:03:30 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-03-01 13:03:30 +0100 |
| commit | b2f3d8e47c2580db5d0b68e61bc37556b9df63a3 (patch) | |
| tree | 5e0b72a44f24b9bba3084fc3e2a0c0765a76a648 | |
| parent | 8b4e11060b37ad70754aa665ad59744eadd2dd1e (diff) | |
- rewrote the mechanism removing the Archive List limit
- openfile is now rerouted
- .jar files can now be added as executables directly
- bugfix: no message was displayed when checking for updates with no valid credentials configured
- added a readme with compilation instructions
| -rw-r--r-- | README.txt | 68 | ||||
| -rw-r--r-- | src/editexecutablesdialog.cpp | 40 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 16 | ||||
| -rw-r--r-- | src/nexusdialog.cpp | 5 |
4 files changed, 119 insertions, 10 deletions
diff --git a/README.txt b/README.txt new file mode 100644 index 00000000..119cf55f --- /dev/null +++ b/README.txt @@ -0,0 +1,68 @@ +HOW TO BUILD
+============
+
+Requirements:
+-------------
+
+Visual C++ compiler 2010 (VC 10.0) or up
+- Included in visual c++ express 2010 or windows sdk 7.0
+
+QtSDK 4.8.x (http://qt-project.org/downloads)
+- Qt5 is not yet supported but WIP
+- Install according to instruction
+
+boost libraries (http://www.boost.org/)
+- Compile according to their instructions (using vc++)
+- As of time of writing boost_thread is the only compiled boost library used, you can
+ disable the others to safe yourself the compile time
+
+zlib (http://www.zlib.net/)
+- Compile static library according to their instructions
+- You should have a "zlibstatic.lib" under "build" afterwards
+
+7z.dll (http://www.7-zip.org/download.html)
+- Part of the 7-zip program
+- Has to be the 32-bit dll! (approx. 893kb)
+
+Recommended:
+------------
+
+Qt Creator
+- Included in QtSDK but there might be a newer version as a separate download
+
+Set up (using Qt Creator):
+--------------------------
+
+1. Using Qt Creator open source/ModOrganizer.pro from your working copy
+2. Open the "Projects" tab, open the "Details" for "Build Environment"
+3. Click "Add" to add a variable called "BOOSTPATH" with the path of your boost installation as the value (i.e. C:\code\boost_1_52_0)
+4. Click "Add" to add a variable called "ZLIBPATH" with the path of your zlib installation as the value (i.e. C:\code\zlib-1.2.7)
+5. Switch the build configuration at the very top of the same page from "debug" to "release" (or vice versa) and repeat steps 3 and 4
+6. Compile the configuration(s) you want to use (debug and/or release) (Build All). This should compile correctly.
+7. return to the "projects" tab and switch to "Run Settings"
+For Release build:
+8r. Add a "Run configuration" that points to <your working copy>\output\ModOrganizer.exe
+9r. Copy "7z.dll" to <your working copy>\output\dlls
+10r. From QtSDK\Desktop\Qt\4.8.0\msvc2010\bin copy the following files to <your working copy>\output\dlls: QtCore4.dll, QtDeclarative4.dll, QtGui4.dll, QtNetwork4.dll, QtScript4.dll, QtSql4.dll, QtWebkit4.dll, QtXml4.dll, QtXmlPatterns4.dll
+For Debug build:
+8d. Add a "Run configuration" that points to <your working copy>\outputd\ModOrganizer.exe
+9d. Copy "7z.dll" to <your working copy>\outputd\dlls
+10d. From QtSDK\Desktop\Qt\4.8.0\msvc2010\bin copy the following files to <your working copy>\outputd\dlls: QtCored4.dll, QtDeclaratived4.dll, QtGuid4.dll, QtNetworkd4.dll, QtScriptd4.dll, QtSqld4.dll, QtWebkitd4.dll, QtXmld4.dll, QtXmlPatternsd4.dll
+
+Now you should be able to compile and run Mod Organizer.
+Please note that when you change anything apart from the "organizer" subproject, qt creator may not pick up on the changes
+and not recompile the modified subproject. the "organizer" project on the other hand is always re-linked. If anyone knowledgeable enough with qmake
+can fix that that would be awesome.
+
+Set up (without Qt Creator):
+----------------------------
+
+1. open a command line shell and navigate to <your working copy>\source
+2. run "qmake -tp vc" to create a visual c++ solution
+3. Open that solution
+4. - 98. A miracle happens
+99. You can now compile MO using VC
+
+I'm not using this workflow so I can't give more detailed instructions.
+Please note that the primary project format of MO remains qmake, if you work with visual studio and make changes to the project (like adding
+source files) you have to manually transfer those changes to the .pro file.
\ No newline at end of file diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp index 42f29d83..e0d1994d 100644 --- a/src/editexecutablesdialog.cpp +++ b/src/editexecutablesdialog.cpp @@ -21,6 +21,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "ui_editexecutablesdialog.h" #include "filedialogmemory.h" #include <QMessageBox> +#include <Shellapi.h> +#include <utility.h> using namespace MOBase; @@ -87,6 +89,7 @@ void EditExecutablesDialog::resetInput() { ui->binaryEdit->setText(""); ui->titleEdit->setText(""); + ui->workingDirEdit->clear(); ui->argumentsEdit->setText(""); ui->closeCheckBox->setChecked(false); } @@ -113,11 +116,42 @@ void EditExecutablesDialog::on_addButton_clicked() void EditExecutablesDialog::on_browseButton_clicked() { QString binaryName = FileDialogMemory::getOpenFileName("editExecutableBinary", this, - tr("Select a binary"), QString(), tr("Executable (%1)").arg("*.exe *.bat")); + tr("Select a binary"), QString(), tr("Executable (%1)").arg("*.exe *.bat *.jar")); - QLineEdit *binaryEdit = findChild<QLineEdit*>("binaryEdit"); + if (binaryName.endsWith(".jar", Qt::CaseInsensitive)) { + QString binaryPath; + { // try to find java automatically + std::wstring binaryNameW = ToWString(binaryName); + WCHAR buffer[MAX_PATH]; + if (::FindExecutableW(binaryNameW.c_str(), NULL, buffer) > (HINSTANCE)32) { + DWORD binaryType = 0UL; + if (!::GetBinaryTypeW(binaryNameW.c_str(), &binaryType)) { + qDebug("failed to determine binary type: %lu", ::GetLastError()); + } else if (binaryType == SCS_32BIT_BINARY) { + binaryPath = ToQString(buffer); + } + } + } + if (binaryPath.isEmpty()) { + QSettings javaReg("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment", QSettings::NativeFormat); + if (javaReg.contains("CurrentVersion")) { + QString currentVersion = javaReg.value("CurrentVersion").toString(); + binaryPath = javaReg.value(QString("%1/JavaHome").arg(currentVersion)).toString().append("\\bin\\javaw.exe"); + } + } + if (binaryPath.isEmpty()) { + QMessageBox::information(this, tr("Java (32-bit) required"), + tr("MO requires 32-bit java to run this application. If you already have it installed, select javaw.exe " + "from that installation as the binary.")); + } else { + ui->binaryEdit->setText(binaryPath); + } - binaryEdit->setText(QDir::toNativeSeparators(binaryName)); + ui->workingDirEdit->setText(QDir::toNativeSeparators(QFileInfo(binaryName).absolutePath())); + ui->argumentsEdit->setText("-jar \"" + QDir::toNativeSeparators(binaryName) + "\""); + } else { + ui->binaryEdit->setText(QDir::toNativeSeparators(binaryName)); + } } void EditExecutablesDialog::on_browseDirButton_clicked() diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ac368719..4e3fa296 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -441,10 +441,12 @@ void MainWindow::createHelpWidget() typedef std::vector<std::pair<int, QAction*> > ActionList; ActionList tutorials; - QDirIterator dirIter("tutorials", QStringList("*.js"), QDir::Files); + + QDirIterator dirIter(QApplication::applicationDirPath() + "/tutorials", QStringList("*.js"), QDir::Files); while (dirIter.hasNext()) { dirIter.next(); QString fileName = dirIter.fileName(); + QFile file(dirIter.filePath()); if (!file.open(QIODevice::ReadOnly)) { qCritical() << "Failed to open " << fileName; @@ -547,7 +549,7 @@ bool MainWindow::addProfile() void MainWindow::hookUpWindowTutorials() { - QDirIterator dirIter("tutorials", QStringList("*.js"), QDir::Files); + QDirIterator dirIter(QApplication::applicationDirPath() + "/tutorials", QStringList("*.js"), QDir::Files); while (dirIter.hasNext()) { dirIter.next(); QString fileName = dirIter.fileName(); @@ -2666,9 +2668,9 @@ void MainWindow::savePrimaryCategory() void MainWindow::checkModsForUpdates() { + statusBar()->show(); if (NexusInterface::instance()->getAccessManager()->loggedIn()) { m_ModsToUpdate = ModInfo::checkAllForUpdate(this); - statusBar()->show(); m_RefreshProgress->setRange(0, m_ModsToUpdate); } else { QString username, password; @@ -3298,7 +3300,7 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, { // try to find java automatically WCHAR buffer[MAX_PATH]; - if (FindExecutableW(targetPathW.c_str(), NULL, buffer) > (HINSTANCE)32) { + if (::FindExecutableW(targetPathW.c_str(), NULL, buffer) > (HINSTANCE)32) { DWORD binaryType = 0UL; if (!::GetBinaryTypeW(targetPathW.c_str(), &binaryType)) { qDebug("failed to determine binary type: %lu", ::GetLastError()); @@ -3682,8 +3684,12 @@ void MainWindow::loginFailed(const QString &message) foreach (QString url, m_PendingDownloads) { downloadRequestedNXM(url); } + m_PendingDownloads.clear(); + } else { + MessageDialog::showMessage(tr("login failed: %1").arg(message), this); + m_PostLoginTasks.clear(); + statusBar()->hide(); } - m_PendingDownloads.clear(); } diff --git a/src/nexusdialog.cpp b/src/nexusdialog.cpp index 91c0caf8..6d8e850b 100644 --- a/src/nexusdialog.cpp +++ b/src/nexusdialog.cpp @@ -142,8 +142,8 @@ void NexusDialog::login(const QString &username, const QString &password) { m_AccessManager->login(username, password); - connect(m_AccessManager, SIGNAL(loginSuccessful(bool)), this, SLOT(loginFinished(bool))); - connect(m_AccessManager, SIGNAL(loginFailed(QString)), this, SLOT(loginFailed(QString))); + connect(m_AccessManager, SIGNAL(loginSuccessful(bool)), this, SLOT(loginFinished(bool)), Qt::UniqueConnection); + connect(m_AccessManager, SIGNAL(loginFailed(QString)), this, SLOT(loginFailed(QString)), Qt::UniqueConnection); } @@ -160,6 +160,7 @@ void NexusDialog::loginFinished(bool necessary) if (necessary && this->isVisible()) { MessageDialog::showMessage(tr("login successful"), this); } + loadNexus(); emit loginSuccessful(necessary); } |
