Make it possible to select *multiple* items on the source files tab (only contiguous items, at this time).

This commit is contained in:
LoRd_MuldeR 2015-05-24 21:32:34 +02:00
parent 6f751b516c
commit c7be996b47
21 changed files with 3006 additions and 2945 deletions

View File

@ -92,6 +92,7 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>');
<li>Added detection of the <em>64-Bit</em> version of QAAC encoder, requires 64-Bit Apple Application Support<br /></li>
<li>Added enhanced file renaming option: Default file extensions can now be overwritten<br /></li>
<li>Added enhanced file renaming option: Files can now be renamed via the <a href="http://www.regular-expressions.info/quickstart.html">regular expression</a> engine<br /></li>
<li>Added capability to select <em>multiple</em> files on &quot;Source Files&quot; tab<br /></li>
<li>Updated MediaInfo to v0.7.73 (2015-04-09), compiled with ICL 15.0 and MSVC 12.0<br /></li>
<li>Updated ALAC decoder to refalac v1.47 (2015-02-15), based on reference implementation by Apple<br /></li>
<li>Updated GnuPG to v1.4.19 (2015-02-27), compiled with GCC 4.9.2<br /></li>

View File

@ -9,6 +9,7 @@
* Added detection of the *64-Bit* version of QAAC encoder, requires 64-Bit Apple Application Support
* Added enhanced file renaming option: Default file extensions can now be overwritten
* Added enhanced file renaming option: Files can now be renamed via the [regular expression](http://www.regular-expressions.info/quickstart.html) engine
* Added capability to select *multiple* files on "Source Files" tab
* Updated MediaInfo to v0.7.73 (2015-04-09), compiled with ICL 15.0 and MSVC 12.0
* Updated ALAC decoder to refalac v1.47 (2015-02-15), based on reference implementation by Apple
* Updated GnuPG to v1.4.19 (2015-02-27), compiled with GCC 4.9.2

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
<context>
<name>MainWindow</name>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="811"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="822"/>
<source>%n file(s) have been rejected, because read access was not granted!</source>
<translation>
<numerusform>%n file have been rejected, because read access was not granted!</numerusform>
@ -39,7 +39,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="815"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="826"/>
<source>%n file(s) have been rejected, because they are dummy CDDA files!</source>
<translation>
<numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform>
@ -47,7 +47,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="819"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="830"/>
<source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation>
<numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform>
@ -55,7 +55,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="823"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="834"/>
<source>%n file(s) have been rejected, because the file format could not be recognized!</source>
<translation>
<numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform>
@ -63,7 +63,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="4143"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="4203"/>
<source>%n Instance(s)</source>
<translation>
<numerusform>%n Instance</numerusform>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@
<item>
<widget class="QTableView" name="sourceFileView">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
@ -1509,8 +1509,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>613</width>
<height>1849</height>
<width>602</width>
<height>1840</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">

View File

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

View File

@ -202,6 +202,17 @@ static inline void MAKE_TRANSPARENT(QWidget *const widget, const bool &flag)
widget->setPalette(flag ? _p : QPalette());
}
template <typename T>
static QList<T>& INVERT_LIST(QList<T> &list)
{
if(!list.isEmpty())
{
const int limit = list.size() / 2, maxIdx = list.size() - 1;
for(int k = 0; k < limit; k++) list.swap(k, maxIdx - k);
}
return list;
}
////////////////////////////////////////////////////////////
// Helper Classes
////////////////////////////////////////////////////////////
@ -1027,6 +1038,43 @@ void MainWindow::openDocumentLink(QAction *const action)
QDesktopServices::openUrl(url);
}
/*
* Move selected files up/down
*/
void MainWindow::moveSelectedFiles(const bool &up)
{
QItemSelectionModel *const selection = ui->sourceFileView->selectionModel();
if(selection && selection->hasSelection())
{
const QModelIndexList selectedRows = up ? selection->selectedRows() : INVERT_LIST(selection->selectedRows());
if((up && (selectedRows.first().row() > 0)) || ((!up) && (selectedRows.first().row() < m_fileListModel->rowCount() - 1)))
{
const int delta = up ? (-1) : 1;
const int firstIndex = (up ? selectedRows.first() : selectedRows.last()).row() + delta;
const int selectionCount = selectedRows.count();
if(abs(delta) > 0)
{
FileListBlockHelper fileListBlocker(m_fileListModel);
for(QModelIndexList::ConstIterator iter = selectedRows.constBegin(); iter != selectedRows.constEnd(); iter++)
{
if(!m_fileListModel->moveFile((*iter), delta))
{
break;
}
}
}
selection->clearSelection();
for(int i = 0; i < selectionCount; i++)
{
const QModelIndex item = m_fileListModel->index(firstIndex + i, 0);
selection->select(QItemSelection(item, item), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
return;
}
}
MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
/*
* Show banner popup dialog
*/
@ -2305,7 +2353,7 @@ void MainWindow::addFilesButtonClicked(void)
ABORT_IF_BUSY;
WidgetHideHelper hiderHelper(m_dropBox.data());
if(MUtils::GUI::themes_enabled())
if(MUtils::GUI::themes_enabled() && (!MUTILS_DEBUG))
{
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), m_settings->mostRecentInputPath(), fileTypeFilters.join(";;"));
@ -2395,11 +2443,28 @@ void MainWindow::openFolderActionActivated(void)
*/
void MainWindow::removeFileButtonClicked(void)
{
if(ui->sourceFileView->currentIndex().isValid())
const QModelIndex current = ui->sourceFileView->currentIndex();
if(current.isValid())
{
int iRow = ui->sourceFileView->currentIndex().row();
m_fileListModel->removeFile(ui->sourceFileView->currentIndex());
ui->sourceFileView->selectRow(iRow < m_fileListModel->rowCount() ? iRow : m_fileListModel->rowCount()-1);
const QItemSelectionModel *const selection = ui->sourceFileView->selectionModel();
if(selection && selection->hasSelection())
{
const QModelIndexList selectedRows = INVERT_LIST(selection->selectedRows());
FileListBlockHelper fileListBlocker(m_fileListModel);
for(QModelIndexList::ConstIterator iter = selectedRows.constBegin(); iter != selectedRows.constEnd(); iter++)
{
m_fileListModel->removeFile(*iter);
}
}
if(m_fileListModel->rowCount() > 0)
{
ui->sourceFileView->selectRow((current.row() < m_fileListModel->rowCount()) ? current.row() : (m_fileListModel->rowCount() - 1));
ui->sourceFileView->scrollTo(ui->sourceFileView->currentIndex());
}
}
else
{
MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
}
@ -2416,12 +2481,7 @@ void MainWindow::clearFilesButtonClicked(void)
*/
void MainWindow::fileUpButtonClicked(void)
{
if(ui->sourceFileView->currentIndex().isValid())
{
int iRow = ui->sourceFileView->currentIndex().row() - 1;
m_fileListModel->moveFile(ui->sourceFileView->currentIndex(), -1);
ui->sourceFileView->selectRow(iRow >= 0 ? iRow : 0);
}
moveSelectedFiles(true);
}
/*
@ -2429,12 +2489,7 @@ void MainWindow::fileUpButtonClicked(void)
*/
void MainWindow::fileDownButtonClicked(void)
{
if(ui->sourceFileView->currentIndex().isValid())
{
int iRow = ui->sourceFileView->currentIndex().row() + 1;
m_fileListModel->moveFile(ui->sourceFileView->currentIndex(), 1);
ui->sourceFileView->selectRow(iRow < m_fileListModel->rowCount() ? iRow : m_fileListModel->rowCount()-1);
}
moveSelectedFiles(false);
}
/*
@ -2445,22 +2500,14 @@ void MainWindow::showDetailsButtonClicked(void)
ABORT_IF_BUSY;
int iResult = 0;
MetaInfoDialog *metaInfoDialog = new MetaInfoDialog(this);
QModelIndex index = ui->sourceFileView->currentIndex();
while(index.isValid())
if(index.isValid())
{
if(iResult > 0)
{
index = m_fileListModel->index(index.row() + 1, index.column());
ui->sourceFileView->selectRow(index.row());
}
if(iResult < 0)
QScopedPointer<MetaInfoDialog> metaInfoDialog(new MetaInfoDialog(this));
forever
{
index = m_fileListModel->index(index.row() - 1, index.column());
ui->sourceFileView->selectRow(index.row());
}
AudioFileModel &file = (*m_fileListModel)[index];
WidgetHideHelper hiderHelper(m_dropBox.data());
iResult = metaInfoDialog->exec(file, index.row() > 0, index.row() < m_fileListModel->rowCount() - 1);
@ -2473,10 +2520,23 @@ void MainWindow::showDetailsButtonClicked(void)
break;
}
if(!iResult) break;
if(iResult > 0)
{
index = m_fileListModel->index(index.row() + 1, index.column());
ui->sourceFileView->selectRow(index.row());
continue;
}
else if(iResult < 0)
{
index = m_fileListModel->index(index.row() - 1, index.column());
ui->sourceFileView->selectRow(index.row());
continue;
}
break; /*close dilalog now*/
}
}
MUTILS_DELETE(metaInfoDialog);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
sourceFilesScrollbarMoved(0);
}

View File

@ -212,6 +212,7 @@ private:
void initializeTranslation(void);
void refreshFavorites(void);
void openDocumentLink(QAction *const action);
void moveSelectedFiles(const bool &up);
void showBanner(const QString &text);
void showBanner(const QString &text, QThread *const thread);

View File

@ -171,19 +171,17 @@ void FileListModel::addFile(const AudioFileModel &file)
bool FileListModel::removeFile(const QModelIndex &index)
{
if(index.row() >= 0 && index.row() < m_fileList.count())
const int row = index.row();
if(row >= 0 && row < m_fileList.count())
{
beginResetModel();
m_fileStore.remove(m_fileList.at(index.row()));
m_fileList.removeAt(index.row());
m_fileStore.remove(m_fileList.at(row));
m_fileList.removeAt(row);
endResetModel();
return true;
}
else
{
return false;
}
}
void FileListModel::clearFiles(void)
{