From aff0f915d0ea6df1608f785da9476c81c88de7ca Mon Sep 17 00:00:00 2001 From: dubslow Date: Fri, 26 Sep 2014 17:04:01 -0500 Subject: [PATCH 1/7] incomplete os x instructions --- INSTALL.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index b5b2d5f11..9f4738b12 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -69,7 +69,7 @@ make install Copy the dll "OpenAL32.dll" located at "C:\qTox\libs\openal-build\install\bin" to "C:\qTox\libs\lib". Finally, copy the directory "AL" located at "C:\qTox\libs\openal-build\install\include" to "C:\qTox\libs\include". Unlike OpenCV you don't need to patch any files. Feel free to delete the directories "openal-soft-x.y.z" and "openal-build", but you don't need to. ##Linux -Most of the dependencies should be available through your package manger. +Most of the dependencies should be available through your package manger. You may either follow the directions below, or simply run `./simple_make.sh` which will attempt to automatically download dependencies. ###Cloning the Repository In order to clone the qTox repository you need Git. @@ -164,3 +164,59 @@ form natively, and .rpm form with alien< After installing the required dependencies, run `bootstrap.sh` and then run the `buildPackages.sh` script, found in the tools folder. It will automatically get the packages necessary for building .debs, so be prepared to type your password for sudo. + +##OS X + +###OSX Easy Install + +Since https://github.com/ReDetection/homebrew-qtox you can easily install qtox with homebrew +```bash +brew install --HEAD ReDetection/qtox/qtox +``` + +###OSX Full Install Guide + +This guide is intended for people who wish to use an existing or new ProjectTox-Core installation separate to the bundled installation with qTox, if you do not wish to use a separate installation you can skip to the section titled 'Final Steps'. + +Installation on OSX, isn't quite straight forward, here is a quick guide on how to install; + +The first thing you need to do is install ProjectTox-Core with a/v support. Refer to the INSTALL guide in the PrjectTox-Core github repo. + +Next you need to download QtTools (http://qt-project.org/downloads), at the time of writing this is at version .3.0. +Make sure you deselect all the unnecessary components from the 5.3 checkbox (iOS/Android libs) otherwise you will end up with a very large download. + +Once that is installed you will most likely need to set the path for qmake. To do this, open up terminal and paste in the following; + +```bash +export PATH=/location/to/qmake/binary:$PATH +``` + +For myself, the qmake binary was located in /Users/mouseym/Qt/5.3/clang_64/bin/. + +This is not a permanent change, it will revert when you close the terminal window, to add it permanently you will need to add echo the above line to your .profile/.bash_profile. + +Once this is installed, do the following; + +```bash +git clone https://github.com/tux3/qTox +cd toxgui +qmake +``` + +Now, we need to create a symlink to /usr/local/lib/ and /usr/local/include/ +``` +mkdir -p $HOME/qTox/libs +sudo ln -s /usr/local/lib $HOME/qTox/libs/lib +sudo ln -s /usr/local/include $HOME/qTox/libs/include +``` +####Final Steps + +The final step is to run +```bash +make +``` +in the qTox directory, or if you are using the bundled tox core installation, you can use +```bash +./bootstrap.sh +``` +Assuming all went well you should now have a qTox.app file within the directory. Double click and it should open! From 8bc439decc4f9833fbaad47f56fd61865b1cebfd Mon Sep 17 00:00:00 2001 From: dubslow Date: Fri, 26 Sep 2014 17:06:33 -0500 Subject: [PATCH 2/7] minor fixes --- INSTALL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 9f4738b12..74fdc2683 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -156,7 +156,7 @@ cd /home/user/qTox ./bootstrap.sh # use -h or --help for more information ``` -##Building packages +###Building packages qTox now has the experimental and probably-dodgy ability to package itself (in .deb form natively, and .rpm form with alien). @@ -180,6 +180,8 @@ This guide is intended for people who wish to use an existing or new ProjectTox- Installation on OSX, isn't quite straight forward, here is a quick guide on how to install; +Note that qTox now requires OpenCV and OpenAL for audio and video. + The first thing you need to do is install ProjectTox-Core with a/v support. Refer to the INSTALL guide in the PrjectTox-Core github repo. Next you need to download QtTools (http://qt-project.org/downloads), at the time of writing this is at version .3.0. From 25b2c76f4bdcec67deec576272520e877b6672b2 Mon Sep 17 00:00:00 2001 From: dubslow Date: Fri, 26 Sep 2014 17:11:13 -0500 Subject: [PATCH 3/7] minor fixes --- INSTALL.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 74fdc2683..3cb777597 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -69,7 +69,7 @@ make install Copy the dll "OpenAL32.dll" located at "C:\qTox\libs\openal-build\install\bin" to "C:\qTox\libs\lib". Finally, copy the directory "AL" located at "C:\qTox\libs\openal-build\install\include" to "C:\qTox\libs\include". Unlike OpenCV you don't need to patch any files. Feel free to delete the directories "openal-soft-x.y.z" and "openal-build", but you don't need to. ##Linux -Most of the dependencies should be available through your package manger. You may either follow the directions below, or simply run `./simple_make.sh` which will attempt to automatically download dependencies. +Most of the dependencies should be available through your package manger. You may either follow the directions below, or simply run `./simple_make.sh` after cloning, which will attempt to automatically download dependencies followed by compilation. ###Cloning the Repository In order to clone the qTox repository you need Git. @@ -156,9 +156,15 @@ cd /home/user/qTox ./bootstrap.sh # use -h or --help for more information ``` +After all the dependencies are thus reeady to go, compiling should be as simple as +```bash +qmake +make +``` + ###Building packages -qTox now has the experimental and probably-dodgy ability to package itself (in .deb +Alternately, qTox now has the experimental and probably-dodgy ability to package itself (in .deb form natively, and .rpm form with alien). After installing the required dependencies, run `bootstrap.sh` and then run the @@ -180,7 +186,7 @@ This guide is intended for people who wish to use an existing or new ProjectTox- Installation on OSX, isn't quite straight forward, here is a quick guide on how to install; -Note that qTox now requires OpenCV and OpenAL for audio and video. +Note that qTox now requires OpenCV and OpenAL for video and audio. The first thing you need to do is install ProjectTox-Core with a/v support. Refer to the INSTALL guide in the PrjectTox-Core github repo. @@ -220,5 +226,6 @@ make in the qTox directory, or if you are using the bundled tox core installation, you can use ```bash ./bootstrap.sh +make ``` Assuming all went well you should now have a qTox.app file within the directory. Double click and it should open! From 28d2680fec53bfd162999e003f2fa069221ea3b8 Mon Sep 17 00:00:00 2001 From: dubslow Date: Sat, 27 Sep 2014 16:37:39 -0500 Subject: [PATCH 4/7] conform to standard, fix bug related to nospam in ID --- core.cpp | 36 ++++++++++++++++++++++++------------ settings.cpp | 19 +++++++++++++++---- settings.h | 1 - widget/widget.cpp | 2 +- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/core.cpp b/core.cpp index 5e96e1a29..32f614721 100644 --- a/core.cpp +++ b/core.cpp @@ -210,7 +210,8 @@ void Core::start() tox_get_address(tox, friendAddress); emit friendAddressGenerated(CFriendAddress::toString(friendAddress)); - QPixmap pic = Settings::getInstance().getSavedAvatar(getSelfId().toString()); + QPixmap pic; + pic.load(QDir(Settings::getInstance().getSettingsDirPath()).filePath("avatar.png")); if (!pic.isNull() && !pic.size().isEmpty()) { QByteArray data; @@ -218,12 +219,25 @@ void Core::start() buffer.open(QIODevice::WriteOnly); pic.save(&buffer, "PNG"); buffer.close(); - if (tox_set_avatar(tox, TOX_AVATAR_FORMAT_PNG, (uint8_t*)data.constData(), data.size()) != 0) - qWarning() << "Core:start: Error setting avatar, size:"<.png duplicate of avatar.png, but whatever + if (!pic.isNull() && !pic.size().isEmpty()) + { + QByteArray data; + QBuffer buffer(&data); + buffer.open(QIODevice::WriteOnly); + pic.save(&buffer, "PNG"); + buffer.close(); + setAvatar(TOX_AVATAR_FORMAT_PNG, data); + } + else + qDebug() << "Core: Error loading self avatar"; + } bootstrapDht(); @@ -476,7 +490,8 @@ void Core::onAvatarDataCallback(Tox*, int32_t friendnumber, uint8_t, else { qDebug() << "Core: Got avatar data from "<(core)->getFriendAddress(friendnumber)); + Settings::getInstance().saveAvatar(pic, static_cast(core)->getFriendAddress(friendnumber).left(64)); + // ignore nospam (good idea, and also the addFriend funcs which call getAvatar don't have it) emit static_cast(core)->friendAvatarChanged(friendnumber, pic); } } @@ -789,13 +804,10 @@ void Core::setAvatar(uint8_t format, const QByteArray& data) QPixmap pic; pic.loadFromData(data); - Settings::getInstance().saveAvatar(pic, getSelfId().toString()); + QString path = QDir(Settings::getInstance().getSettingsDirPath()).filePath("avatar.png"); + pic.save(path, "png"); emit selfAvatarChanged(pic); - - // Broadcast our new avatar! - const uint32_t friendCount = tox_count_friendlist(tox);; - for (unsigned i=0; i const QString Settings::FILENAME = "settings.ini"; -const QString Settings::AVATAR_FILENAME = "avatar.dat"; bool Settings::makeToxPortable{false}; Settings::Settings() : @@ -260,15 +259,27 @@ QString Settings::getSettingsDirPath() QPixmap Settings::getSavedAvatar(const QString &ownerId) { - QString filePath = QDir(getSettingsDirPath()).filePath("avatar_"+ownerId); + QDir dir(getSettingsDirPath()); + QString filePath = dir.filePath("avatars/"+ownerId+".png"); + QFileInfo info(filePath); QPixmap pic; - pic.load(filePath); + if (!info.exists()) + { + QString filePath = dir.filePath("avatar_"+ownerId); + pic.load(filePath); + saveAvatar(pic, ownerId); + QFile::remove(filePath); + } + else + pic.load(filePath); return pic; } void Settings::saveAvatar(QPixmap& pic, const QString& ownerId) { - QString filePath = QDir(getSettingsDirPath()).filePath("avatar_"+ownerId); + QDir dir(getSettingsDirPath()); + dir.mkdir("avatars/"); // remove this in a week or two hopefully + QString filePath = dir.filePath("avatars/"+ownerId+".png"); pic.save(filePath, "png"); } diff --git a/settings.h b/settings.h index 882a31f0f..b796211cb 100644 --- a/settings.h +++ b/settings.h @@ -142,7 +142,6 @@ private: Settings& operator=(const Settings&) = delete; static const QString FILENAME; - static const QString AVATAR_FILENAME; bool loaded; diff --git a/widget/widget.cpp b/widget/widget.cpp index a8f2ab683..3134b2ee6 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -477,7 +477,7 @@ void Widget::addFriend(int friendId, const QString &userId) connect(core, &Core::friendAvatarRemoved, newfriend->widget, &FriendWidget::onAvatarRemoved); // Try to get the avatar from the cache - QPixmap avatar = Settings::getInstance().getSavedAvatar(userId); + QPixmap avatar = Settings::getInstance().getSavedAvatar(userId.left(64)); // just to be safe if (!avatar.isNull()) { newfriend->chatForm->onAvatarChange(friendId, avatar); From b1b89ac1f43a23065862e04ab0046349a4e7ae6d Mon Sep 17 00:00:00 2001 From: dubslow Date: Sat, 27 Sep 2014 16:44:08 -0500 Subject: [PATCH 5/7] minor --- core.cpp | 4 ++-- widget/widget.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core.cpp b/core.cpp index 32f614721..11a27b612 100644 --- a/core.cpp +++ b/core.cpp @@ -223,9 +223,9 @@ void Core::start() } else { - QPixmap pic = Settings::getInstance().getSavedAvatar(getSelfId().toString()); - qDebug() << "self avatar missing, trying by id"; + qDebug() << "Core: self avatar missing, trying by id"; // this will leave a avatars/.png duplicate of avatar.png, but whatever + QPixmap pic = Settings::getInstance().getSavedAvatar(getSelfId().toString()); if (!pic.isNull() && !pic.size().isEmpty()) { QByteArray data; diff --git a/widget/widget.cpp b/widget/widget.cpp index 3134b2ee6..40239a701 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -444,7 +444,7 @@ void Widget::setStatusMessage(const QString &statusMessage) void Widget::addFriend(int friendId, const QString &userId) { - qDebug() << "Widget: Adding friend with id "+userId; + qDebug() << "Widget: Adding friend with id" << userId; Friend* newfriend = FriendList::addFriend(friendId, userId); QLayout* layout = contactListWidget->getFriendLayout(Status::Offline); layout->addWidget(newfriend->widget); @@ -480,6 +480,7 @@ void Widget::addFriend(int friendId, const QString &userId) QPixmap avatar = Settings::getInstance().getSavedAvatar(userId.left(64)); // just to be safe if (!avatar.isNull()) { + qWarning() << "Widget: loadded avatar for id" << userId; newfriend->chatForm->onAvatarChange(friendId, avatar); newfriend->widget->onAvatarChange(friendId, avatar); } From eb67f9b3dd90f745f050d09658fdb98ce883bb9d Mon Sep 17 00:00:00 2001 From: dubslow Date: Sat, 27 Sep 2014 17:19:30 -0500 Subject: [PATCH 6/7] revert special self avatar --- core.cpp | 33 ++++++++++----------------------- settings.cpp | 9 ++++++--- widget/widget.cpp | 2 +- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/core.cpp b/core.cpp index 11a27b612..9b7f7913c 100644 --- a/core.cpp +++ b/core.cpp @@ -210,8 +210,7 @@ void Core::start() tox_get_address(tox, friendAddress); emit friendAddressGenerated(CFriendAddress::toString(friendAddress)); - QPixmap pic; - pic.load(QDir(Settings::getInstance().getSettingsDirPath()).filePath("avatar.png")); + QPixmap pic = Settings::getInstance().getSavedAvatar(getSelfId().toString()); if (!pic.isNull() && !pic.size().isEmpty()) { QByteArray data; @@ -222,22 +221,7 @@ void Core::start() setAvatar(TOX_AVATAR_FORMAT_PNG, data); } else - { - qDebug() << "Core: self avatar missing, trying by id"; - // this will leave a avatars/.png duplicate of avatar.png, but whatever - QPixmap pic = Settings::getInstance().getSavedAvatar(getSelfId().toString()); - if (!pic.isNull() && !pic.size().isEmpty()) - { - QByteArray data; - QBuffer buffer(&data); - buffer.open(QIODevice::WriteOnly); - pic.save(&buffer, "PNG"); - buffer.close(); - setAvatar(TOX_AVATAR_FORMAT_PNG, data); - } - else - qDebug() << "Core: Error loading self avatar"; - } + qDebug() << "Core: Error loading self avatar"; bootstrapDht(); @@ -490,8 +474,7 @@ void Core::onAvatarDataCallback(Tox*, int32_t friendnumber, uint8_t, else { qDebug() << "Core: Got avatar data from "<(core)->getFriendAddress(friendnumber).left(64)); - // ignore nospam (good idea, and also the addFriend funcs which call getAvatar don't have it) + Settings::getInstance().saveAvatar(pic, static_cast(core)->getFriendAddress(friendnumber)); emit static_cast(core)->friendAvatarChanged(friendnumber, pic); } } @@ -804,10 +787,14 @@ void Core::setAvatar(uint8_t format, const QByteArray& data) QPixmap pic; pic.loadFromData(data); - QString path = QDir(Settings::getInstance().getSettingsDirPath()).filePath("avatar.png"); - pic.save(path, "png"); + Settings::getInstance().saveAvatar(pic, getSelfId().toString()); emit selfAvatarChanged(pic); - // according to tox.h, we need not broadcast ourselves, that's done in tox_set_avatar + + // Broadcast our new avatar! + // according to tox.h, we need not broadcast this ourselves, but initial testing indicated elsewise + const uint32_t friendCount = tox_count_friendlist(tox);; + for (unsigned i=0; iwidget, &FriendWidget::onAvatarRemoved); // Try to get the avatar from the cache - QPixmap avatar = Settings::getInstance().getSavedAvatar(userId.left(64)); // just to be safe + QPixmap avatar = Settings::getInstance().getSavedAvatar(userId); if (!avatar.isNull()) { qWarning() << "Widget: loadded avatar for id" << userId; From 8abcc3b77dd0eb0d48f500c98c51be96908f9153 Mon Sep 17 00:00:00 2001 From: dubslow Date: Sat, 27 Sep 2014 17:36:19 -0500 Subject: [PATCH 7/7] blasted scoping issue --- settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.cpp b/settings.cpp index 16e9332b8..3e9f33426 100644 --- a/settings.cpp +++ b/settings.cpp @@ -267,7 +267,7 @@ QPixmap Settings::getSavedAvatar(const QString &ownerId) { QString filePath = dir.filePath("avatar_"+ownerId.left(64)); if (!QFileInfo(filePath).exists()) // try without truncation, for old self avatars - QString filePath = dir.filePath("avatar_"+ownerId); + filePath = dir.filePath("avatar_"+ownerId); pic.load(filePath); saveAvatar(pic, ownerId); QFile::remove(filePath);