Improve output folder selection update code.

This commit is contained in:
LoRd_MuldeR 2010-12-27 18:31:21 +01:00
parent c0aa37205c
commit 12a6cd1c25
2 changed files with 15 additions and 7 deletions

View 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)
{
@ -896,6 +892,17 @@ void MainWindow::outputFolderViewClicked(const QModelIndex &index)
m_settings->outputDir(selectedDir);
}
/*
* Output folder changed (mouse moved)
*/
void MainWindow::outputFolderViewMoved(const QModelIndex &index)
{
if(QApplication::mouseButtons() & Qt::LeftButton)
{
outputFolderViewClicked(index);
}
}
/*
* Goto desktop button
*/

View 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);