Commit fe956941 authored by Christoph Pfister's avatar Christoph Pfister

cosmetics: break long lines

parent a37d17c8
......@@ -145,5 +145,6 @@ DmesgDialog::~DmesgDialog()
void DmesgDialog::readyRead()
{
dmesgTextEdit->setPlainText(dmesgTextEdit->toPlainText() + QString::fromLocal8Bit(dmesgProcess->readAll().constData()));
dmesgTextEdit->setPlainText(dmesgTextEdit->toPlainText() +
QString::fromLocal8Bit(dmesgProcess->readAll().constData()));
}
......@@ -120,8 +120,10 @@ DvbChannelModel *DvbChannelModel::createSqlModel(QObject *parent)
DvbChannelModel *channelModel = new DvbChannelModel(parent);
channelModel->isSqlModel = true;
channelModel->sqlInit(QLatin1String("Channels"),
QStringList() << QLatin1String("Name") << QLatin1String("Number") << QLatin1String("Source") << QLatin1String("Transponder") << QLatin1String("NetworkId") <<
QLatin1String("TransportStreamId") << QLatin1String("PmtPid") << QLatin1String("PmtSection") << QLatin1String("AudioPid") << QLatin1String("Flags"));
QStringList() << QLatin1String("Name") << QLatin1String("Number") << QLatin1String("Source") <<
QLatin1String("Transponder") << QLatin1String("NetworkId") << QLatin1String("TransportStreamId") <<
QLatin1String("PmtPid") << QLatin1String("PmtSection") << QLatin1String("AudioPid") <<
QLatin1String("Flags"));
// compatibility code
......
......@@ -914,16 +914,15 @@ void DvbLinuxDeviceManager::componentAdded(const QString &udi)
// PCI device
int vendor = readSysAttr(path + QLatin1String("device/vendor"));
int pciDevice = readSysAttr(path + QLatin1String("device/device"));
int subsystem_vendor = readSysAttr(path + QLatin1String("device/subsystem_vendor"));
int subsystem_device = readSysAttr(path + QLatin1String("device/subsystem_device"));
int subsystemVendor = readSysAttr(path + QLatin1String("device/subsystem_vendor"));
int subsystemDevice = readSysAttr(path + QLatin1String("device/subsystem_device"));
if ((vendor >= 0) && (pciDevice >= 0) && (subsystem_vendor >= 0) &&
(subsystem_device >= 0)) {
if ((vendor >= 0) && (pciDevice >= 0) && (subsystemVendor >= 0) && (subsystemDevice >= 0)) {
deviceId = QLatin1Char('P');
deviceId += QString(QLatin1String("%1")).arg(vendor, 4, 16, QLatin1Char('0'));
deviceId += QString(QLatin1String("%1")).arg(pciDevice, 4, 16, QLatin1Char('0'));
deviceId += QString(QLatin1String("%1")).arg(subsystem_vendor, 4, 16, QLatin1Char('0'));
deviceId += QString(QLatin1String("%1")).arg(subsystem_device, 4, 16, QLatin1Char('0'));
deviceId += QString(QLatin1String("%1")).arg(subsystemVendor, 4, 16, QLatin1Char('0'));
deviceId += QString(QLatin1String("%1")).arg(subsystemDevice, 4, 16, QLatin1Char('0'));
}
} else if (QFile::exists(path + QLatin1String("device/idVendor"))) {
// USB device
......
......@@ -433,14 +433,16 @@ void DvbLiveView::playbackStatusChanged(MediaWidget::PlaybackStatus playbackStat
}
internal->timeShiftFile.setFileName(manager->getTimeShiftFolder() + QLatin1String("/TimeShift-") +
QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddThhmmss")) + QLatin1String(".m2t"));
QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddThhmmss")) +
QLatin1String(".m2t"));
if (internal->timeShiftFile.exists() ||
!internal->timeShiftFile.open(QIODevice::WriteOnly)) {
Log("DvbLiveView::playbackStatusChanged: cannot open file") <<
internal->timeShiftFile.fileName();
internal->timeShiftFile.setFileName(QDir::homePath() + QLatin1String("/TimeShift-") +
QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddThhmmss")) + QLatin1String(".m2t"));
QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddThhmmss")) +
QLatin1String(".m2t"));
if (internal->timeShiftFile.exists() ||
!internal->timeShiftFile.open(QIODevice::WriteOnly)) {
......
......@@ -48,7 +48,8 @@ DvbRecordingModel::DvbRecordingModel(DvbManager *manager_, QObject *parent) : QO
manager(manager_), hasPendingOperation(false)
{
sqlInit(QLatin1String("RecordingSchedule"),
QStringList() << QLatin1String("Name") << QLatin1String("Channel") << QLatin1String("Begin") << QLatin1String("Duration") << QLatin1String("Repeat"));
QStringList() << QLatin1String("Name") << QLatin1String("Channel") << QLatin1String("Begin") <<
QLatin1String("Duration") << QLatin1String("Repeat"));
// we regularly recheck the status of the recordings
// this way we can keep retrying if the device was busy / tuning failed
......@@ -351,13 +352,15 @@ bool DvbRecordingFile::start(const DvbRecording &recording)
{
if (!file.isOpen()) {
QString folder = manager->getRecordingFolder();
QString path = folder + QLatin1Char('/') + QString(recording.name).replace(QLatin1Char('/'), QLatin1Char('_'));
QString path = folder + QLatin1Char('/') +
QString(recording.name).replace(QLatin1Char('/'), QLatin1Char('_'));
for (int attempt = 0; attempt < 100; ++attempt) {
if (attempt == 0) {
file.setFileName(path + QLatin1String(".m2t"));
} else {
file.setFileName(path + QLatin1Char('-') + QString::number(attempt) + QLatin1String(".m2t"));
file.setFileName(path + QLatin1Char('-') + QString::number(attempt) +
QLatin1String(".m2t"));
}
if (file.exists()) {
......@@ -383,7 +386,8 @@ bool DvbRecordingFile::start(const DvbRecording &recording)
if (folder != QDir::homePath()) {
folder = QDir::homePath();
path = folder + QLatin1Char('/') + QString(recording.name).replace(QLatin1Char('/'), QLatin1Char('_'));
path = folder + QLatin1Char('/') +
QString(recording.name).replace(QLatin1Char('/'), QLatin1Char('_'));
attempt = -1;
continue;
}
......
......@@ -30,8 +30,7 @@ void DvbSection::initSection(const char *data, int size)
return;
}
int sectionLength = ((((static_cast<unsigned char>(data[1]) & 0xf) << 8) |
static_cast<unsigned char>(data[2])) + 3);
int sectionLength = ((((quint8(data[1]) & 0xf) << 8) | quint8(data[2])) + 3);
if (sectionLength > size) {
Log("DvbSection::initSection: adjusting length");
......@@ -46,8 +45,7 @@ int DvbStandardSection::verifyCrc32(const char *data, int size)
unsigned int crc32 = 0xffffffff;
for (int i = 0; i < size; ++i) {
crc32 = ((crc32 << 8) ^
crc32Table[(crc32 >> 24) ^ static_cast<unsigned char>(data[i])]);
crc32 = ((crc32 << 8) ^ crc32Table[(crc32 >> 24) ^ quint8(data[i])]);
}
return crc32;
......@@ -175,7 +173,7 @@ public:
unsigned short diacriticalMark = 0;
for (; size > 0; ++input, --size) {
unsigned short value = table[static_cast<unsigned char>(*input)];
unsigned short value = table[quint8(*input)];
if (value == 0xffff) {
continue;
......@@ -246,7 +244,7 @@ QString DvbSiText::convertText(const char *data, int size)
// determine encoding
TextEncoding encoding = (override6937 ? Iso8859_1 : Iso6937);
if (static_cast<unsigned char>(data[0]) < 0x20) {
if (quint8(data[0]) < 0x20) {
switch (data[0]) {
case 0x01: encoding = Iso8859_5; break;
case 0x02: encoding = Iso8859_6; break;
......@@ -371,7 +369,7 @@ void DvbDescriptor::initDescriptor(const char *data, int size)
return;
}
int descriptorLength = (static_cast<unsigned char>(data[1]) + 2);
int descriptorLength = (quint8(data[1]) + 2);
if (descriptorLength > size) {
Log("DvbDescriptor::initDescriptor: adjusting length");
......@@ -421,7 +419,7 @@ QString AtscPsipText::convertText(const char *data, int size)
return QString();
}
unsigned int num_strings = static_cast<unsigned char>(data[0]);
unsigned int num_strings = quint8(data[0]);
if (num_strings == 0) {
return result;
......@@ -439,7 +437,7 @@ QString AtscPsipText::convertText(const char *data, int size)
return result;
}
int num_segments = static_cast<unsigned char>(data[offset++]);
int num_segments = quint8(data[offset++]);
for (int j = 0; j < num_segments; j++) {
if ((offset + 3) > size) {
......@@ -447,9 +445,9 @@ QString AtscPsipText::convertText(const char *data, int size)
return result;
}
int comp_type = static_cast<unsigned char>(data[offset++]);
int mode = static_cast<unsigned char>(data[offset++]);
int num_bytes = static_cast<unsigned char>(data[offset++]);
int comp_type = quint8(data[offset++]);
int mode = quint8(data[offset++]);
int num_bytes = quint8(data[offset++]);
if ((offset + num_bytes) > size) {
Log("AtscPsipText::convertText: adjusting length");
......@@ -1275,7 +1273,7 @@ void AtscEitSectionEntry::initEitSectionEntry(const char *data, int size)
return;
}
titleLength = static_cast<unsigned char>(data[9]);
titleLength = quint8(data[9]);
if (titleLength > (size - 12)) {
Log("AtscEitSectionEntry::initEitSectionEntry: adjusting length");
......@@ -1283,8 +1281,8 @@ void AtscEitSectionEntry::initEitSectionEntry(const char *data, int size)
}
// too ugly to be automatically generated
int entryLength = ((((static_cast<unsigned char>(data[10 + titleLength]) & 0xf) << 8) |
static_cast<unsigned char>(data[11 + titleLength])) + 12 + titleLength);
int entryLength = ((((quint8(data[10 + titleLength]) & 0xf) << 8) |
quint8(data[11 + titleLength])) + 12 + titleLength);
if (entryLength > size) {
Log("AtscEitSectionEntry::initEitSectionEntry: adjusting length");
......@@ -1444,7 +1442,7 @@ void DvbPmtSectionEntry::initPmtSectionEntry(const char *data, int size)
return;
}
int entryLength = ((((static_cast<unsigned char>(data[3]) & 0xf) << 8) | static_cast<unsigned char>(data[4])) + 5);
int entryLength = ((((quint8(data[3]) & 0xf) << 8) | quint8(data[4])) + 5);
if (entryLength > size) {
Log("DvbPmtSectionEntry::initPmtSectionEntry: adjusting length");
......@@ -1465,7 +1463,7 @@ void DvbSdtSectionEntry::initSdtSectionEntry(const char *data, int size)
return;
}
int entryLength = ((((static_cast<unsigned char>(data[3]) & 0xf) << 8) | static_cast<unsigned char>(data[4])) + 5);
int entryLength = ((((quint8(data[3]) & 0xf) << 8) | quint8(data[4])) + 5);
if (entryLength > size) {
Log("DvbSdtSectionEntry::initSdtSectionEntry: adjusting length");
......@@ -1486,7 +1484,7 @@ void DvbEitSectionEntry::initEitSectionEntry(const char *data, int size)
return;
}
int entryLength = ((((static_cast<unsigned char>(data[10]) & 0xf) << 8) | static_cast<unsigned char>(data[11])) + 12);
int entryLength = ((((quint8(data[10]) & 0xf) << 8) | quint8(data[11])) + 12);
if (entryLength > size) {
Log("DvbEitSectionEntry::initEitSectionEntry: adjusting length");
......@@ -1507,7 +1505,7 @@ void DvbNitSectionEntry::initNitSectionEntry(const char *data, int size)
return;
}
int entryLength = ((((static_cast<unsigned char>(data[4]) & 0xf) << 8) | static_cast<unsigned char>(data[5])) + 6);
int entryLength = ((((quint8(data[4]) & 0xf) << 8) | quint8(data[5])) + 6);
if (entryLength > size) {
Log("DvbNitSectionEntry::initNitSectionEntry: adjusting length");
......@@ -1528,7 +1526,7 @@ void AtscMgtSectionEntry::initMgtSectionEntry(const char *data, int size)
return;
}
int entryLength = ((((static_cast<unsigned char>(data[9]) & 0xf) << 8) | static_cast<unsigned char>(data[10])) + 11);
int entryLength = ((((quint8(data[9]) & 0xf) << 8) | quint8(data[10])) + 11);
if (entryLength > size) {
Log("AtscMgtSectionEntry::initMgtSectionEntry: adjusting length");
......@@ -1549,7 +1547,7 @@ void AtscVctSectionEntry::initVctSectionEntry(const char *data, int size)
return;
}
int entryLength = ((((static_cast<unsigned char>(data[30]) & 0x3) << 8) | static_cast<unsigned char>(data[31])) + 32);
int entryLength = ((((quint8(data[30]) & 0x3) << 8) | quint8(data[31])) + 32);
if (entryLength > size) {
Log("AtscVctSectionEntry::initVctSectionEntry: adjusting length");
......
......@@ -624,7 +624,8 @@ void MediaWidget::checkScreenSaver()
QLatin1String("SimulateUserActivity"));
// GNOME - Inhibit doesn't inhibit power management functions
QDBusInterface(QLatin1String("org.gnome.ScreenSaver"), QLatin1String("/"), QLatin1String("org.gnome.ScreenSaver")).
QDBusInterface(QLatin1String("org.gnome.ScreenSaver"), QLatin1String("/"),
QLatin1String("org.gnome.ScreenSaver")).
call(QDBus::NoBlock, QLatin1String("SimulateUserActivity"));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment