When moving files in the list, ensure the selected file(s) remain visible in the view.

This commit is contained in:
LoRd_MuldeR 2015-05-24 23:54:26 +02:00
parent c7be996b47
commit 0e796aad96
3 changed files with 39 additions and 17 deletions

View File

@ -101,9 +101,13 @@
<EntryPointSymbol>lamexp_entry_point</EntryPointSymbol> <EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Message>Copy VLD DLL%27s</Message> <Message>Copy DLL's</Message>
<Command>copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.dll" "$(TargetDir)" <Command>mkdir "$(OutDir)\imageformats" 2&gt; NUL
copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.manifest" "$(TargetDir)"</Command> copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\bin\Qt*.dll" "$(OutDir)"
copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\plugins\imageformats\*.dll" "$(OutDir)\imageformats"
copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.dll" "$(OutDir)"
copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.manifest" "$(OutDir)"
</Command>
</PostBuildEvent> </PostBuildEvent>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -175,10 +179,11 @@ copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.manifest
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Message> <Message>Copy DLL's</Message>
</Message> <Command>mkdir "$(OutDir)\imageformats" 2&gt; NUL
<Command> copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\Qt*.dll" "$(OutDir)"
</Command> copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\*.dll" "$(OutDir)\imageformats"
</Command>
</PostBuildEvent> </PostBuildEvent>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 5 #define VER_LAMEXP_PATCH 5
#define VER_LAMEXP_BUILD 1753 #define VER_LAMEXP_BUILD 1754
#define VER_LAMEXP_CONFG 1700 #define VER_LAMEXP_CONFG 1700
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -1069,6 +1069,7 @@ void MainWindow::moveSelectedFiles(const bool &up)
const QModelIndex item = m_fileListModel->index(firstIndex + i, 0); const QModelIndex item = m_fileListModel->index(firstIndex + i, 0);
selection->select(QItemSelection(item, item), QItemSelectionModel::Select | QItemSelectionModel::Rows); selection->select(QItemSelection(item, item), QItemSelectionModel::Select | QItemSelectionModel::Rows);
} }
ui->sourceFileView->scrollTo(m_fileListModel->index((up ? firstIndex : firstIndex + selectionCount - 1), 0), QAbstractItemView::PositionAtCenter);
return; return;
} }
} }
@ -2443,23 +2444,28 @@ void MainWindow::openFolderActionActivated(void)
*/ */
void MainWindow::removeFileButtonClicked(void) void MainWindow::removeFileButtonClicked(void)
{ {
const QModelIndex current = ui->sourceFileView->currentIndex(); const QItemSelectionModel *const selection = ui->sourceFileView->selectionModel();
if(current.isValid()) if(selection && selection->hasSelection())
{ {
const QItemSelectionModel *const selection = ui->sourceFileView->selectionModel(); int firstRow = -1;
if(selection && selection->hasSelection()) const QModelIndexList selectedRows = INVERT_LIST(selection->selectedRows());
if(!selectedRows.isEmpty())
{ {
const QModelIndexList selectedRows = INVERT_LIST(selection->selectedRows());
FileListBlockHelper fileListBlocker(m_fileListModel); FileListBlockHelper fileListBlocker(m_fileListModel);
firstRow = selectedRows.last().row();
for(QModelIndexList::ConstIterator iter = selectedRows.constBegin(); iter != selectedRows.constEnd(); iter++) for(QModelIndexList::ConstIterator iter = selectedRows.constBegin(); iter != selectedRows.constEnd(); iter++)
{ {
m_fileListModel->removeFile(*iter); if(!m_fileListModel->removeFile(*iter))
{
break;
}
} }
} }
if(m_fileListModel->rowCount() > 0) if(m_fileListModel->rowCount() > 0)
{ {
ui->sourceFileView->selectRow((current.row() < m_fileListModel->rowCount()) ? current.row() : (m_fileListModel->rowCount() - 1)); const QModelIndex position = m_fileListModel->index(((firstRow >= 0) && (firstRow < m_fileListModel->rowCount())) ? firstRow : (m_fileListModel->rowCount() - 1), 0);
ui->sourceFileView->scrollTo(ui->sourceFileView->currentIndex()); ui->sourceFileView->selectRow(position.row());
ui->sourceFileView->scrollTo(position, QAbstractItemView::PositionAtCenter);
} }
} }
else else
@ -2473,7 +2479,14 @@ void MainWindow::removeFileButtonClicked(void)
*/ */
void MainWindow::clearFilesButtonClicked(void) void MainWindow::clearFilesButtonClicked(void)
{ {
m_fileListModel->clearFiles(); if(m_fileListModel->rowCount() > 0)
{
m_fileListModel->clearFiles();
}
else
{
MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
} }
/* /*
@ -2536,6 +2549,10 @@ void MainWindow::showDetailsButtonClicked(void)
break; /*close dilalog now*/ break; /*close dilalog now*/
} }
} }
else
{
MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
sourceFilesScrollbarMoved(0); sourceFilesScrollbarMoved(0);