Simplify code to open downloaded files

This commit is contained in:
Alex Spataru 2016-06-02 11:17:08 -05:00
parent 8e85aead26
commit 679a04bee6
4 changed files with 6 additions and 12 deletions

View File

@ -112,17 +112,8 @@ void Downloader::startDownload (const QUrl& url) {
//============================================================================== //==============================================================================
void Downloader::openDownload() { void Downloader::openDownload() {
if (!m_filePath.isEmpty()) { if (!m_filePath.isEmpty())
QString url = m_filePath; QDesktopServices::openUrl (QUrl::fromLocalFile (m_filePath));
if (url.startsWith ("/"))
url = "file://" + url;
else
url = "file:///" + url;
hide();
QDesktopServices::openUrl (url);
}
else { else {
QMessageBox::critical (this, QMessageBox::critical (this,

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -27,6 +27,9 @@ Window::Window (QWidget* parent) : QMainWindow (parent) {
m_ui = new Ui::Window; m_ui = new Ui::Window;
m_ui->setupUi (this); m_ui->setupUi (this);
setWindowTitle (qApp->applicationName());
/* QSimpleUpdater is single-instance */
m_updater = QSimpleUpdater::getInstance(); m_updater = QSimpleUpdater::getInstance();
/* Check for updates when the "Check For Updates" button is clicked */ /* Check for updates when the "Check For Updates" button is clicked */

View File

@ -11,7 +11,7 @@
int main (int argc, char** argv) { int main (int argc, char** argv) {
QApplication app (argc, argv); QApplication app (argc, argv);
app.setApplicationVersion ("1.0"); app.setApplicationVersion ("1.0");
app.setApplicationName ("Application"); app.setApplicationName ("Bob's Badass App");
Window window; Window window;
window.show(); window.show();