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

Merge branch 'master' of https://github.com/sudden6/qTox into proxy_everything

This commit is contained in:
sudden6 2016-01-21 01:49:25 +01:00
commit 98f49c4494
20 changed files with 313 additions and 206 deletions

18
OSX-Migrater.sh Executable file
View File

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

View File

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

View File

@ -1,102 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>qtox.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>qtox</string>
<key>CFBundleDisplayName</key>
<string>qTox</string>
<key>CFBundleName</key>
<string>qTox</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0-EXPERIMENTIAL</string>
<key>CFBundleIdentifier</key>
<string>chat.tox.qtox</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Tox URL</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tox</string>
</array>
<key>CFBundleURLIconFile</key>
<string>qtox_profile.icns</string>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tox</string>
</array>
<key>CFBundleTypeName</key>
<string>Tox profile</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>qtox_profile.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/x-tox.profile</string>
</array>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.tox</string>
</array>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>public.tox</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>TOX</string>
<key>public.filename-extension</key>
<array>
<string>tox</string>
</array>
<key>public.mime-type</key>
<string>tox/x-profile</string>
</dict>
</dict>
</array>
<key>CFBundleLocalizations</key>
<array>
<string>en_US</string>
<string>en</string>
<string>bg_BG</string>
<string>de_DE</string>
<string>fi_FI</string>
<string>fr_FR</string>
<string>it_IT</string>
<string>pl_PL</string>
<string>ru_RU</string>
<string>uk_UA</string>
<string>sv</string>
</array>
</dict>
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>qtox.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>toxq</string>
<key>CFBundleExecutable</key>
<string>qtox</string>
<key>CFBundleDisplayName</key>
<string>qTox</string>
<key>CFBundleName</key>
<string>qTox</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleIdentifier</key>
<string>chat.tox.qtox</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Tox URL</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tox</string>
</array>
<key>CFBundleURLIconFile</key>
<string>qtox_profile</string>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tox</string>
</array>
<key>CFBundleTypeName</key>
<string>Tox profile</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>qtox_profile</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/x-tox.profile</string>
</array>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.tox</string>
</array>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>public.tox</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>TOX</string>
<key>public.filename-extension</key>
<array>
<string>tox</string>
</array>
<key>public.mime-type</key>
<string>tox/x-profile</string>
</dict>
</dict>
</array>
<key>CFBundleLocalizations</key>
<array>
<string>en_US</string>
<string>bg_BG</string>
<string>cs</string>
<string>de_DE</string>
<string>el</string>
<string>es_MX</string>
<string>fi_FI</string>
<string>fr_FR</string>
<string>hr_HR</string>
<string>hu_HU</string>
<string>it_IT</string>
<string>lt_LT</string>
<string>nl_NL</string>
<string>nb_NO</string>
<string>pl_PL</string>
<string>pt_BR</string>
<string>ru_RU</string>
<string>sl</string>
<string>sv</string>
<string>tr_TR</string>
<string>uk_UA</string>
<string>zh_CH</string>
</array>
</dict>
</plist>

View File

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

View File

@ -38,7 +38,7 @@
#include <sodium.h>
#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");

View File

@ -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);
}

View File

@ -82,7 +82,8 @@ void OfflineMsgEngine::deliverOfflineMsgs()
return;
QMap<int64_t, MsgPtr> 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();
}

View File

@ -43,7 +43,7 @@ public:
public slots:
void deliverOfflineMsgs();
void removeAllReciepts();
void removeAllReceipts();
private:
struct MsgPtr {

View File

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

View File

@ -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<uint8_t>(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<groups.size(); i++)
qDebug()<<"Group"<<i<<"is"<<groups[i];
for (int i=0; i<arrays.size(); i++)
qDebug()<<"Array"<<i<<"size"<<arrays[i].size<<arrays[i].values.size()<<"of group"<<arrays[i].group<<"is"<<arrays[i].name;
for (int i=0; i<values.size(); i++)
qDebug()<<"Value"<<i<<"of group"<<values[i].group<<"array"<<values[i].array<<values[i].arrayIndex<<"key"<<values[i].key;
*/
}
void SettingsSerializer::save()
@ -244,9 +235,8 @@ void SettingsSerializer::save()
// Save the group name, if any
if (g!=-1)
{
stream << RecordTag::GroupStart;
stream << groups[g].toUtf8();
//qDebug()<<"#Group"<<groups[g];
writeStream(stream, RecordTag::GroupStart);
writeStream(stream, groups[g].toUtf8());
}
// Save all the arrays of this group
@ -256,19 +246,18 @@ void SettingsSerializer::save()
continue;
if (a.size <= 0)
continue;
stream << RecordTag::ArrayStart;
stream << a.name.toUtf8();
stream << vuintToData(a.size);
//qDebug()<<"#array start"<<a.name<<a.size;
writeStream(stream, RecordTag::ArrayStart);
writeStream(stream, a.name.toUtf8());
writeStream(stream, vuintToData(a.size));
for (uint64_t vi : a.values)
{
stream << RecordTag::ArrayValue;
stream << vuintToData(values[vi].arrayIndex);
stream << values[vi].key.toUtf8();
writeStream(stream, RecordTag::ArrayValue);
writeStream(stream, vuintToData(values[vi].arrayIndex));
writeStream(stream, values[vi].key.toUtf8());
writePackedVariant(stream, values[vi].value);
//qDebug()<<"#key (in array)"<<values[vi].key;
}
stream << RecordTag::ArrayEnd;
writeStream(stream, RecordTag::ArrayEnd);
}
// Save all the values of this group that aren't in an array
@ -276,10 +265,9 @@ void SettingsSerializer::save()
{
if (v.group != g || v.array != -1)
continue;
stream << RecordTag::Value;
stream << v.key.toUtf8();
writeStream(stream, RecordTag::Value);
writeStream(stream, v.key.toUtf8());
writePackedVariant(stream, v.value);
//qDebug()<<"#key (standalone)"<<v.key;
}
}
@ -347,30 +335,28 @@ void SettingsSerializer::readSerialized()
while (!stream.atEnd())
{
RecordTag tag;
stream >> 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"<<key;
}
else if (tag == RecordTag::GroupStart)
{
QByteArray prefix;
stream >> prefix;
readStream(stream, prefix);
beginGroup(QString::fromUtf8(prefix));
//qDebug()<<"!Group start"<<prefix;
}
else if (tag == RecordTag::ArrayStart)
{
QByteArray prefix;
stream >> 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"<<prefix;
}
else if (tag == RecordTag::ArrayValue)
{
QByteArray indexData;
stream >> 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"<<key<<"index"<<index;
}
else if (tag == RecordTag::ArrayEnd)
{
endArray();
//qDebug() <<"!Array end";
}
}
@ -577,9 +560,9 @@ void SettingsSerializer::writePackedVariant(QDataStream& stream, const QVariant&
assert(v.canConvert(QVariant::String));
QString str = v.toString();
if (str == "true")
stream << QString("1");
writeStream(stream, QString("1"));
else if (str == "false")
stream << QString("0");
writeStream(stream, QString("0"));
else
stream << str.toUtf8();
writeStream(stream, str.toUtf8());
}

View File

@ -66,8 +66,8 @@ private:
/// Not followed by any data
ArrayEnd=4,
};
friend QDataStream& operator<<(QDataStream& dataStream, const SettingsSerializer::RecordTag& tag);
friend QDataStream& operator>>(QDataStream& dataStream, SettingsSerializer::RecordTag& tag);
friend QDataStream& writeStream(QDataStream& dataStream, const SettingsSerializer::RecordTag& tag);
friend QDataStream& readStream(QDataStream& dataStream, SettingsSerializer::RecordTag& tag);
struct Value
{

View File

@ -19,16 +19,38 @@
#if defined(__APPLE__) && defined(__MACH__)
#include "src/platform/autorun.h"
#include <QSettings>
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QCoreApplication>
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__)

View File

@ -24,6 +24,8 @@
#include <QDebug>
#include <QProcess>
#include <QDir>
#include <QFileInfo>
#include <QStandardPaths>
#include <unistd.h>
@ -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

View File

@ -21,7 +21,7 @@
#include <QtCore/qsystemdetection.h>
#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

View File

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

View File

@ -32,6 +32,22 @@ VideoFrame::VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void
frameOther{nullptr}, frameYUV420{nullptr}, frameRGB24{nullptr},
width{w}, height{h}, pixFmt{fmt}
{
// Silences pointless swscale warning spam
// See libswscale/utils.c:1153 @ 74f0bd3
frame->color_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)

View File

@ -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;

View File

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

View File

@ -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("");
}
}

View File

@ -1848,7 +1848,7 @@ void Widget::clearAllReceipts()
{
QList<Friend*> frnds = FriendList::getAllFriends();
for (Friend *f : frnds)
f->getChatForm()->getOfflineMsgEngine()->removeAllReciepts();
f->getChatForm()->getOfflineMsgEngine()->removeAllReceipts();
}
void Widget::reloadTheme()