Implemented support for adding directories via Drag&Drop and CLI
This commit is contained in:
parent
43e3ea25da
commit
e3e0ec36aa
@ -128,7 +128,6 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG"
|
||||
MinimalRebuild="false"
|
||||
@ -161,7 +160,6 @@
|
||||
GenerateMapFile="false"
|
||||
MapExports="false"
|
||||
SubSystem="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
@ -376,7 +374,7 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="MOC "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)"
"
|
||||
Outputs=""$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
@ -386,7 +384,7 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="MOC "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)"
"
|
||||
Outputs=""$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
@ -396,7 +394,7 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="MOC "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)"
"
|
||||
Outputs=""$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
|
@ -293,14 +293,11 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
|
||||
for(int i = 0; i < formats.count(); i++)
|
||||
{
|
||||
if(formats[i].indexOf("FileNameW") >= 0)
|
||||
if(formats.contains("application/x-qt-windows-mime;value=\"FileNameW\"", Qt::CaseInsensitive) && formats.contains("text/uri-list", Qt::CaseInsensitive))
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::dropEvent(QDropEvent *event)
|
||||
{
|
||||
@ -311,7 +308,24 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
|
||||
for(int i = 0; i < urls.count(); i++)
|
||||
{
|
||||
droppedFiles << QFileInfo(urls.at(i).toLocalFile()).absoluteFilePath();
|
||||
QFileInfo file(urls.at(i).toLocalFile());
|
||||
if(!file.exists())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(file.isFile())
|
||||
{
|
||||
droppedFiles << file.canonicalFilePath();
|
||||
continue;
|
||||
}
|
||||
if(file.isDir())
|
||||
{
|
||||
QList<QFileInfo> list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files);
|
||||
for(int j = 0; j < list.count(); j++)
|
||||
{
|
||||
droppedFiles << list.at(j).absoluteFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addFiles(droppedFiles);
|
||||
@ -381,15 +395,8 @@ void MainWindow::windowShown(void)
|
||||
if(!arguments[i].compare("--add", Qt::CaseInsensitive))
|
||||
{
|
||||
QFileInfo currentFile(arguments[++i].trimmed());
|
||||
qDebug("Adding file from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
|
||||
if(currentFile.exists())
|
||||
{
|
||||
m_delayedFileList->append(currentFile.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("File doesn't exist: %s", currentFile.absoluteFilePath().toUtf8().constData());
|
||||
}
|
||||
qDebug("Adding file from CLI: %s", currentFile.canonicalFilePath().toUtf8().constData());
|
||||
m_delayedFileList->append(currentFile.canonicalFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,7 +452,7 @@ void MainWindow::openFolderActionActivated(void)
|
||||
|
||||
while(!fileInfoList.isEmpty())
|
||||
{
|
||||
fileList << fileInfoList.takeFirst().absoluteFilePath();
|
||||
fileList << fileInfoList.takeFirst().canonicalFilePath();
|
||||
}
|
||||
|
||||
addFiles(fileList);
|
||||
@ -771,7 +778,24 @@ void MainWindow::handleDelayedFiles(void)
|
||||
|
||||
while(!m_delayedFileList->isEmpty())
|
||||
{
|
||||
selectedFiles << QFileInfo(m_delayedFileList->takeFirst()).absoluteFilePath();
|
||||
QFileInfo currentFile = QFileInfo(m_delayedFileList->takeFirst());
|
||||
if(!currentFile.exists())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(currentFile.isFile())
|
||||
{
|
||||
selectedFiles << currentFile.canonicalFilePath();
|
||||
continue;
|
||||
}
|
||||
if(currentFile.isDir())
|
||||
{
|
||||
QList<QFileInfo> list = QDir(currentFile.canonicalFilePath()).entryInfoList(QDir::Files);
|
||||
for(int j = 0; j < list.count(); j++)
|
||||
{
|
||||
selectedFiles << list.at(j).absoluteFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addFiles(selectedFiles);
|
||||
|
@ -98,3 +98,8 @@ SIZE_T lamexp_dbg_private_bytes(void);
|
||||
#else
|
||||
#define LAMEXP_MEMORY_CHECK(CMD) CMD
|
||||
#endif
|
||||
|
||||
//Check for CPU-compatibility options
|
||||
#if _M_IX86_FP != 0
|
||||
#error We should not enabled SSE or SSE2 in release builds!
|
||||
#endif
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <QStringList>
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
@ -64,7 +65,7 @@ void MessageProducerThread::run()
|
||||
{
|
||||
if(!arguments[i].compare("--add", Qt::CaseInsensitive))
|
||||
{
|
||||
lamexp_ipc_send(1, arguments[++i].toUtf8().constData());
|
||||
lamexp_ipc_send(1, QFileInfo(arguments[++i]).canonicalFilePath().toUtf8().constData());
|
||||
bSentFiles = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user