From a6427ee3ceafcbc673c58da1d979c4cdd224f2b8 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Tue, 26 Jan 2010 21:12:42 +0000 Subject: [PATCH] rename log class to Log to avoid clashes with the C math lib function of the same name svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1080742 --- src/core/libparted.cpp | 4 ++-- src/core/operationstack.cpp | 26 +++++++++++++------------- src/core/partitiontable.cpp | 6 +++--- src/fs/ntfs.cpp | 8 ++++---- src/gui/mainwindow.cpp | 2 +- src/gui/partitionmanagerwidget.cpp | 14 +++++++------- src/gui/treelog.cpp | 2 +- src/gui/treelog.h | 2 +- src/kcm/partitionmanagerkcm.cpp | 4 ++-- src/kcm/partitionmanagerkcm.h | 2 +- src/util/globallog.cpp | 4 ++-- src/util/globallog.h | 22 +++++++++++----------- src/util/helpers.cpp | 2 +- 13 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/core/libparted.cpp b/src/core/libparted.cpp index fb3d10c..0bcfd97 100644 --- a/src/core/libparted.cpp +++ b/src/core/libparted.cpp @@ -59,7 +59,7 @@ static PedExceptionOption pedExceptionHandler(PedException* e) { /** @todo These messages should end up in the Report, not in the GlobalLog. */ - log(log::error) << i18nc("@info/plain", "LibParted Exception: %1", QString::fromLocal8Bit(e->message)); + Log(Log::error) << i18nc("@info/plain", "LibParted Exception: %1", QString::fromLocal8Bit(e->message)); return PED_EXCEPTION_UNHANDLED; } @@ -233,7 +233,7 @@ void LibParted::scanDevices(OperationStack& ostack) const Solid::Block* solidBlock = solidDevice.as(); PedDevice* pedDevice = ped_device_get(solidBlock->device().toLocal8Bit()); - log(log::information) << i18nc("@info/plain", "Device found: %1", pedDevice->model); + Log(Log::information) << i18nc("@info/plain", "Device found: %1", pedDevice->model); Device* d = new Device(pedDevice->model, pedDevice->path, pedDevice->bios_geom.heads, pedDevice->bios_geom.sectors, pedDevice->bios_geom.cylinders, pedDevice->sector_size, solidDevice.icon()); diff --git a/src/core/operationstack.cpp b/src/core/operationstack.cpp index d53a846..7d88e64 100644 --- a/src/core/operationstack.cpp +++ b/src/core/operationstack.cpp @@ -97,7 +97,7 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed // -- 1 -- if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition()) { - log() << i18nc("@info/plain", "Deleting a partition just created: Undoing the operation to create the partition."); + Log() << i18nc("@info/plain", "Deleting a partition just created: Undoing the operation to create the partition."); delete pushedOp; pushedOp = NULL; @@ -111,7 +111,7 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed // -- 2 -- if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition()) { - log() << i18nc("@info/plain", "Resizing a partition just created: Updating start and end in existing operation."); + Log() << i18nc("@info/plain", "Resizing a partition just created: Updating start and end in existing operation."); Partition* newPartition = new Partition(newOp->newPartition()); newPartition->setFirstSector(pushedResizeOp->newFirstSector()); @@ -132,7 +132,7 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed // -- 3 -- if (pushedCopyOp && &newOp->newPartition() == &pushedCopyOp->sourcePartition()) { - log() << i18nc("@info/plain", "Copying a new partition: Creating a new partition instead."); + Log() << i18nc("@info/plain", "Copying a new partition: Creating a new partition instead."); Partition* newPartition = new Partition(newOp->newPartition()); newPartition->setFirstSector(pushedCopyOp->copiedPartition().firstSector()); @@ -150,7 +150,7 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed // -- 4 -- if (pushedLabelOp && &newOp->newPartition() == &pushedLabelOp->labeledPartition()) { - log() << i18nc("@info/plain", "Changing label for a new partition: No new operation required."); + Log() << i18nc("@info/plain", "Changing label for a new partition: No new operation required."); newOp->setLabelJob()->setLabel(pushedLabelOp->newLabel()); newOp->newPartition().fileSystem().setLabel(pushedLabelOp->newLabel()); @@ -164,7 +164,7 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed // -- 5 -- if (pushedCreateFileSystemOp && &newOp->newPartition() == &pushedCreateFileSystemOp->partition()) { - log() << i18nc("@info/plain", "Changing file system for a new partition: No new operation required."); + Log() << i18nc("@info/plain", "Changing file system for a new partition: No new operation required."); FileSystem* oldFs = &newOp->newPartition().fileSystem(); @@ -220,14 +220,14 @@ bool OperationStack::mergeCopyOperation(Operation*& currentOp, Operation*& pushe // copy operation, forget the delete and be done. if (copyOp->overwrittenPartition() == NULL) { - log() << i18nc("@info/plain", "Deleting a partition just copied: Removing the copy."); + Log() << i18nc("@info/plain", "Deleting a partition just copied: Removing the copy."); delete pushedOp; pushedOp = NULL; } else { - log() << i18nc("@info/plain", "Deleting a partition just copied over an existing partition: Removing the copy and deleting the existing partition."); + Log() << i18nc("@info/plain", "Deleting a partition just copied over an existing partition: Removing the copy and deleting the existing partition."); pushedDeleteOp->setDeletedPartition(copyOp->overwrittenPartition()); } @@ -241,7 +241,7 @@ bool OperationStack::mergeCopyOperation(Operation*& currentOp, Operation*& pushe // -- 2 -- if (pushedCopyOp && ©Op->copiedPartition() == &pushedCopyOp->sourcePartition()) { - log() << i18nc("@info/plain", "Copying a partition that is itself a copy: Copying the original source partition instead."); + Log() << i18nc("@info/plain", "Copying a partition that is itself a copy: Copying the original source partition instead."); pushedCopyOp->setSourcePartition(©Op->sourcePartition()); } @@ -272,14 +272,14 @@ bool OperationStack::mergeRestoreOperation(Operation*& currentOp, Operation*& pu { if (restoreOp->overwrittenPartition() == NULL) { - log() << i18nc("@info/plain", "Deleting a partition just restored: Removing the restore operation."); + Log() << i18nc("@info/plain", "Deleting a partition just restored: Removing the restore operation."); delete pushedOp; pushedOp = NULL; } else { - log() << i18nc("@info/plain", "Deleting a partition just restored to an existing partition: Removing the restore operation and deleting the existing partition."); + Log() << i18nc("@info/plain", "Deleting a partition just restored to an existing partition: Removing the restore operation and deleting the existing partition."); pushedDeleteOp->setDeletedPartition(restoreOp->overwrittenPartition()); } @@ -313,7 +313,7 @@ bool OperationStack::mergePartFlagsOperation(Operation*& currentOp, Operation*& if (pushedFlagsOp && &partFlagsOp->flagPartition() == &pushedFlagsOp->flagPartition()) { - log() << i18nc("@info/plain", "Changing flags again for the same partition: Removing old operation."); + Log() << i18nc("@info/plain", "Changing flags again for the same partition: Removing old operation."); pushedFlagsOp->setOldFlags(partFlagsOp->oldFlags()); partFlagsOp->undo(); @@ -345,7 +345,7 @@ bool OperationStack::mergePartLabelOperation(Operation*& currentOp, Operation*& if (pushedLabelOp && &partLabelOp->labeledPartition() == &pushedLabelOp->labeledPartition()) { - log() << i18nc("@info/plain", "Changing label again for the same partition: Removing old operation."); + Log() << i18nc("@info/plain", "Changing label again for the same partition: Removing old operation."); pushedLabelOp->setOldLabel(partLabelOp->oldLabel()); partLabelOp->undo(); @@ -390,7 +390,7 @@ void OperationStack::push(Operation* o) if (o != NULL) { - log() << i18nc("@info/plain", "Add operation: %1", o->description()); + Log() << i18nc("@info/plain", "Add operation: %1", o->description()); operations().append(o); o->preview(); o->setStatus(Operation::StatusPending); diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp index e5a6f85..a57d290 100644 --- a/src/core/partitiontable.cpp +++ b/src/core/partitiontable.cpp @@ -245,7 +245,7 @@ bool PartitionTable::isSnapped(const Device& d, const Partition& p) if (delta) { - log(log::warning) << i18nc("@info/plain", "Partition %1 does not start at a cylinder boundary (first sector: %2, modulo: %3).", p.deviceNode(), p.firstSector(), delta); + Log(Log::warning) << i18nc("@info/plain", "Partition %1 does not start at a cylinder boundary (first sector: %2, modulo: %3).", p.deviceNode(), p.firstSector(), delta); rval = false; } @@ -253,7 +253,7 @@ bool PartitionTable::isSnapped(const Device& d, const Partition& p) if (delta) { - log(log::warning) << i18nc("@info/plain", "Partition %1 does not end at a cylinder boundary (last sector: %2, modulo: %3).", p.deviceNode(), p.lastSector(), delta); + Log(Log::warning) << i18nc("@info/plain", "Partition %1 does not end at a cylinder boundary (last sector: %2, modulo: %3).", p.deviceNode(), p.lastSector(), delta); rval = false; } @@ -389,7 +389,7 @@ bool PartitionTable::snap(const Device& d, Partition& p, const Partition* origin } if (p.length() < originalLength) - log(log::warning) << i18ncp("@info/plain", "The partition cannot be created with the requested length of 1 sector, ", "The partition cannot be created with the requested length of %1 sectors, ", originalLength) + Log(Log::warning) << i18ncp("@info/plain", "The partition cannot be created with the requested length of 1 sector, ", "The partition cannot be created with the requested length of %1 sectors, ", originalLength) + i18ncp("@info/plain", "and will instead only be 1 sector long.", "and will instead only be %1 sectors long.", p.length()); // In an extended partition we also need to snap unallocated children at the beginning and at the end diff --git a/src/fs/ntfs.cpp b/src/fs/ntfs.cpp index 3cfe8b5..1aeb1ac 100644 --- a/src/fs/ntfs.cpp +++ b/src/fs/ntfs.cpp @@ -175,23 +175,23 @@ namespace FS QFile device(deviceNode); if (!device.open(QFile::ReadWrite | QFile::Unbuffered)) { - log() << i18nc("@info/plain", "Could not open partition %1 for writing when trying to update the NTFS boot sector.", deviceNode); + Log() << i18nc("@info/plain", "Could not open partition %1 for writing when trying to update the NTFS boot sector.", deviceNode); return false; } if (!device.seek(0x1c)) { - log() << i18nc("@info/plain", "Could not seek to position 0x1c on partition %1 when trying to update the NTFS boot sector.", deviceNode); + Log() << i18nc("@info/plain", "Could not seek to position 0x1c on partition %1 when trying to update the NTFS boot sector.", deviceNode); return false; } if (device.write(s, 4) != 4) { - log() << i18nc("@info/plain", "Could not write new start sector to partition %1 when trying to update the NTFS boot sector.", deviceNode); + Log() << i18nc("@info/plain", "Could not write new start sector to partition %1 when trying to update the NTFS boot sector.", deviceNode); return false; } - log() << i18nc("@info/plain", "Updated NTFS boot sector for partition %1 successfully.", deviceNode); + Log() << i18nc("@info/plain", "Updated NTFS boot sector for partition %1 successfully.", deviceNode); return true; } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0e4de32..9d6ab3b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -55,7 +55,7 @@ void MainWindow::init() { treeLog().init(actionCollection(), &pmWidget()); - connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), &treeLog(), SLOT(onNewLogMessage(log::Level, const QString&))); + connect(GlobalLog::instance(), SIGNAL(newMessage(Log::Level, const QString&)), &treeLog(), SLOT(onNewLogMessage(Log::Level, const QString&))); setupActions(); setupStatusBar(); diff --git a/src/gui/partitionmanagerwidget.cpp b/src/gui/partitionmanagerwidget.cpp index 98f2db4..2b7ce4b 100644 --- a/src/gui/partitionmanagerwidget.cpp +++ b/src/gui/partitionmanagerwidget.cpp @@ -301,7 +301,7 @@ void PartitionManagerWidget::setupConnections() void PartitionManagerWidget::scanDevices() { - log() << i18nc("@info/plain", "Rescanning devices..."); + Log() << i18nc("@info/plain", "Rescanning devices..."); KApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -316,7 +316,7 @@ void PartitionManagerWidget::scanDevices() updatePartitions(); - log() << i18nc("@info/plain", "Rescan finished."); + Log() << i18nc("@info/plain", "Rescan finished."); KApplication::restoreOverrideCursor(); emit selectionChanged(NULL); @@ -782,7 +782,7 @@ void PartitionManagerWidget::onResizePartition() PartitionTable::snap(*selectedDevice(), resizedPartition, selectedPartition()); if (resizedPartition.firstSector() == selectedPartition()->firstSector() && resizedPartition.lastSector() == selectedPartition()->lastSector()) - log(log::information) << i18nc("@info/plain", "Partition %1 has the same position and size after resize/move. Ignoring operation.", selectedPartition()->deviceNode()); + Log(Log::information) << i18nc("@info/plain", "Partition %1 has the same position and size after resize/move. Ignoring operation.", selectedPartition()->deviceNode()); else { operationStack().push(new ResizeOperation(*selectedDevice(), *selectedPartition(), resizedPartition.firstSector(), resizedPartition.lastSector())); @@ -807,7 +807,7 @@ void PartitionManagerWidget::onCopyPartition() } setClipboardPartition(selectedPartition()); - log() << i18nc("@info/plain", "Partition %1 has been copied to the clipboard.", selectedPartition()->deviceNode()); + Log() << i18nc("@info/plain", "Partition %1 has been copied to the clipboard.", selectedPartition()->deviceNode()); enableActions(); } @@ -947,7 +947,7 @@ void PartitionManagerWidget::onRefreshDevices() void PartitionManagerWidget::onUndoOperation() { - log() << i18nc("@info/plain", "Undoing operation: %1", operationStack().operations().last()->description()); + Log() << i18nc("@info/plain", "Undoing operation: %1", operationStack().operations().last()->description()); operationStack().pop(); updatePartitions(); @@ -964,7 +964,7 @@ void PartitionManagerWidget::onClearAllOperations() KGuiItem(i18nc("@action:button", "&Clear Pending Operations")), KStandardGuiItem::cancel(), "reallyClearPendingOperations") == KMessageBox::Continue) { - log() << i18nc("@info/plain", "Clearing the list of pending operations."); + Log() << i18nc("@info/plain", "Clearing the list of pending operations."); operationStack().clearOperations(); updatePartitions(); @@ -989,7 +989,7 @@ void PartitionManagerWidget::onApplyAllOperations() KGuiItem(i18nc("@action:button", "&Apply Pending Operations")), KStandardGuiItem::cancel()) == KMessageBox::Continue) { - log() << i18nc("@info/plain", "Applying operations..."); + Log() << i18nc("@info/plain", "Applying operations..."); progressDialog().show(); diff --git a/src/gui/treelog.cpp b/src/gui/treelog.cpp index 665b2fa..19ece1f 100644 --- a/src/gui/treelog.cpp +++ b/src/gui/treelog.cpp @@ -42,7 +42,7 @@ TreeLog::TreeLog(QWidget* parent) : setupUi(this); } -void TreeLog::onNewLogMessage(log::Level logLevel, const QString& s) +void TreeLog::onNewLogMessage(Log::Level logLevel, const QString& s) { static const char* icons[] = { diff --git a/src/gui/treelog.h b/src/gui/treelog.h index c6bfab0..18bcb09 100644 --- a/src/gui/treelog.h +++ b/src/gui/treelog.h @@ -50,7 +50,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT TreeLog: public QWidget, public Ui::Tree void init(KActionCollection* coll, PartitionManagerWidget* pm_widget) { m_ActionCollection = coll; m_PartitionManagerWidget = pm_widget; } public slots: - void onNewLogMessage(log::Level logLevel, const QString& s); + void onNewLogMessage(Log::Level logLevel, const QString& s); protected: QTreeWidget& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; } diff --git a/src/kcm/partitionmanagerkcm.cpp b/src/kcm/partitionmanagerkcm.cpp index b869a62..bb30da8 100644 --- a/src/kcm/partitionmanagerkcm.cpp +++ b/src/kcm/partitionmanagerkcm.cpp @@ -49,7 +49,7 @@ PartitionManagerKCM::PartitionManagerKCM(QWidget* parent, const QVariantList&) : { setupUi(this); - connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), SLOT(onNewLogMessage(log::Level, const QString&))); + connect(GlobalLog::instance(), SIGNAL(newMessage(Log::Level, const QString&)), SLOT(onNewLogMessage(Log::Level, const QString&))); // workaround for https://bugs.launchpad.net/kdesudo/+bug/272427 unblockSigChild(); @@ -95,7 +95,7 @@ PartitionManagerKCM::PartitionManagerKCM(QWidget* parent, const QVariantList&) : setAboutData(createPartitionManagerAboutData()); } -void PartitionManagerKCM::onNewLogMessage(log::Level, const QString& s) +void PartitionManagerKCM::onNewLogMessage(Log::Level, const QString& s) { kDebug() << s; } diff --git a/src/kcm/partitionmanagerkcm.h b/src/kcm/partitionmanagerkcm.h index 08d01ae..da90e16 100644 --- a/src/kcm/partitionmanagerkcm.h +++ b/src/kcm/partitionmanagerkcm.h @@ -59,7 +59,7 @@ class PartitionManagerKCM : public KCModule, public Ui::PartitionManagerKCMBase KActionCollection* actionCollection() { return m_ActionCollection; } protected slots: - void onNewLogMessage(log::Level logLevel, const QString& s); + void onNewLogMessage(Log::Level logLevel, const QString& s); void onStatusChanged(); void onApplyClicked(); diff --git a/src/util/globallog.cpp b/src/util/globallog.cpp index c3008fa..519ecd5 100644 --- a/src/util/globallog.cpp +++ b/src/util/globallog.cpp @@ -29,7 +29,7 @@ GlobalLog* GlobalLog::instance() return p; } -void GlobalLog::flush(log::Level lev) +void GlobalLog::flush(Log::Level lev) { emit newMessage(lev, msg); msg.clear(); @@ -37,7 +37,7 @@ void GlobalLog::flush(log::Level lev) // -------------------------------------------------------------------------- -log::~log() +Log::~Log() { if (--ref == 0) GlobalLog::instance()->flush(level); diff --git a/src/util/globallog.h b/src/util/globallog.h index 1e4f5e3..2d3620c 100644 --- a/src/util/globallog.h +++ b/src/util/globallog.h @@ -27,7 +27,7 @@ #include #include -class log +class Log { public: enum Level @@ -39,9 +39,9 @@ class log }; public: - log(Level lev = information) : ref(1), level(lev) {} - ~log(); - log(const log& other) : ref(other.ref + 1), level(other.level) {} + Log(Level lev = information) : ref(1), level(lev) {} + ~Log(); + Log(const Log& other) : ref(other.ref + 1), level(other.level) {} private: quint32 ref; @@ -56,34 +56,34 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT GlobalLog : public QObject Q_OBJECT Q_DISABLE_COPY(GlobalLog) - friend class log; - friend log operator<<(log l, const QString& s); - friend log operator<<(log l, qint64 i); + friend class Log; + friend Log operator<<(Log l, const QString& s); + friend Log operator<<(Log l, qint64 i); private: GlobalLog() : msg() {} signals: - void newMessage(log::Level, const QString&); + void newMessage(Log::Level, const QString&); public: static GlobalLog* instance(); private: void append(const QString& s) { msg += s; } - void flush(log::Level level); + void flush(Log::Level level); private: QString msg; }; -inline log operator<<(log l, const QString& s) +inline Log operator<<(Log l, const QString& s) { GlobalLog::instance()->append(s); return l; } -inline log operator<<(log l, qint64 i) +inline Log operator<<(Log l, qint64 i) { GlobalLog::instance()->append(QString::number(i)); return l; diff --git a/src/util/helpers.cpp b/src/util/helpers.cpp index 105f3d5..00f2028 100644 --- a/src/util/helpers.cpp +++ b/src/util/helpers.cpp @@ -41,7 +41,7 @@ void registerMetaTypes() { qRegisterMetaType("Operation*"); - qRegisterMetaType("log::Level"); + qRegisterMetaType("log::Level"); } void unblockSigChild()