diff options
| author | Tannin <devnull@localhost> | 2014-04-16 22:32:59 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-04-16 22:32:59 +0200 |
| commit | 540747177ae02c9431d33a2c3adc1f747b74b868 (patch) | |
| tree | 2c6964ea98dd369ab079d10b46cb008729cccdcd /src | |
| parent | 739c3424e7c058f972a2648f2231e6a10c59662d (diff) | |
- loot client no longer stalls the process while waiting for masterlist update
- configurator now gives better warning messages when encountering an invalid ini file
- bugfix: crash on cleanup up browser dialog
- bugfix: GetCurrentDirectory returned wrong string length
Diffstat (limited to 'src')
| -rw-r--r-- | src/browserdialog.cpp | 26 | ||||
| -rw-r--r-- | src/browserdialog.h | 3 | ||||
| -rw-r--r-- | src/main.cpp | 7 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 9 |
4 files changed, 25 insertions, 20 deletions
diff --git a/src/browserdialog.cpp b/src/browserdialog.cpp index d0760fcf..a832f1a3 100644 --- a/src/browserdialog.cpp +++ b/src/browserdialog.cpp @@ -41,11 +41,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. BrowserDialog::BrowserDialog(QWidget *parent) - : QDialog(parent), ui(new Ui::BrowserDialog) + : QDialog(parent) + , ui(new Ui::BrowserDialog) + , m_AccessManager(new QNetworkAccessManager) { ui->setupUi(this); - m_AccessManager.setCookieJar(new PersistentCookieJar( + m_AccessManager->setCookieJar(new PersistentCookieJar( QDir::fromNativeSeparators(MOBase::ToQString(MOShared::GameInfo::instance().getCacheDir())) + "/cookies.dat", this)); Qt::WindowFlags flags = windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint; @@ -55,17 +57,12 @@ BrowserDialog::BrowserDialog(QWidget *parent) m_Tabs = this->findChild<QTabWidget*>("browserTabWidget"); - m_View = new BrowserView(this); - - initTab(m_View); - connect(m_Tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int))); } BrowserDialog::~BrowserDialog() { - delete ui; } @@ -77,7 +74,7 @@ void BrowserDialog::closeEvent(QCloseEvent *event) void BrowserDialog::initTab(BrowserView *newView) { - newView->page()->setNetworkAccessManager(&m_AccessManager); + newView->page()->setNetworkAccessManager(m_AccessManager); newView->page()->setForwardUnsupportedContent(true); connect(newView, SIGNAL(loadProgress(int)), this, SLOT(progress(int))); @@ -87,22 +84,19 @@ void BrowserDialog::initTab(BrowserView *newView) connect(newView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl))); connect(newView, SIGNAL(openUrlInNewTab(QUrl)), this, SLOT(openInNewTab(QUrl))); connect(newView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); - connect(newView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*))); ui->backBtn->setEnabled(false); ui->fwdBtn->setEnabled(false); m_Tabs->addTab(newView, tr("new")); - - m_View->settings()->setAttribute(QWebSettings::PluginsEnabled, true); - m_View->settings()->setAttribute(QWebSettings::AutoLoadImages, true); + newView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + newView->settings()->setAttribute(QWebSettings::AutoLoadImages, true); } void BrowserDialog::openInNewTab(const QUrl &url) { BrowserView *newView = new BrowserView(this); - initTab(newView); newView->setUrl(url); } @@ -129,16 +123,16 @@ void BrowserDialog::openUrl(const QUrl &url) if (isHidden()) { show(); } - m_View->load(url); + openInNewTab(url); } void BrowserDialog::maximizeWidth() { - int viewportWidth = m_View->page()->viewportSize().width(); + int viewportWidth = getCurrentView()->page()->viewportSize().width(); int frameWidth = width() - viewportWidth; - int contentWidth = m_View->page()->mainFrame()->contentsSize().width(); + int contentWidth = getCurrentView()->page()->mainFrame()->contentsSize().width(); QDesktopWidget screen; int currentScreen = screen.screenNumber(this); diff --git a/src/browserdialog.h b/src/browserdialog.h index ffa7e1dd..060d596c 100644 --- a/src/browserdialog.h +++ b/src/browserdialog.h @@ -115,10 +115,9 @@ private: Ui::BrowserDialog *ui; - QNetworkAccessManager m_AccessManager; + QNetworkAccessManager *m_AccessManager; QTabWidget *m_Tabs; - BrowserView *m_View; }; diff --git a/src/main.cpp b/src/main.cpp index d1c5e263..3b89e721 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -536,7 +536,12 @@ int main(int argc, char *argv[]) arguments.removeFirst(); // remove application name (ModOrganizer.exe) arguments.removeFirst(); // remove binary name // pass the remaining parameters to the binary - mainWindow.startApplication(exeName, arguments, QString(), selectedProfileName); + try { + mainWindow.startApplication(exeName, arguments, QString(), selectedProfileName); + } catch (const std::exception &e) { + reportError(QObject::tr("failed to start application: %1").arg(e.what())); + } + return 0; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 362a7c4c..d947bab2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2355,7 +2355,14 @@ HANDLE MainWindow::startApplication(const QString &executable, const QStringList QFileInfo binary; QString arguments = args.join(" "); QString currentDirectory = cwd; - QString profileName = (profile.length() > 0) ? profile : m_CurrentProfile->getName(); + QString profileName = profile; + if (profile.length() == 0) { + if (m_CurrentProfile != NULL) { + profileName = m_CurrentProfile->getName(); + } else { + throw MyException(tr("No profile set")); + } + } QString steamAppID; if (executable.contains('\\') || executable.contains('/')) { // file path |
