OSDN Git Service

Improve output folder selection update code.
authorlordmulder <mulder2@gmx.de>
Mon, 27 Dec 2010 17:31:21 +0000 (18:31 +0100)
committerlordmulder <mulder2@gmx.de>
Mon, 27 Dec 2010 17:31:21 +0000 (18:31 +0100)
src/Dialog_MainWindow.cpp
src/Dialog_MainWindow.h

index 9af9018..46ba29a 100644 (file)
@@ -155,14 +155,14 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        outputFolderView->header()->hideSection(3);
        outputFolderView->setHeaderHidden(true);
        outputFolderView->setAnimated(true);
-       outputFolderView->installEventFilter(this);
        outputFolderView->setMouseTracking(false);
        outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
        while(saveToSourceFolderCheckBox->isChecked() != m_settings->outputToSourceDir()) saveToSourceFolderCheckBox->click();
        prependRelativePathCheckBox->setChecked(m_settings->prependRelativeSourcePath());
        connect(outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
        connect(outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
-       connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
+       connect(outputFolderView, SIGNAL(pressed(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
+       connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewMoved(QModelIndex)));
        outputFolderView->setCurrentIndex(m_fileSystemModel->index(m_settings->outputDir()));
        outputFolderViewClicked(outputFolderView->currentIndex());
        connect(buttonMakeFolder, SIGNAL(clicked()), this, SLOT(makeFolderButtonClicked()));
@@ -459,10 +459,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
                QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
                QTimer::singleShot(250, this, SLOT(restoreCursor()));
        }
-       else if(obj == outputFolderView && (event->type() == QEvent::KeyRelease || event->type() == QEvent::KeyPress))
-       {
-               outputFolderViewClicked(outputFolderView->currentIndex());
-       }
        return false;
 }
 
@@ -882,7 +878,7 @@ void MainWindow::styleActionActivated(QAction *action)
 }
 
 /*
- * Output folder changed
+ * Output folder changed (mouse clicked)
  */
 void MainWindow::outputFolderViewClicked(const QModelIndex &index)
 {
@@ -897,6 +893,17 @@ void MainWindow::outputFolderViewClicked(const QModelIndex &index)
 }
 
 /*
+ * Output folder changed (mouse moved)
+ */
+void MainWindow::outputFolderViewMoved(const QModelIndex &index)
+{
+       if(QApplication::mouseButtons() & Qt::LeftButton)
+       {
+               outputFolderViewClicked(index);
+       }
+}
+
+/*
  * Goto desktop button
  */
 void MainWindow::gotoDesktopButtonClicked(void)
index 4a49f38..2596263 100644 (file)
@@ -61,6 +61,7 @@ private slots:
        void tabActionActivated(QAction *action);
        void styleActionActivated(QAction *action);
        void outputFolderViewClicked(const QModelIndex &index);
+       void outputFolderViewMoved(const QModelIndex &index);
        void makeFolderButtonClicked(void);
        void gotoHomeFolderButtonClicked(void);
        void gotoDesktopButtonClicked(void);