diff --git a/OSX-Migrater.sh b/OSX-Migrater.sh new file mode 100755 index 000000000..891fd6e9c --- /dev/null +++ b/OSX-Migrater.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# A qTox profile migrater for OSX +now=$(date +"%m_%d_%Y-%H.%M.%S") +bak="~/.Tox-Backup-$now" + +echo "Figuring out if action is required ..." +if [ -d ~/Library/Preferences/tox ]; then + echo "Moving profile(s) ..." + cp -r ~/Library/Preferences/tox ~/Library/Application\ Support/ + mv ~/Library/Application\ Support/tox/ ~/Library/Application\ Support/Tox + mv ~/Library/Preferences/tox ~/.Tox-Backup-$now + echo "Done! You profile(s) have been moved! A back up coppy still exists at:" + echo "$bak" +else + echo "Cannot locate old profile directory, profile migration not performed" +fi +exit 0 \ No newline at end of file diff --git a/doc/user_manual_en.md b/doc/user_manual_en.md index bcb7ed34b..98736115f 100644 --- a/doc/user_manual_en.md +++ b/doc/user_manual_en.md @@ -12,24 +12,24 @@ Your User Profile contains everything you share with other people on Tox. You ca ### Public Information * _Name:_ This is your nickname which everyone who has your Tox ID can see. -* _Status:_ You can post a status message here, which again everyone on who has your ToxID can see. +* _Status:_ You can post a status message here, which again everyone on who has your Tox ID can see. ### Tox ID The long code in hexadecimal format is your Tox ID, share this with everyone you want to talk to. Click it to copy it to your clipboard. -Your Tox ID is also shown as QR-Code to easily share it with friends over a smartphone. +Your Tox ID is also shown as QR code to easily share it with friends over a smartphone. -The "Save image" button saves the QR-Code into a image file, while the "Copy image" button copies into your clipboard. +The "Save image" button saves the QR code into a image file, while the "Copy image" button copies into your clipboard. ### Profile qTox allows you to use multiple Tox IDs with different profiles, each of which can have different nicknames, status messages and friends. + _Current profile:_ Shows the filename which stores your information. -+ _Current profile locatation:_ Shows the path to the profile file. ++ _Current profile location:_ Shows the path to the profile file. + _Rename:_ Allows you to rename your profile. Your nickname and profile name don't have to be the same. + _Delete:_ Deletes your profile and the corresponding chat history. -+ _Export:_ Allows you to export your profile in a format compatible with other Tox clients. You can also manually back up your *.tox files. ++ _Export:_ Allows you to export your profile in a format compatible with other Tox clients. You can also manually back up your \*.tox files. + _Logout:_ Close your current profile and show the login window. + _Remove password:_ Removes the existing password for your profile. If the profile already has no password, you will be notified. + _Change password:_ Allows you to either change an existing password, or create a new password if your profile does not have one. @@ -39,13 +39,13 @@ qTox allows you to use multiple Tox IDs with different profiles, each of which c #### General Settings * _Language:_ Changes which language the qTox interface uses. -* _Autostart:_ If set, qTox will start when you login on your computer. qTox will also autmatically open the profile which was active when you ticked the checkbox, but this only works if your profile isn't encrypted (has no password set). +* _Autostart:_ If set, qTox will start when you login on your computer. qTox will also automatically open the profile which was active when you ticked the checkbox, but this only works if your profile isn't encrypted (has no password set). * _Light icon:_ If set, qTox will use a different icon, which is easier to see on black backgrounds. * _Show system tray icon:_ If set, qTox will show its icon in your system tray. * _Start in tray:_ On start, qTox will only show its tray icon and no window. * _Minimize to tray:_ The minimize button on the top right, will minimize qTox to its tray icon. There won't be a taskbar item. * _Auto away after (0 to disable):_ After the specified amount of time, qTox will set your status to "Away". A setting of 0 will never change your status. -* _Default directory to save files:_ Allows you to specify the default destination for incoming filetransfers. +* _Default directory to save files:_ Allows you to specify the default destination for incoming file transfers. * _Autoaccept files:_ If set, qTox will automatically accept file transfers and put them in the directory specified above. #### Chat @@ -61,7 +61,7 @@ qTox allows you to use multiple Tox IDs with different profiles, each of which c * _Open each chat in an individual window:_ If checked, a new window will be opened for every chat you open. If you manually grouped the chat into another window, the window which hosts the chat will be focused. #### Theme -* _Use emoticons:_ If enabled, qTox will replace smileys ( e.g. :-) ) with corresponding graphical emoticons. +* _Use emoticons:_ If enabled, qTox will replace smileys ( e.g. `:-)` ) with corresponding graphical emoticons. * _Smiley Pack:_ Allows you to choose from different sets of shipped emoticon styles. * _Emoticon size:_ Allows you to change the size of the emoticons. * _Style:_ Changes the appearance of qTox. @@ -78,50 +78,50 @@ Most users will want both options enabled, but if qTox negatively impacts your r * _Proxy type:_ If you want to use a proxy, set the type here. "None" disables the proxy. * _Address:_ If you use a proxy, enter the address here. * _Port:_ If you use a proxy, enter the port here. -* _Reconnect:_ Reconnect to the tox network, e.g. if you changed the proxy settings. +* _Reconnect:_ Reconnect to the Tox network, e.g. if you changed the proxy settings. ### Privacy * _Send typing notifications:_ If enabled, notify your chat partner when you are currently typing. -* _Keep chat history:_ If enabled, qTox will save your sent and recieved messages. Encrypt your profile, if you want to encrypt the chat history. +* _Keep chat history:_ If enabled, qTox will save your sent and received messages. Encrypt your profile, if you want to encrypt the chat history. #### NoSpam -NoSpam is a feature of Tox that prevents a malicious user from spamming you with friend requests. If you get spammed, enter or generate a new NoSpam value. This will alter your Tox ID. You don't need to tell your existing contacts your new Tox ID, but you have to tell new contacts your new Tox ID. Your Tox ID can be found in your [User Profile](#user-profile) +NoSpam is a feature of Tox that prevents a malicious user from spamming you with friend requests. If you get spammed, enter or generate a new NoSpam value. This will alter your Tox ID. You don't need to tell your existing contacts your new Tox ID, but you have to tell new contacts your new Tox ID. Your Tox ID can be found in your [User Profile](#user-profile). ### Audio/Video #### Audio Settings -* _Playback device:_ Select the device qTox should use for all audio output (notifications, calls,..). +* _Playback device:_ Select the device qTox should use for all audio output (notifications, calls, etc). * _Playback:_ Here you can adjust the playback volume to your needs. * _Capture device:_ Select the device qTox should use for audio input in calls. -* _Microphone:_ Set the input volume of your microphone with this slider. When you are talking normally, the displayed volume incidator should be in the green range. -* _Filter audio_ If enabled, qTox will try to remove noise and echo from your audio input. +* _Microphone:_ Set the input volume of your microphone with this slider. When you are talking normally, the displayed volume indicator should be in the green range. +* _Filter audio:_ If enabled, qTox will try to remove noise and echo from your audio input. #### Video Settings * _Video device:_ Select the video device qTox should use for video calls. "None" will show a dummy picture to your chat partner. "Desktop" will stream the content of your screen. -* _Resolution:_ You can select from the available resolutions and framerates here. Higher resolutions provide more quality, but if the bandwidth of your connection is low, the video may get choppy. +* _Resolution:_ You can select from the available resolutions and frame rates here. Higher resolutions provide more quality, but if the bandwidth of your connection is low, the video may get choppy. If you set up everything correctly, you should see the preview of your video device in the box below. -* _Rescan devices_ Use this button to search for newly attached devices, e.g. you plugged in a webcam. +* _Rescan devices:_ Use this button to search for newly attached devices, e.g. you plugged in a webcam. ### Advanced -* _Make Tox portable:_ If enabled, qTox will load/save user data from the working directory, instead of ``` ~/.config/tox/ ```. -* _Reset to default settings_ Use this button to revert any changes you made to the qTox settings. +* _Make Tox portable:_ If enabled, qTox will load/save user data from the working directory, instead of ` ~/.config/tox/ `. +* _Reset to default settings:_ Use this button to revert any changes you made to the qTox settings. ### About -* _Version_ Shows the version of qTox and the libraries it depends on. Please append this information to every bug report. -* _License_ Shows the license under which the code of qTox is available. -* _Authors_ Lists the people who developed this shiny piece of software. -* _Known Issues_ Links to our list of known issues and improvements. +* _Version:_ Shows the version of qTox and the libraries it depends on. Please append this information to every bug report. +* _License:_ Shows the license under which the code of qTox is available. +* _Authors:_ Lists the people who developed this shiny piece of software. +* _Known Issues:_ Links to our list of known issues and improvements. ## Groupchats -Groupchats are a way to talk with multiple friends at the same time, like when you are standing together in a group. To create a groupchat click the groupchat icon in the bottom left corner and set a name. Now you can invite your contacts by right-clicking on the contact and selecting "Invite to group". Currently, if the last person leaves the chat, it is closed and you have to create a new one. Videochats and filetransfers are currently unsupported in groupchats. +Groupchats are a way to talk with multiple friends at the same time, like when you are standing together in a group. To create a groupchat click the groupchat icon in the bottom left corner and set a name. Now you can invite your contacts by right-clicking on the contact and selecting "Invite to group". Currently, if the last person leaves the chat, it is closed and you have to create a new one. Videochats and file transfers are currently unsupported in groupchats. ## Multi Window Mode -In this mode, qTox will separate its main window into a single contact list and one or multiple chat windows, which allows you to have multiple conversations on your screen at the same time. Additionally you can manually group chats into a window by dragging and dropping them onto eachother. This mode can be activated and configured in [settings](#settings). +In this mode, qTox will separate its main window into a single contact list and one or multiple chat windows, which allows you to have multiple conversations on your screen at the same time. Additionally you can manually group chats into a window by dragging and dropping them onto each other. This mode can be activated and configured in [settings](#settings). ## Keyboard Shortcuts diff --git a/osx/info.plist b/osx/info.plist index a6ff7ab5d..f9b22ce8a 100644 --- a/osx/info.plist +++ b/osx/info.plist @@ -1,102 +1,113 @@ - - NSPrincipalClass - NSApplication - CFBundleIconFile - qtox.icns - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleExecutable - qtox - CFBundleDisplayName - qTox - CFBundleName - qTox - CFBundleVersion - 1.0.0 - CFBundleShortVersionString - 1.0.0-EXPERIMENTIAL - CFBundleIdentifier - chat.tox.qtox - CFBundleURLTypes - - - CFBundleURLName - Tox URL - CFBundleTypeRole - Viewer - CFBundleURLSchemes - - tox - - CFBundleURLIconFile - qtox_profile.icns - - - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - tox - - CFBundleTypeName - Tox profile - CFBundleTypeRole - Editor - CFBundleTypeIconFile - qtox_profile.icns - CFBundleTypeMIMETypes - - application/x-tox.profile - - LSHandlerRank - Owner - LSItemContentTypes - - public.tox - - - - UTImportedTypeDeclarations - - - UTTypeConformsTo - - public.data - - UTTypeIdentifier - public.tox - UTTypeTagSpecification - - com.apple.ostype - TOX - public.filename-extension - - tox - - public.mime-type - tox/x-profile - - - - CFBundleLocalizations - - en_US - en - bg_BG - de_DE - fi_FI - fr_FR - it_IT - pl_PL - ru_RU - uk_UA - sv - - + + NSPrincipalClass + NSApplication + CFBundleIconFile + qtox.icns + CFBundlePackageType + APPL + CFBundleSignature + toxq + CFBundleExecutable + qtox + CFBundleDisplayName + qTox + CFBundleName + qTox + CFBundleVersion + 1.2.2 + CFBundleShortVersionString + @SHORT_VERSION@ + CFBundleIdentifier + chat.tox.qtox + CFBundleURLTypes + + + CFBundleURLName + Tox URL + CFBundleTypeRole + Viewer + CFBundleURLSchemes + + tox + + CFBundleURLIconFile + qtox_profile + + + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + tox + + CFBundleTypeName + Tox profile + CFBundleTypeRole + Editor + CFBundleTypeIconFile + qtox_profile + CFBundleTypeMIMETypes + + application/x-tox.profile + + LSHandlerRank + Owner + LSItemContentTypes + + public.tox + + + + UTImportedTypeDeclarations + + + UTTypeConformsTo + + public.data + + UTTypeIdentifier + public.tox + UTTypeTagSpecification + + com.apple.ostype + TOX + public.filename-extension + + tox + + public.mime-type + tox/x-profile + + + + CFBundleLocalizations + + en_US + bg_BG + cs + de_DE + el + es_MX + fi_FI + fr_FR + hr_HR + hu_HU + it_IT + lt_LT + nl_NL + nb_NO + pl_PL + pt_BR + ru_RU + sl + sv + tr_TR + uk_UA + zh_CH + + diff --git a/qtox.pro b/qtox.pro index 84ffa9dc8..e73351388 100644 --- a/qtox.pro +++ b/qtox.pro @@ -164,6 +164,14 @@ win32 { LIBS += -lqrencode -lsqlcipher contains(DEFINES, QTOX_PLATFORM_EXT) { LIBS += -framework IOKit -framework CoreFoundation } contains(DEFINES, QTOX_FILTER_AUDIO) { LIBS += -lfilteraudio } + #Files to be includes into the qTox.app/Contents/Resources folder + #OSX-Migrater.sh part of migrateProfiles() compatabilty code + APP_RESOURCE.files = img/icons/qtox_profile.icns OSX-Migrater.sh + APP_RESOURCE.path = Contents/Resources + QMAKE_BUNDLE_DATA += APP_RESOURCE + #Dynamic versioning for Info.plist + INFO_PLIST_PATH = $$shell_quote($${OUT_PWD}/$${TARGET}.app/Contents/Info.plist) + QMAKE_POST_LINK += /usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $${GIT_DESCRIBE}\" $${INFO_PLIST_PATH} } else { android { LIBS += -ltoxcore -ltoxav -ltoxencryptsave -ltoxdns diff --git a/src/main.cpp b/src/main.cpp index 324dc418c..05abac6e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,7 +38,7 @@ #include -#if defined(Q_OS_MACX) && defined(QT_RELEASE) +#if defined(Q_OS_OSX) #include "platform/install_osx.h" #endif @@ -98,6 +98,11 @@ int main(int argc, char *argv[]) a.setOrganizationName("Tox"); a.setApplicationVersion("\nGit commit: " + QString(GIT_VERSION)); +#if defined(Q_OS_OSX) + //osx::moveToAppFolder(); TODO: Add setting to enable this feature. + osx::migrateProfiles(); +#endif + #ifdef HIGH_DPI a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); #endif @@ -143,10 +148,6 @@ int main(int argc, char *argv[]) qDebug() << "built on: " << __TIME__ << __DATE__ << "(" << TIMESTAMP << ")"; qDebug() << "commit: " << GIT_VERSION << "\n"; -#if defined(Q_OS_MACX) && defined(QT_RELEASE) - osx::moveToAppFolder(); -#endif - // Install Unicode 6.1 supporting font QFontDatabase::addApplicationFont("://DejaVuSans.ttf"); diff --git a/src/net/toxme.cpp b/src/net/toxme.cpp index 2bd175061..f1369b373 100644 --- a/src/net/toxme.cpp +++ b/src/net/toxme.cpp @@ -40,15 +40,18 @@ QByteArray Toxme::makeJsonRequest(QString url, QString json, QNetworkReply::Netw request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QNetworkReply* reply = netman.post(request,json.toUtf8()); - while (reply->isRunning()) { - error = reply->error(); - if (error) - break; - - reply->waitForReadyRead(100); + while (!reply->isFinished()) + { qApp->processEvents(); } + error = reply->error(); + if (error) + { + qWarning() << "makeJsonRequest: A network error occured:" << reply->errorString(); + return QByteArray(); + } + return reply->readAll(); } @@ -64,15 +67,18 @@ QByteArray Toxme::getServerPubkey(QString url, QNetworkReply::NetworkError &erro request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QNetworkReply* reply = netman.get(request); - while (reply->isRunning()) { - error = reply->error(); - if (error) - break; - - reply->waitForReadyRead(100); + while (!reply->isFinished()) + { qApp->processEvents(); } + error = reply->error(); + if (error) + { + qWarning() << "getServerPubkey: A network error occured:" << reply->errorString(); + return QByteArray(); + } + // Extract key static const QByteArray pattern{"key\":\""}; @@ -280,8 +286,6 @@ int Toxme::deleteAddress(QString server, ToxId id) QString apiUrl = server + "/api"; QNetworkReply::NetworkError error = QNetworkReply::NoError; QByteArray response = makeJsonRequest(apiUrl, prepareEncryptedJson(pubkeyUrl, 2, payload), error); - if (error != QNetworkReply::NoError) - return error; return extractError(response); } diff --git a/src/persistence/offlinemsgengine.cpp b/src/persistence/offlinemsgengine.cpp index 48e911cb0..65527946f 100644 --- a/src/persistence/offlinemsgengine.cpp +++ b/src/persistence/offlinemsgengine.cpp @@ -82,7 +82,8 @@ void OfflineMsgEngine::deliverOfflineMsgs() return; QMap msgs = undeliveredMsgs; - removeAllReciepts(); + removeAllReceipts(); + undeliveredMsgs.clear(); for (auto iter = msgs.begin(); iter != msgs.end(); ++iter) { @@ -105,10 +106,9 @@ void OfflineMsgEngine::deliverOfflineMsgs() } } -void OfflineMsgEngine::removeAllReciepts() +void OfflineMsgEngine::removeAllReceipts() { QMutexLocker ml(&mutex); receipts.clear(); - undeliveredMsgs.clear(); } diff --git a/src/persistence/offlinemsgengine.h b/src/persistence/offlinemsgengine.h index 386262a5c..933eb3f51 100644 --- a/src/persistence/offlinemsgengine.h +++ b/src/persistence/offlinemsgengine.h @@ -43,7 +43,7 @@ public: public slots: void deliverOfflineMsgs(); - void removeAllReciepts(); + void removeAllReceipts(); private: struct MsgPtr { diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 8cc592513..f7e575693 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -538,6 +538,9 @@ QString Settings::getSettingsDirPath() #ifdef Q_OS_WIN return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + "AppData" + QDir::separator() + "Roaming" + QDir::separator() + "tox")+QDir::separator(); +#elif defined(Q_OS_OSX) + return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + + "Library" + QDir::separator() + "Application Support" + QDir::separator() + "Tox")+QDir::separator(); #else return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QDir::separator() + "tox")+QDir::separator(); diff --git a/src/persistence/settingsserializer.cpp b/src/persistence/settingsserializer.cpp index 8aaf0e420..28eb5a8d8 100644 --- a/src/persistence/settingsserializer.cpp +++ b/src/persistence/settingsserializer.cpp @@ -31,17 +31,12 @@ using namespace std; const char SettingsSerializer::magic[] = {0x51,0x54,0x4F,0x58}; -inline QDataStream& operator<<(QDataStream& dataStream, const SettingsSerializer::RecordTag& tag) +QDataStream& writeStream(QDataStream& dataStream, const SettingsSerializer::RecordTag& tag) { return dataStream << static_cast(tag); } -inline QDataStream& operator<<(QDataStream& dataStream, const QString& str) -{ - return dataStream << str.toUtf8(); -} - -inline QDataStream& operator<<(QDataStream& dataStream, const QByteArray& data) +QDataStream& writeStream(QDataStream& dataStream, const QByteArray& data) { QByteArray size = vuintToData(data.size()); dataStream.writeRawData(size.data(), size.size()); @@ -49,12 +44,18 @@ inline QDataStream& operator<<(QDataStream& dataStream, const QByteArray& data) return dataStream; } -QDataStream& operator>>(QDataStream& dataStream, SettingsSerializer::RecordTag& tag) +QDataStream& writeStream(QDataStream& dataStream, const QString& str) +{ + return writeStream(dataStream, str.toUtf8()); +} + +QDataStream& readStream(QDataStream& dataStream, SettingsSerializer::RecordTag& tag) { return dataStream.operator >>((uint8_t&)tag); } -inline QDataStream& operator>>(QDataStream& dataStream, QByteArray& data) + +QDataStream& readStream(QDataStream& dataStream, QByteArray& data) { unsigned char num3; size_t num = 0; @@ -214,16 +215,6 @@ void SettingsSerializer::load() readSerialized(); else readIni(); - - /* Dump state for debugging - qDebug() << "SettingsSerializer data:"; - for (int i=0; i> tag; + readStream(stream, tag); if (tag == RecordTag::Value) { QByteArray key; QByteArray value; - stream >> key; - stream >> value; + readStream(stream, key); + readStream(stream, value); setValue(QString::fromUtf8(key), QVariant(QString::fromUtf8(value))); - //qDebug() << "!Got key"<> prefix; + readStream(stream, prefix); beginGroup(QString::fromUtf8(prefix)); - //qDebug()<<"!Group start"<> prefix; + readStream(stream, prefix); beginReadArray(QString::fromUtf8(prefix)); QByteArray sizeData; - stream >> sizeData; + readStream(stream, sizeData); if (sizeData.isEmpty()) { qWarning("The personal save file is corrupted!"); @@ -378,12 +364,11 @@ void SettingsSerializer::readSerialized() } quint64 size = dataToVUint(sizeData); arrays[array].size = max(size, arrays[array].size); - //qDebug()<<"!Array start"<> indexData; + readStream(stream, indexData); if (indexData.isEmpty()) { qWarning("The personal save file is corrupted!"); @@ -393,15 +378,13 @@ void SettingsSerializer::readSerialized() setArrayIndex(index); QByteArray key; QByteArray value; - stream >> key; - stream >> value; + readStream(stream, key); + readStream(stream, value); setValue(QString::fromUtf8(key), QVariant(QString::fromUtf8(value))); - //qDebug() << "!Got array key"<>(QDataStream& dataStream, SettingsSerializer::RecordTag& tag); + friend QDataStream& writeStream(QDataStream& dataStream, const SettingsSerializer::RecordTag& tag); + friend QDataStream& readStream(QDataStream& dataStream, SettingsSerializer::RecordTag& tag); struct Value { diff --git a/src/platform/autorun_osx.cpp b/src/platform/autorun_osx.cpp index 99362e236..62344d6ad 100644 --- a/src/platform/autorun_osx.cpp +++ b/src/platform/autorun_osx.cpp @@ -19,16 +19,38 @@ #if defined(__APPLE__) && defined(__MACH__) #include "src/platform/autorun.h" +#include +#include +#include +#include +#include +int state ; bool Platform::setAutorun(bool on) { - return false; + QString qtoxPlist = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + + "Library" + QDir::separator() + "LaunchAgents" + QDir::separator() + "chat.tox.qtox.autorun.plist"); + QString qtoxDir = QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + "qtox"); + QSettings autoRun(qtoxPlist, QSettings::NativeFormat); + 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; + } } bool Platform::getAutorun() { - return false; + return state; } #endif // defined(__APPLE__) && defined(__MACH__) diff --git a/src/platform/install_osx.cpp b/src/platform/install_osx.cpp index 4638a0168..a5a832bdd 100644 --- a/src/platform/install_osx.cpp +++ b/src/platform/install_osx.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include @@ -82,3 +84,36 @@ void osx::moveToAppFolder() } } } +// migrateProfiles() is compatabilty code that can be removed down the line when the time seems right. +void osx::migrateProfiles() +{ + QString oldPath = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + + "Library" + QDir::separator() + "Preferences" + QDir::separator() + "tox"); + QFileInfo checkDir(oldPath); + + QString newPath = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + + "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 + { + qDebug() << "OS X: Old settings directory not detected"; + } +} +// End migrateProfiles() compatibility code diff --git a/src/platform/install_osx.h b/src/platform/install_osx.h index 115fabd60..aaab8dde9 100644 --- a/src/platform/install_osx.h +++ b/src/platform/install_osx.h @@ -21,7 +21,7 @@ #include -#ifndef Q_OS_MACX +#ifndef Q_OS_OSX #error "This file is only meant to be compiled for Mac OSX targets" #endif @@ -31,6 +31,7 @@ namespace osx static constexpr int EXIT_UPDATE_MACX_FAIL = 216; void moveToAppFolder(); + void migrateProfiles(); } #endif // INSTALLOSX_H diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index 77a685b6e..f774bfb12 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -164,6 +164,7 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode) { av_dict_set(&options, "video_size", QString("%1x%2").arg(mode.width).arg(mode.height).toStdString().c_str(), 0); av_dict_set(&options, "framerate", QString().setNum(mode.FPS).toStdString().c_str(), 0); + av_dict_set(&options, "pixel_format", "mjpeg", 0); } #endif #ifdef Q_OS_OSX diff --git a/src/video/videoframe.cpp b/src/video/videoframe.cpp index 75c1d1d8a..427cfa8c8 100644 --- a/src/video/videoframe.cpp +++ b/src/video/videoframe.cpp @@ -32,6 +32,22 @@ VideoFrame::VideoFrame(AVFrame* frame, int w, int h, int fmt, std::functioncolor_range = AVCOL_RANGE_MPEG; + if (pixFmt == AV_PIX_FMT_YUVJ420P) + pixFmt = AV_PIX_FMT_YUV420P; + else if (pixFmt == AV_PIX_FMT_YUVJ411P) + pixFmt = AV_PIX_FMT_YUV411P; + else if (pixFmt == AV_PIX_FMT_YUVJ422P) + pixFmt = AV_PIX_FMT_YUV422P; + else if (pixFmt == AV_PIX_FMT_YUVJ444P) + pixFmt = AV_PIX_FMT_YUV444P; + else if (pixFmt == AV_PIX_FMT_YUVJ440P) + pixFmt = AV_PIX_FMT_YUV440P; + else + frame->color_range = AVCOL_RANGE_UNSPECIFIED; + if (pixFmt == AV_PIX_FMT_YUV420P) frameYUV420 = frame; else if (pixFmt == AV_PIX_FMT_RGB24) diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index ac970f844..50f9e8092 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -110,7 +110,7 @@ ChatForm::ChatForm(Friend* chatFriend) connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered); connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged); connect(core, &Core::fileSendFailed, this, &ChatForm::onFileSendFailed); - connect(this, &ChatForm::chatAreaCleared, getOfflineMsgEngine(), &OfflineMsgEngine::removeAllReciepts); + connect(this, &ChatForm::chatAreaCleared, getOfflineMsgEngine(), &OfflineMsgEngine::removeAllReceipts); connect(&typingTimer, &QTimer::timeout, this, [=]{ Core::getInstance()->sendTyping(f->getFriendID(), false); isTyping = false; diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index 8c88843ce..851c3057b 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -104,9 +104,6 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation())); bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun()); -#if defined(__APPLE__) && defined(__MACH__) - bodyUI->cbAutorun->setEnabled(false); -#endif bool showSystemTray = Settings::getInstance().getShowSystemTray(); diff --git a/src/widget/loginscreen.cpp b/src/widget/loginscreen.cpp index 29e12455b..d3ba80921 100644 --- a/src/widget/loginscreen.cpp +++ b/src/widget/loginscreen.cpp @@ -172,11 +172,18 @@ void LoginScreen::onLoginUsernameSelected(const QString &name) { ui->loginPasswordLabel->show(); ui->loginPassword->show(); + // there is no way to do autologin if profile is encrypted, and + // visible option confuses users into thinking that it is possible, + // thus disable it (and hope that users won't think that it's a bug) + ui->autoLoginCB->setEnabled(false); + ui->autoLoginCB->setToolTip(tr("Password protected profile can't be loaded automatically.")); } else { ui->loginPasswordLabel->hide(); ui->loginPassword->hide(); + ui->autoLoginCB->setEnabled(true); + ui->autoLoginCB->setToolTip(""); } } diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 0f92883e0..7501ab776 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1848,7 +1848,7 @@ void Widget::clearAllReceipts() { QList frnds = FriendList::getAllFriends(); for (Friend *f : frnds) - f->getChatForm()->getOfflineMsgEngine()->removeAllReciepts(); + f->getChatForm()->getOfflineMsgEngine()->removeAllReceipts(); } void Widget::reloadTheme()