mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 14:46:33 +02:00
Add some SetFile/GetFileInfo debug
This commit is contained in:
@@ -31,19 +31,20 @@ CheckDirModel::CheckDirModel( QWidget* parent )
|
|||||||
: QFileSystemModel( parent )
|
: QFileSystemModel( parent )
|
||||||
, m_shownVolumes( false )
|
, m_shownVolumes( false )
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
m_setFilePath = QString( "%1/SetFile" ) .arg( QCoreApplication::applicationDirPath() );
|
m_setFilePath = QString( "%1/SetFile" ) .arg( QCoreApplication::applicationDirPath() );
|
||||||
m_getFileInfoPath = QString( "%1/GetFileInfo" ).arg( QCoreApplication::applicationDirPath() );
|
m_getFileInfoPath = QString( "%1/GetFileInfo" ).arg( QCoreApplication::applicationDirPath() );
|
||||||
|
|
||||||
QProcess* checkVolumeVisible = new QProcess( this );
|
QProcess* checkVolumeVisible = new QProcess( this );
|
||||||
connect( checkVolumeVisible, SIGNAL( readyReadStandardOutput() ), this, SLOT( getFileInfoResult() ) );
|
connect( checkVolumeVisible, SIGNAL( readyReadStandardOutput() ), this, SLOT( getFileInfoResult() ) );
|
||||||
|
qDebug() << "Running GetFileInfo:" << m_getFileInfoPath << "-aV" << s_macVolumePath;
|
||||||
checkVolumeVisible->start( m_getFileInfoPath, QStringList() << "-aV" << s_macVolumePath );
|
checkVolumeVisible->start( m_getFileInfoPath, QStringList() << "-aV" << s_macVolumePath );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDirModel::~CheckDirModel()
|
CheckDirModel::~CheckDirModel()
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
// reset to previous state
|
// reset to previous state
|
||||||
if ( m_shownVolumes )
|
if ( m_shownVolumes )
|
||||||
QProcess::startDetached( QString( "%1 -a V %2" ).arg( m_setFilePath).arg( s_macVolumePath ) );
|
QProcess::startDetached( QString( "%1 -a V %2" ).arg( m_setFilePath).arg( s_macVolumePath ) );
|
||||||
@@ -53,21 +54,25 @@ CheckDirModel::~CheckDirModel()
|
|||||||
void
|
void
|
||||||
CheckDirModel::getFileInfoResult()
|
CheckDirModel::getFileInfoResult()
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QProcess* p = qobject_cast< QProcess* >( sender() );
|
QProcess* p = qobject_cast< QProcess* >( sender() );
|
||||||
Q_ASSERT( p );
|
Q_ASSERT( p );
|
||||||
|
|
||||||
QByteArray res = p->readAll().trimmed();
|
QByteArray res = p->readAll().trimmed();
|
||||||
|
qDebug() << "Got output from GetFileInfo:" << res;
|
||||||
// 1 means /Volumes is hidden, so we show it while the dialog is visible
|
// 1 means /Volumes is hidden, so we show it while the dialog is visible
|
||||||
if ( res == "1" )
|
if ( res == "1" )
|
||||||
{
|
{
|
||||||
// Remove the hidden flag for the /Volumnes folder so all mount points are visible in the default (Q)FileSystemModel
|
// Remove the hidden flag for the /Volumnes folder so all mount points are visible in the default (Q)FileSystemModel
|
||||||
QProcess* p = new QProcess( this );
|
QProcess* p = new QProcess( this );
|
||||||
connect( p, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( volumeShowFinished() ) );
|
connect( p, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( volumeShowFinished() ) );
|
||||||
|
qDebug() << "Running SetFile:" << QString( "%1 -a v %2" ).arg( m_setFilePath ).arg( s_macVolumePath );
|
||||||
p->start( QString( "%1 -a v %2" ).arg( m_setFilePath ).arg( s_macVolumePath ) );
|
p->start( QString( "%1 -a v %2" ).arg( m_setFilePath ).arg( s_macVolumePath ) );
|
||||||
|
connect( p, SIGNAL( readyReadStandardError() ), this, SLOT( processErrorOutput() ) );
|
||||||
m_shownVolumes = true;
|
m_shownVolumes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->terminate();
|
||||||
p->deleteLater();
|
p->deleteLater();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -75,9 +80,27 @@ CheckDirModel::getFileInfoResult()
|
|||||||
void
|
void
|
||||||
CheckDirModel::volumeShowFinished()
|
CheckDirModel::volumeShowFinished()
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QProcess* p = qobject_cast< QProcess* >( sender() );
|
||||||
|
Q_ASSERT( p );
|
||||||
|
qDebug() << "Got output from GetFileInfo:" << p->readAll();
|
||||||
|
|
||||||
|
p->terminate();
|
||||||
|
p->deleteLater();
|
||||||
|
#endif
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CheckDirModel::processErrorOutput()
|
||||||
|
{
|
||||||
|
QProcess* p = qobject_cast< QProcess* >( sender() );
|
||||||
|
Q_ASSERT( p );
|
||||||
|
qDebug() << "Got ERROR OUTPUT from subprocess in CheckDirModel:" << p->readAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Qt::ItemFlags
|
Qt::ItemFlags
|
||||||
CheckDirModel::flags( const QModelIndex& index ) const
|
CheckDirModel::flags( const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
|
@@ -46,7 +46,7 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void getFileInfoResult();
|
void getFileInfoResult();
|
||||||
void volumeShowFinished();
|
void volumeShowFinished();
|
||||||
|
void processErrorOutput();
|
||||||
private:
|
private:
|
||||||
QHash<QPersistentModelIndex, Qt::CheckState> m_checkTable;
|
QHash<QPersistentModelIndex, Qt::CheckState> m_checkTable;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user