Merge branch 'bugfixes' of github.com:danilocesar/subsurface

Fixed one conflict in qt-ui/diveplanner.cpp - please check I got this
right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-08-30 20:17:20 -07:00
commit db17edda65
5 changed files with 56 additions and 9 deletions

View file

@ -106,7 +106,7 @@ ifeq ($(strip $(QMAKE)),)
$(error Could not find qmake or qmake-qt4 in $$PATH for the Qt4 version they failed)
endif
QT_MODULES = QtGui QtSvg QtNetwork
QT_MODULES = QtGui QtSvg QtNetwork QtWebKit
QT_CORE = QtCore
MOC = $(shell $(PKGCONFIG) --variable=moc_location QtCore)
UIC = $(shell $(PKGCONFIG) --variable=uic_location QtGui)

View file

@ -65,7 +65,11 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget* parent, Qt::WindowFlags f) :
void DownloadFromDCWidget::runDialog()
{
// Since the DownloadDialog is only
// created once, we need to do put some starting code here
ui->progressBar->hide();
markChildrenAsEnabled();
exec();
}
@ -138,6 +142,10 @@ void DownloadFromDCWidget::on_cancel_clicked()
thread->deleteLater();
thread = 0;
}
// Confusing, but if the user press cancel during a download
// he probably want to cancel the download, not to close the window.
if (!downloading)
close();
}
@ -146,6 +154,7 @@ void DownloadFromDCWidget::on_ok_clicked()
if (downloading)
return;
markChildrenAsDisabled();
ui->progressBar->setValue(0);
ui->progressBar->show();
@ -156,6 +165,7 @@ void DownloadFromDCWidget::on_ok_clicked()
data.devname = strdup(ui->device->text().toUtf8().data());
data.vendor = strdup(ui->vendor->currentText().toUtf8().data());
data.product = strdup(ui->product->currentText().toUtf8().data());
data.descriptor = descriptorLookup[ui->vendor->currentText() + ui->product->currentText()];
data.force_download = ui->forceDownload->isChecked();
data.deviceid = data.diveid = 0;
@ -177,6 +187,36 @@ bool DownloadFromDCWidget::preferDownloaded()
return ui->preferDownloaded->isChecked();
}
void DownloadFromDCWidget::reject()
{
// we don't want the download window being able to close
// while we're still downloading.
if (!downloading)
QDialog::reject();
}
void DownloadFromDCWidget::markChildrenAsDisabled()
{
ui->device->setDisabled(true);
ui->vendor->setDisabled(true);
ui->product->setDisabled(true);
ui->forceDownload->setDisabled(true);
ui->preferDownloaded->setDisabled(true);
ui->ok->setDisabled(true);
ui->search->setDisabled(true);
}
void DownloadFromDCWidget::markChildrenAsEnabled()
{
ui->device->setDisabled(false);
ui->vendor->setDisabled(false);
ui->product->setDisabled(false);
ui->forceDownload->setDisabled(false);
ui->preferDownloaded->setDisabled(false);
ui->ok->setDisabled(false);
ui->search->setDisabled(false);
}
DownloadThread::DownloadThread(device_data_t* data): data(data)
{
}

View file

@ -24,7 +24,7 @@ private:
class InterfaceThread : public QThread{
Q_OBJECT
public:
InterfaceThread(QObject *parent, device_data_t *data) ;
InterfaceThread(QObject *parent, device_data_t *data);
virtual void run();
signals:
@ -39,13 +39,19 @@ class DownloadFromDCWidget : public QDialog{
public:
explicit DownloadFromDCWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
static DownloadFromDCWidget *instance();
void reject();
public slots:
void on_ok_clicked();
void on_cancel_clicked();
void runDialog();
void stoppedDownloading();
void on_vendor_currentIndexChanged(const QString& vendor);
private:
void markChildrenAsDisabled();
void markChildrenAsEnabled();
Ui::DownloadFromDiveComputer *ui;
InterfaceThread *thread;
bool downloading;
@ -58,6 +64,7 @@ private:
QStringListModel *vendorModel;
QStringListModel *productModel;
void fill_computer_list();
public:
bool preferDownloaded();
};

View file

@ -15,7 +15,7 @@
#include <QCloseEvent>
#include <QApplication>
#include <QFontMetrics>
#include <QTextBrowser>
#include <QWebView>
#include <QTableView>
#include "divelistview.h"
#include "starwidget.h"
@ -413,14 +413,14 @@ void MainWindow::on_actionAboutSubsurface_triggered()
void MainWindow::on_actionUserManual_triggered()
{
if(!helpView){
helpView = new QTextBrowser();
helpView = new QWebView();
}
QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath != "") {
QUrl url(searchPath.append("/user-manual.html"));
helpView->setSource(url);
helpView->setUrl(url);
} else {
helpView->setText(tr("Cannot find the Subsurface manual"));
helpView->setHtml(tr("Cannot find the Subsurface manual"));
}
helpView->show();
}

View file

@ -29,7 +29,7 @@ class DiveListView;
class GlobeGPS;
class MainTab;
class ProfileGraphicsView;
class QTextBrowser;
class QWebView;
enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME };
@ -110,7 +110,7 @@ private:
Ui::MainWindow *ui;
QAction *actionNextDive;
QAction *actionPreviousDive;
QTextBrowser *helpView;
QWebView *helpView;
QString filter();
bool askSaveChanges();
void writeSettings();