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

Merge branch 'pr330'

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-09-28 00:39:45 +02:00
commit c4cbc3a1e9
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
5 changed files with 91 additions and 13 deletions

View File

@ -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` 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,11 +156,76 @@ cd /home/user/qTox
./bootstrap.sh # use -h or --help for more information
```
##Building packages
After all the dependencies are thus reeady to go, compiling should be as simple as
```bash
qmake
make
```
qTox now has the experimental and probably-dodgy ability to package itself (in .deb
###Building packages
Alternately, qTox now has the experimental and probably-dodgy ability to package itself (in .deb
form natively, and .rpm form with <a href="http://joeyh.name/code/alien/">alien</a>).
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;
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.
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
make
```
Assuming all went well you should now have a qTox.app file within the directory. Double click and it should open!

View File

@ -218,9 +218,7 @@ 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:"<<data.size();
emit selfAvatarChanged(pic);
setAvatar(TOX_AVATAR_FORMAT_PNG, data);
}
else
qDebug() << "Core: Error loading self avatar";
@ -791,8 +789,9 @@ void Core::setAvatar(uint8_t format, const QByteArray& data)
pic.loadFromData(data);
Settings::getInstance().saveAvatar(pic, getSelfId().toString());
emit selfAvatarChanged(pic);
// 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; i<friendCount; i++)
tox_send_avatar_info(tox, i);

View File

@ -27,7 +27,6 @@
#include <QList>
const QString Settings::FILENAME = "settings.ini";
const QString Settings::AVATAR_FILENAME = "avatar.dat";
bool Settings::makeToxPortable{false};
Settings::Settings() :
@ -260,15 +259,30 @@ 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.left(64)+".png");
QFileInfo info(filePath);
QPixmap pic;
pic.load(filePath);
if (!info.exists())
{
QString filePath = dir.filePath("avatar_"+ownerId.left(64));
if (!QFileInfo(filePath).exists()) // try without truncation, for old self avatars
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
// ignore nospam (good idea, and also the addFriend funcs which call getAvatar don't have it)
QString filePath = dir.filePath("avatars/"+ownerId.left(64)+".png");
pic.save(filePath, "png");
}

View File

@ -142,7 +142,6 @@ private:
Settings& operator=(const Settings&) = delete;
static const QString FILENAME;
static const QString AVATAR_FILENAME;
bool loaded;

View File

@ -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);
if (!avatar.isNull())
{
qWarning() << "Widget: loadded avatar for id" << userId;
newfriend->chatForm->onAvatarChange(friendId, avatar);
newfriend->widget->onAvatarChange(friendId, avatar);
}