Some tweaks to the initialization of the QFileSystem model.

This commit is contained in:
LoRd_MuldeR 2012-03-28 02:21:34 +02:00
parent 28f7a0cd50
commit 47f0f1629c
4 changed files with 23 additions and 10 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 9
#define VER_LAMEXP_BUILD 925
#define VER_LAMEXP_BUILD 927
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -1435,6 +1435,10 @@ void MainWindow::tabPageChanged(int idx)
{
QTimer::singleShot(0, this, SLOT(initOutputFolderModel()));
}
else
{
QTimer::singleShot(0, this, SLOT(centerOutputFolderModel()));
}
}
if(initialWidth < this->width())
@ -2616,7 +2620,7 @@ void MainWindow::outputFolderEditFinished(void)
QFileInfo info(text);
if(info.exists() && info.isDir())
{
QModelIndex index = m_fileSystemModel->index(info.canonicalFilePath());
QModelIndex index = m_fileSystemModel->index(QFileInfo(info.canonicalFilePath()).absoluteFilePath());
if(index.isValid())
{
ok = true;
@ -2626,7 +2630,7 @@ void MainWindow::outputFolderEditFinished(void)
}
else if(info.exists() && info.isFile())
{
QModelIndex index = m_fileSystemModel->index(info.canonicalPath());
QModelIndex index = m_fileSystemModel->index(QFileInfo(info.canonicalFilePath()).absoluteFilePath());
if(index.isValid())
{
ok = true;
@ -2650,14 +2654,23 @@ void MainWindow::outputFolderEditFinished(void)
*/
void MainWindow::initOutputFolderModel(void)
{
QModelIndex previousIndex = outputFolderView->currentIndex();
m_fileSystemModel->setRootPath(m_fileSystemModel->rootPath());
QApplication::processEvents();
outputFolderView->reset();
outputFolderView->setCurrentIndex(previousIndex);
//QModelIndex previousIndex = outputFolderView->currentIndex();
//outputFolderView->reset();
//QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
//outputFolderView->setCurrentIndex(previousIndex);
//QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()));
m_fileSystemModel->setRootPath("");
QTimer::singleShot(333, this, SLOT(centerOutputFolderModel()));
m_OutputFolderViewInitialized = true;
}
void MainWindow::centerOutputFolderModel(void)
{
outputFolderView->scrollTo(outputFolderView->currentIndex(), QAbstractItemView::PositionAtCenter);
outputFolderView->setFocus();
}
// =========================================================
// Metadata tab slots
// =========================================================

View File

@ -62,6 +62,7 @@ private slots:
void bitrateManagementMaxChanged(int value);
void bitrateManagementMinChanged(int value);
void browseCustomTempFolderButtonClicked(void);
void centerOutputFolderModel(void);
void channelModeChanged(int value);
void checkForBetaUpdatesActionTriggered(bool checked);
void checkUpdatesActionActivated(void);

View File

@ -154,8 +154,7 @@ bool QFileSystemModelEx::hasChildren(const QModelIndex &parent) const
{
if(parent.isValid())
{
QDir dir = QDir(QFileSystemModel::filePath(parent));
return dir.exists() && (dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot).count() > 0);
return (QDir(QFileSystemModel::filePath(parent)).entryList(QDir::Dirs | QDir::NoDotAndDotDot).count() > 0);
}
return true;