Implemented support for adding directories via Drag&Drop and CLI

This commit is contained in:
LoRd_MuldeR 2010-11-13 02:11:15 +01:00
parent 43e3ea25da
commit e3e0ec36aa
5 changed files with 52 additions and 24 deletions

View File

@ -128,7 +128,6 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui"" 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" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG"
MinimalRebuild="false" MinimalRebuild="false"
@ -161,7 +160,6 @@
GenerateMapFile="false" GenerateMapFile="false"
MapExports="false" MapExports="false"
SubSystem="2" SubSystem="2"
LinkTimeCodeGeneration="1"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
@ -376,7 +374,7 @@
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;" CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/> />
</FileConfiguration> </FileConfiguration>
@ -386,7 +384,7 @@
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;" CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/> />
</FileConfiguration> </FileConfiguration>
@ -396,7 +394,7 @@
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;" CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/> />
</FileConfiguration> </FileConfiguration>

View File

@ -293,12 +293,9 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{ {
QStringList formats = event->mimeData()->formats(); QStringList formats = event->mimeData()->formats();
for(int i = 0; i < formats.count(); i++) if(formats.contains("application/x-qt-windows-mime;value=\"FileNameW\"", Qt::CaseInsensitive) && formats.contains("text/uri-list", Qt::CaseInsensitive))
{ {
if(formats[i].indexOf("FileNameW") >= 0) event->acceptProposedAction();
{
event->acceptProposedAction();
}
} }
} }
@ -311,7 +308,24 @@ void MainWindow::dropEvent(QDropEvent *event)
for(int i = 0; i < urls.count(); i++) 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); addFiles(droppedFiles);
@ -381,15 +395,8 @@ void MainWindow::windowShown(void)
if(!arguments[i].compare("--add", Qt::CaseInsensitive)) if(!arguments[i].compare("--add", Qt::CaseInsensitive))
{ {
QFileInfo currentFile(arguments[++i].trimmed()); QFileInfo currentFile(arguments[++i].trimmed());
qDebug("Adding file from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData()); qDebug("Adding file from CLI: %s", currentFile.canonicalFilePath().toUtf8().constData());
if(currentFile.exists()) m_delayedFileList->append(currentFile.canonicalFilePath());
{
m_delayedFileList->append(currentFile.absoluteFilePath());
}
else
{
qWarning("File doesn't exist: %s", currentFile.absoluteFilePath().toUtf8().constData());
}
} }
} }
@ -445,7 +452,7 @@ void MainWindow::openFolderActionActivated(void)
while(!fileInfoList.isEmpty()) while(!fileInfoList.isEmpty())
{ {
fileList << fileInfoList.takeFirst().absoluteFilePath(); fileList << fileInfoList.takeFirst().canonicalFilePath();
} }
addFiles(fileList); addFiles(fileList);
@ -771,7 +778,24 @@ void MainWindow::handleDelayedFiles(void)
while(!m_delayedFileList->isEmpty()) 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); addFiles(selectedFiles);

View File

@ -98,3 +98,8 @@ SIZE_T lamexp_dbg_private_bytes(void);
#else #else
#define LAMEXP_MEMORY_CHECK(CMD) CMD #define LAMEXP_MEMORY_CHECK(CMD) CMD
#endif #endif
//Check for CPU-compatibility options
#if _M_IX86_FP != 0
#error We should not enabled SSE or SSE2 in release builds!
#endif

View File

@ -52,7 +52,7 @@ int lamexp_main(int argc, char* argv[])
qDebug("This program is free software: you can redistribute it and/or modify"); qDebug("This program is free software: you can redistribute it and/or modify");
qDebug("it under the terms of the GNU General Public License <http://www.gnu.org/>."); qDebug("it under the terms of the GNU General Public License <http://www.gnu.org/>.");
qDebug("This program comes with ABSOLUTELY NO WARRANTY.\n"); qDebug("This program comes with ABSOLUTELY NO WARRANTY.\n");
//Print warning, if this is a "debug" build //Print warning, if this is a "debug" build
LAMEXP_CHECK_DEBUG_BUILD; LAMEXP_CHECK_DEBUG_BUILD;

View File

@ -25,6 +25,7 @@
#include <QStringList> #include <QStringList>
#include <QApplication> #include <QApplication>
#include <QFileInfo>
#include <limits.h> #include <limits.h>
@ -64,7 +65,7 @@ void MessageProducerThread::run()
{ {
if(!arguments[i].compare("--add", Qt::CaseInsensitive)) 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; bSentFiles = true;
} }
} }