Changeset c370b87 in subsurface


Ignore:
Timestamp:
May 27, 2017, 11:07:19 AM (4 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
85e9259
Parents:
09904dd
git-author:
Tomaz Canabrava <tcanabrava@…> (05/19/17 02:29:03)
git-committer:
Dirk Hohndel <dirk@…> (05/27/17 11:07:19)
Message:

Reduce the scope of variables

Those variables should have local scope, not class scope.
We are using it only inside of pickDump/LogFile metohds.

Signed-off-by: Tomaz Canabrava <tcanabrava@…>
Signed-off-by: Dirk Hohndel <dirk@…>

Location:
desktop-widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • desktop-widgets/downloadfromdivecomputer.cpp

    r09904dd rc370b87  
    337337        ui.chooseLogFile->setEnabled(state == Qt::Checked);
    338338        // TODO: Verify the Thread.
    339         if (state == Qt::Checked && logFile.isEmpty()) {
     339        if (state == Qt::Checked) {
    340340                pickLogFile();
    341341        }
     
    347347        QFileInfo fi(filename);
    348348        filename = fi.absolutePath().append(QDir::separator()).append("subsurface.log");
    349         logFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer download logfile"),
     349        QString logFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer download logfile"),
    350350                                               filename, tr("Log files (*.log)"));
    351351        if (!logFile.isEmpty()) {
    352352                free(logfile_name);
    353                 logfile_name = strdup(logFile.toUtf8().data());
     353                logfile_name = copy_string(logFile.toUtf8().data());
    354354        }
    355355}
     
    359359        ui.chooseDumpFile->setEnabled(state == Qt::Checked);
    360360        if (state == Qt::Checked) {
    361                 if (dumpFile.isEmpty())
    362                         pickDumpFile();
     361                pickDumpFile();
    363362                if (!dumpWarningShown) {
    364363                        QMessageBox::warning(this, tr("Warning"),
     
    374373        QFileInfo fi(filename);
    375374        filename = fi.absolutePath().append(QDir::separator()).append("subsurface.bin");
    376         dumpFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer binary dump file"),
     375        QString dumpFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer binary dump file"),
    377376                                                filename, tr("Dump files (*.bin)"));
    378377        if (!dumpFile.isEmpty()) {
    379378                free(dumpfile_name);
    380                 dumpfile_name = strdup(dumpFile.toUtf8().data());
     379                dumpfile_name = copy_string(dumpFile.toUtf8().data());
    381380        }
    382381}
  • desktop-widgets/downloadfromdivecomputer.h

    r09904dd rc370b87  
    6969        QStringListModel *productModel;
    7070        void fill_device_list(int dc_type);
    71         QString logFile;
    72         QString dumpFile;
    7371        QTimer *timer;
    7472        bool dumpWarningShown;
Note: See TracChangeset for help on using the changeset viewer.