1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

style(platform): Style fixes

This commit is contained in:
Diadlo 2016-07-07 13:10:41 +03:00
parent 20d3225f29
commit 9471065feb
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 24 additions and 30 deletions

View File

@ -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()

View File

@ -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)
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)
default:
continue;
}
QVector<unsigned short> rates = getDeviceModeFramerates(fd, mode.width, mode.height, vfd.pixelformat);
for (unsigned short rate : rates)
{

View File

@ -95,25 +95,24 @@ void osx::migrateProfiles()
+ "Library" + QDir::separator() + "Application Support" + QDir::separator() + "Tox");
QDir dir;
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();
}
}
else
if (!checkDir.exists() || !checkDir.isDir())
{
qDebug() << "OS X: Old settings directory not detected";
return;
}
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();
}
}
// End migrateProfiles() compatibility code