Browse Source

style(platform): Style fixes

pull/3495/head
Diadlo 9 years ago
parent
commit
9471065feb
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 12
      src/platform/autorun_osx.cpp
  2. 9
      src/platform/camera/v4l2.cpp
  3. 31
      src/platform/install_osx.cpp

12
src/platform/autorun_osx.cpp

@ -36,16 +36,8 @@ bool Platform::setAutorun(bool on) @@ -36,16 +36,8 @@ bool Platform::setAutorun(bool on)
autoRun.setValue("Label","chat.tox.qtox.autorun");
autoRun.setValue("Program", qtoxDir);
if (on)
{
autoRun.setValue("RunAtLoad",true);
state = true;
}
else
{
autoRun.setValue("RunAtLoad",false);
state = false;
}
state = on;
autoRun.setValue("RunAtLoad", state);
}
bool Platform::getAutorun()

9
src/platform/camera/v4l2.cpp

@ -97,7 +97,7 @@ static QVector<unsigned short> getDeviceModeFramerates(int fd, unsigned w, unsig @@ -97,7 +97,7 @@ static QVector<unsigned short> getDeviceModeFramerates(int fd, unsigned w, unsig
vfve.height = h;
vfve.width = w;
while(!ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &vfve)) {
while (!ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &vfve)) {
int rate;
switch (vfve.type) {
case V4L2_FRMSIZE_TYPE_DISCRETE:
@ -128,13 +128,15 @@ QVector<VideoMode> v4l2::getDeviceModes(QString devName) @@ -128,13 +128,15 @@ QVector<VideoMode> v4l2::getDeviceModes(QString devName)
v4l2_fmtdesc vfd{};
vfd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
while(!ioctl(fd, VIDIOC_ENUM_FMT, &vfd)) {
while (!ioctl(fd, VIDIOC_ENUM_FMT, &vfd))
{
vfd.index++;
v4l2_frmsizeenum vfse{};
vfse.pixel_format = vfd.pixelformat;
while(!ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &vfse)) {
while (!ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &vfse))
{
VideoMode mode;
mode.pixel_format = vfse.pixel_format;
switch (vfse.type) {
@ -150,6 +152,7 @@ QVector<VideoMode> v4l2::getDeviceModes(QString devName) @@ -150,6 +152,7 @@ QVector<VideoMode> v4l2::getDeviceModes(QString devName)
default:
continue;
}
QVector<unsigned short> rates = getDeviceModeFramerates(fd, mode.width, mode.height, vfd.pixelformat);
for (unsigned short rate : rates)
{

31
src/platform/install_osx.cpp

@ -95,25 +95,24 @@ void osx::migrateProfiles() @@ -95,25 +95,24 @@ void osx::migrateProfiles()
+ "Library" + QDir::separator() + "Application Support" + QDir::separator() + "Tox");
QDir dir;
if (checkDir.exists() && checkDir.isDir())
if (!checkDir.exists() || !checkDir.isDir())
{
qDebug() << "OS X: Old settings directory detected migrating to default";
if( !dir.rename(oldPath, newPath) )
{
qDebug() << "OS X: Profile migration failed. ~/Library/Application Support/Tox already exists. Using alternate migration method.";
QString OSXMigrater = "../Resources/OSX-Migrater.sh" ;
QProcess::execute(OSXMigrater);
QMessageBox MigrateProfile;
MigrateProfile.setIcon(QMessageBox::Information);
MigrateProfile.setWindowModality(Qt::ApplicationModal);
MigrateProfile.setText("Alternate profile migration method used.");
MigrateProfile.setInformativeText("It has been detected that your profiles \nwhere migrated to the new settings directory; \nusing the alternate migration method. \n\nA backup can be found in your: \n/Users/[USER]/.Tox-Backup[DATE-TIME] \n\nJust in case. \r\n");
MigrateProfile.exec();
}
qDebug() << "OS X: Old settings directory not detected";
return;
}
else
qDebug() << "OS X: Old settings directory detected migrating to default";
if (!dir.rename(oldPath, newPath))
{
qDebug() << "OS X: Old settings directory not detected";
qDebug() << "OS X: Profile migration failed. ~/Library/Application Support/Tox already exists. Using alternate migration method.";
QString OSXMigrater = "../Resources/OSX-Migrater.sh" ;
QProcess::execute(OSXMigrater);
QMessageBox MigrateProfile;
MigrateProfile.setIcon(QMessageBox::Information);
MigrateProfile.setWindowModality(Qt::ApplicationModal);
MigrateProfile.setText("Alternate profile migration method used.");
MigrateProfile.setInformativeText("It has been detected that your profiles \nwhere migrated to the new settings directory; \nusing the alternate migration method. \n\nA backup can be found in your: \n/Users/[USER]/.Tox-Backup[DATE-TIME] \n\nJust in case. \r\n");
MigrateProfile.exec();
}
}
// End migrateProfiles() compatibility code

Loading…
Cancel
Save