introduce a define to disable threaded device scanning in case we don't find a

workaround for the solid problem.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1098456
This commit is contained in:
Volker Lanz 2010-03-03 18:58:14 +00:00
parent 532d84f6e5
commit 899d27fb34
5 changed files with 26 additions and 1 deletions

View File

@ -44,6 +44,11 @@ void DeviceScanner::clear()
}
void DeviceScanner::run()
{
scan();
}
void DeviceScanner::scan()
{
emit progress(QString(), 0);

View File

@ -39,13 +39,13 @@ class DeviceScanner : public QThread
public:
void clear(); /**< clear Devices and the OperationStack */
void scan(); /**< do the actual scanning; blocks if called directly */
signals:
void progress(const QString& device_node, int progress);
protected:
virtual void run();
OperationStack& operationStack() { return m_OperationStack; }
const OperationStack& operationStack() const { return m_OperationStack; }

View File

@ -428,7 +428,9 @@ void OperationStack::clearOperations()
/** Clears the list of Devices. */
void OperationStack::clearDevices()
{
#if defined(THREADED_DEVICE_SCANNER)
QWriteLocker lockDevices(&lock());
#endif
qDeleteAll(previewDevices());
previewDevices().clear();
@ -441,7 +443,9 @@ void OperationStack::clearDevices()
*/
Device* OperationStack::findDeviceForPartition(const Partition* p)
{
#if defined(THREADED_DEVICE_SCANNER)
QReadLocker lockDevices(&lock());
#endif
foreach (Device* d, previewDevices())
{
@ -469,7 +473,10 @@ void OperationStack::addDevice(Device* d)
{
Q_ASSERT(d);
#if defined(THREADED_DEVICE_SCANNER)
QWriteLocker lockDevices(&lock());
#endif
previewDevices().append(d);
emit devicesChanged();
}
@ -481,7 +488,9 @@ static bool deviceLessThan(const Device* d1, const Device* d2)
void OperationStack::sortDevices()
{
#if defined(THREADED_DEVICE_SCANNER)
QWriteLocker lockDevices(&lock());
#endif
qSort(previewDevices().begin(), previewDevices().end(), deviceLessThan);

View File

@ -434,7 +434,9 @@ void MainWindow::on_m_OperationStack_operationsChanged()
void MainWindow::on_m_OperationStack_devicesChanged()
{
#if defined(THREADED_DEVICE_SCANNER)
QReadLocker lockDevices(&operationStack().lock());
#endif
listDevices().updateDevices(operationStack().previewDevices());
@ -543,10 +545,15 @@ void MainWindow::scanDevices()
KApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
#if defined(THREADED_DEVICE_SCANNER)
scanProgressDialog().setEnabled(true);
scanProgressDialog().show();
deviceScanner().start();
#else
deviceScanner().scan();
on_m_DeviceScanner_finished();
#endif
}
void MainWindow::on_m_DeviceScanner_progress(const QString& device_node, int percent)
@ -557,7 +564,9 @@ void MainWindow::on_m_DeviceScanner_progress(const QString& device_node, int per
void MainWindow::on_m_DeviceScanner_finished()
{
#if defined(THREADED_DEVICE_SCANNER)
QReadLocker lockDevices(&operationStack().lock());
#endif
if (!operationStack().previewDevices().isEmpty())
pmWidget().setSelectedDevice(operationStack().previewDevices()[0]);

View File

@ -186,7 +186,9 @@ Partition* PartitionManagerWidget::selectedPartition()
void PartitionManagerWidget::setSelectedDevice(const QString& device_node)
{
#if defined(THREADED_DEVICE_SCANNER)
QReadLocker lockDevices(&operationStack().lock());
#endif
foreach(Device* d, operationStack().previewDevices())
if (d->deviceNode() == device_node)