mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Show job status for indexing
This commit is contained in:
@@ -39,6 +39,7 @@ set( libGuiSources
|
|||||||
jobview/TransferStatusItem.cpp
|
jobview/TransferStatusItem.cpp
|
||||||
jobview/LatchedStatusItem.cpp
|
jobview/LatchedStatusItem.cpp
|
||||||
jobview/ErrorStatusMessage.cpp
|
jobview/ErrorStatusMessage.cpp
|
||||||
|
jobview/IndexingJobItem.cpp
|
||||||
|
|
||||||
infobar/infobar.cpp
|
infobar/infobar.cpp
|
||||||
|
|
||||||
@@ -278,6 +279,7 @@ set( libGuiHeaders
|
|||||||
jobview/TransferStatusItem.h
|
jobview/TransferStatusItem.h
|
||||||
jobview/LatchedStatusItem.h
|
jobview/LatchedStatusItem.h
|
||||||
jobview/ErrorStatusMessage.h
|
jobview/ErrorStatusMessage.h
|
||||||
|
jobview/IndexingJobItem.h
|
||||||
|
|
||||||
thirdparty/Qocoa/qsearchfield.h
|
thirdparty/Qocoa/qsearchfield.h
|
||||||
)
|
)
|
||||||
|
@@ -21,14 +21,26 @@
|
|||||||
#include "databaseimpl.h"
|
#include "databaseimpl.h"
|
||||||
#include "tomahawksqlquery.h"
|
#include "tomahawksqlquery.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include "jobview/IndexingJobItem.h"
|
||||||
|
#include "jobview/JobStatusView.h"
|
||||||
|
#include "jobview/JobStatusModel.h"
|
||||||
|
|
||||||
#include <QSqlRecord>
|
#include <QSqlRecord>
|
||||||
|
|
||||||
|
|
||||||
DatabaseCommand_UpdateSearchIndex::DatabaseCommand_UpdateSearchIndex()
|
DatabaseCommand_UpdateSearchIndex::DatabaseCommand_UpdateSearchIndex()
|
||||||
: DatabaseCommand()
|
: DatabaseCommand()
|
||||||
|
, m_statusJob( new IndexingJobItem )
|
||||||
{
|
{
|
||||||
tLog() << Q_FUNC_INFO << "Updating index.";
|
tLog() << Q_FUNC_INFO << "Updating index.";
|
||||||
|
|
||||||
|
JobStatusView::instance()->model()->addJob( m_statusJob );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DatabaseCommand_UpdateSearchIndex::~DatabaseCommand_UpdateSearchIndex()
|
||||||
|
{
|
||||||
|
m_statusJob->done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +60,7 @@ DatabaseCommand_UpdateSearchIndex::indexTable( DatabaseImpl* db, const QString&
|
|||||||
value = "";
|
value = "";
|
||||||
for ( int v = 1; v < q.record().count(); v++ )
|
for ( int v = 1; v < q.record().count(); v++ )
|
||||||
value += q.value( v ).toString() + " ";
|
value += q.value( v ).toString() + " ";
|
||||||
|
|
||||||
fields.insert( q.value( 0 ).toUInt(), value.trimmed() );
|
fields.insert( q.value( 0 ).toUInt(), value.trimmed() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,11 +22,14 @@
|
|||||||
#include "databasecommand.h"
|
#include "databasecommand.h"
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
class IndexingJobItem;
|
||||||
|
|
||||||
class DLLEXPORT DatabaseCommand_UpdateSearchIndex : public DatabaseCommand
|
class DLLEXPORT DatabaseCommand_UpdateSearchIndex : public DatabaseCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DatabaseCommand_UpdateSearchIndex();
|
explicit DatabaseCommand_UpdateSearchIndex();
|
||||||
|
virtual ~DatabaseCommand_UpdateSearchIndex();
|
||||||
|
|
||||||
virtual QString commandname() const { return "updatesearchindex"; }
|
virtual QString commandname() const { return "updatesearchindex"; }
|
||||||
virtual bool doesMutates() const { return true; }
|
virtual bool doesMutates() const { return true; }
|
||||||
@@ -39,6 +42,7 @@ private:
|
|||||||
void indexTable( DatabaseImpl* db, const QString& table, const QString& query );
|
void indexTable( DatabaseImpl* db, const QString& table, const QString& query );
|
||||||
|
|
||||||
QString table;
|
QString table;
|
||||||
|
IndexingJobItem* m_statusJob;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATABASECOMMAND_UPDATESEARCHINDEX_H
|
#endif // DATABASECOMMAND_UPDATESEARCHINDEX_H
|
||||||
|
47
src/libtomahawk/jobview/IndexingJobItem.cpp
Normal file
47
src/libtomahawk/jobview/IndexingJobItem.cpp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "IndexingJobItem.h"
|
||||||
|
|
||||||
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
|
static QPixmap* s_indexIcon = 0;
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
IndexingJobItem::mainText() const
|
||||||
|
{
|
||||||
|
return tr( "Indexing database" );
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap
|
||||||
|
IndexingJobItem::icon() const
|
||||||
|
{
|
||||||
|
if ( s_indexIcon == 0 )
|
||||||
|
s_indexIcon = new QPixmap( RESPATH "images/view-refresh.png" );
|
||||||
|
|
||||||
|
return *s_indexIcon;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void IndexingJobItem::done()
|
||||||
|
{
|
||||||
|
emit finished();
|
||||||
|
}
|
||||||
|
|
39
src/libtomahawk/jobview/IndexingJobItem.h
Normal file
39
src/libtomahawk/jobview/IndexingJobItem.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INDEXINGJOBITEM_H
|
||||||
|
#define INDEXINGJOBITEM_H
|
||||||
|
|
||||||
|
#include <jobview/JobStatusItem.h>
|
||||||
|
|
||||||
|
|
||||||
|
class IndexingJobItem : public JobStatusItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit IndexingJobItem() {}
|
||||||
|
|
||||||
|
void done();
|
||||||
|
|
||||||
|
virtual QString rightColumnText() const { return QString(); }
|
||||||
|
virtual QString mainText() const;
|
||||||
|
virtual QPixmap icon() const;
|
||||||
|
virtual QString type() const { return "indexerjob"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INDEXINGJOBITEM_H
|
Reference in New Issue
Block a user