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
This commit is contained in:
parent
e66958e40b
commit
a6427ee3ce
|
@ -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<Solid::Block>();
|
||||
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());
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -245,7 +245,7 @@ bool PartitionTable::isSnapped(const Device& d, const Partition& p)
|
|||
|
||||
if (delta)
|
||||
{
|
||||
log(log::warning) << i18nc("@info/plain", "Partition <filename>%1</filename> does not start at a cylinder boundary (first sector: %2, modulo: %3).", p.deviceNode(), p.firstSector(), delta);
|
||||
Log(Log::warning) << i18nc("@info/plain", "Partition <filename>%1</filename> 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 <filename>%1</filename> does not end at a cylinder boundary (last sector: %2, modulo: %3).", p.deviceNode(), p.lastSector(), delta);
|
||||
Log(Log::warning) << i18nc("@info/plain", "Partition <filename>%1</filename> 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
|
||||
|
|
|
@ -175,23 +175,23 @@ namespace FS
|
|||
QFile device(deviceNode);
|
||||
if (!device.open(QFile::ReadWrite | QFile::Unbuffered))
|
||||
{
|
||||
log() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> for writing when trying to update the NTFS boot sector.", deviceNode);
|
||||
Log() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> 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 <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
|
||||
Log() << i18nc("@info/plain", "Could not seek to position 0x1c on partition <filename>%1</filename> 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 <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
|
||||
Log() << i18nc("@info/plain", "Could not write new start sector to partition <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
|
||||
return false;
|
||||
}
|
||||
|
||||
log() << i18nc("@info/plain", "Updated NTFS boot sector for partition <filename>%1</filename> successfully.", deviceNode);
|
||||
Log() << i18nc("@info/plain", "Updated NTFS boot sector for partition <filename>%1</filename> successfully.", deviceNode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", selectedPartition()->deviceNode());
|
||||
Log(Log::information) << i18nc("@info/plain", "Partition <filename>%1</filename> 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 <filename>%1</filename> has been copied to the clipboard.", selectedPartition()->deviceNode());
|
||||
Log() << i18nc("@info/plain", "Partition <filename>%1</filename> 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();
|
||||
|
||||
|
|
|
@ -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[] =
|
||||
{
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <QObject>
|
||||
#include <qglobal.h>
|
||||
|
||||
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;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
void registerMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<Operation*>("Operation*");
|
||||
qRegisterMetaType<log::Level>("log::Level");
|
||||
qRegisterMetaType<Log::Level>("log::Level");
|
||||
}
|
||||
|
||||
void unblockSigChild()
|
||||
|
|
Loading…
Reference in New Issue