diff --git a/.gitignore b/.gitignore index 6df975821..e92651a06 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pro.user* +libs diff --git a/README.md b/README.md index 0bea903a0..d79ac7dc0 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ However, it is not a fork. - Audio calls - Video calls - Tox DNS +- Translations in various languages

Requirements

@@ -21,9 +22,77 @@ Linux and Mac users will have to compile the source code themselves. Windows download
Linux download (1st July 2014 01:30 GMT)
-Note that the Linux download has not been tested. +Note that the Linux download has not been tested and is not kept up to date.

Screenshots

Note: The screenshots may not always be up to date, but they should give a good idea of the general look and features
+ +

Compiling

+Compiling toxgui requires Qt 5.2 with the Qt Multimedia module and a C++11 compatible compiler. +It also requires the toxcore and toxav libraries. + +To compile, first clone or download the toxgui repository and open a terminal in the toxgui folder. +Then run the script bootstrap.sh (for Linux and Mac) or bootsrap.bat (for Windows) to download an up-to-date toxcore. +And finally run the commands "qmake" and "make" to start building toxgui. + + +

OSX 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 toxgui, 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 ProjectTox-Core github repo. + +Next you need to download QtTools (http://qt-project.org/downloads), at the time of writing this is at version 5.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/. + +Once this is installed, do the following; + +```bash +git clone https://github.com/tux3/toxgui +cd toxgui +qmake +``` + +Do not run make, as we need further modifications to toxgui. + +Open up the Makefile in a text editor (TextEdit/TextWrangler, etc). + +You will need to modify the Makefile to point to your toxcore libs/includes. + +The first change you will need to make is to point the Makefile towards the tox libs installed on your system. (Generally this is /usr/local/libs/). + +Look for the line in the Makefile which references /toxgui/lib/libs/ and replace with the above). + +The second change to Makefile is to add the location of the includes (On my system these were placed in /usr/local/include/tox/). + +To do this, search for the INCLUDES line and add the following to the end; + +```bash +-I/usr/local/include/tox/ +``` + +Save the Makefile. + +
Final Steps
+ +The final step is to run +```bash +make +``` +in the toxgui 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 toxgui.app file within the directory. Double click and it should open! diff --git a/bootstrap.bat b/bootstrap.bat new file mode 100644 index 000000000..09178b958 --- /dev/null +++ b/bootstrap.bat @@ -0,0 +1,4 @@ +@mkdir %~dp0libs +%~dp0tools\wget --no-check-certificate http://jenkins.libtoxcore.so/job/libtoxcore-win32-i686/lastSuccessfulBuild/artifact/libtoxcore-win32-i686.zip -O %~dp0libs\libtoxcore-latest.zip +%~dp0tools\unzip -o %~dp0libs\libtoxcore-latest.zip -d %~dp0libs\ +@del %~dp0libs\libtoxcore-latest.zip \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 000000000..69578fe8f --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# directory where the script is located +SCRIPT_NAME=$(readlink -f $0) +SCRIPT_DIR=`dirname $SCRIPT_NAME` + +# create libs dir if necessary +mkdir -p ${SCRIPT_DIR}/libs + +# maybe an earlier run of this script failed +# thus we should remove the libtoxcore-latest dir +# if exists, otherwise cloning the git repo may fail +rm -rf ${SCRIPT_DIR}/libs/libtoxcore-latest + +# clone current master of libtoxcore +git clone https://github.com/irungentoo/toxcore.git ${SCRIPT_DIR}/libs/libtoxcore-latest + +# compile and install libtoxcore +pushd ${SCRIPT_DIR}/libs/libtoxcore-latest +./autogen.sh +./configure --prefix=${SCRIPT_DIR}/libs/ +make -j2 +make install +popd + +# remove clone dir +rm -rf ${SCRIPT_DIR}/libs/libtoxcore-latest + + diff --git a/core.cpp b/core.cpp index bdbd1d8c6..6ccf257c2 100644 --- a/core.cpp +++ b/core.cpp @@ -137,12 +137,12 @@ void Core::onFriendRequest(Tox*/* tox*/, const uint8_t* cUserId, const uint8_t* emit static_cast(core)->friendRequestReceived(CUserId::toString(cUserId), CString::toString(cMessage, cMessageSize)); } -void Core::onFriendMessage(Tox*/* tox*/, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core) +void Core::onFriendMessage(Tox*/* tox*/, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core) { emit static_cast(core)->friendMessageReceived(friendId, CString::toString(cMessage, cMessageSize)); } -void Core::onFriendNameChange(Tox*/* tox*/, int friendId, uint8_t* cName, uint16_t cNameSize, void* core) +void Core::onFriendNameChange(Tox*/* tox*/, int friendId, const uint8_t* cName, uint16_t cNameSize, void* core) { emit static_cast(core)->friendUsernameChanged(friendId, CString::toString(cName, cNameSize)); } @@ -152,7 +152,7 @@ void Core::onFriendTypingChange(Tox*/* tox*/, int friendId, uint8_t isTyping, vo emit static_cast(core)->friendTypingChanged(friendId, isTyping ? true : false); } -void Core::onStatusMessageChanged(Tox*/* tox*/, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core) +void Core::onStatusMessageChanged(Tox*/* tox*/, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core) { emit static_cast(core)->friendStatusMessageChanged(friendId, CString::toString(cMessage, cMessageSize)); } @@ -186,18 +186,18 @@ void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status, } } -void Core::onAction(Tox*/* tox*/, int friendId, uint8_t *cMessage, uint16_t cMessageSize, void *core) +void Core::onAction(Tox*/* tox*/, int friendId, const uint8_t *cMessage, uint16_t cMessageSize, void *core) { emit static_cast(core)->actionReceived(friendId, CString::toString(cMessage, cMessageSize)); } -void Core::onGroupInvite(Tox*, int friendnumber, uint8_t *group_public_key, void *core) +void Core::onGroupInvite(Tox*, int friendnumber, const uint8_t *group_public_key, void *core) { qDebug() << QString("Core: Group invite by %1").arg(friendnumber); emit static_cast(core)->groupInviteReceived(friendnumber, group_public_key); } -void Core::onGroupMessage(Tox*, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *core) +void Core::onGroupMessage(Tox*, int groupnumber, int friendgroupnumber, const uint8_t * message, uint16_t length, void *core) { emit static_cast(core)->groupMessageReceived(groupnumber, friendgroupnumber, CString::toString(message, length)); } @@ -209,7 +209,7 @@ void Core::onGroupNamelistChange(Tox*, int groupnumber, int peernumber, uint8_t } void Core::onFileSendRequestCallback(Tox*, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, - uint8_t *filename, uint16_t filename_length, void *core) + const uint8_t *filename, uint16_t filename_length, void *core) { qDebug() << QString("Core: Received file request %1 with friend %2").arg(filenumber).arg(friendnumber); @@ -218,7 +218,7 @@ void Core::onFileSendRequestCallback(Tox*, int32_t friendnumber, uint8_t filenum emit static_cast(core)->fileReceiveRequested(fileRecvQueue.last()); } void Core::onFileControlCallback(Tox*, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, - uint8_t control_type, uint8_t*, uint16_t, void *core) + uint8_t control_type, const uint8_t*, uint16_t, void *core) { ToxFile* file{nullptr}; if (receive_send == 1) @@ -287,7 +287,7 @@ void Core::onFileControlCallback(Tox*, int32_t friendnumber, uint8_t receive_sen } } -void Core::onFileDataCallback(Tox*, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *core) +void Core::onFileDataCallback(Tox*, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *core) { ToxFile* file{nullptr}; for (ToxFile& f : fileRecvQueue) @@ -798,7 +798,7 @@ QList Core::getGroupPeerNames(int groupId) const return names; } -int Core::joinGroupchat(int32_t friendnumber, uint8_t* friend_group_public_key) const +int Core::joinGroupchat(int32_t friendnumber, const uint8_t* friend_group_public_key) const { qDebug() << QString("Trying to join groupchat invite by friend %1").arg(friendnumber); return tox_join_groupchat(tox, friendnumber, friend_group_public_key); diff --git a/core.h b/core.h index 0412d1977..2d6766769 100644 --- a/core.h +++ b/core.h @@ -115,7 +115,7 @@ public: int getGroupNumberPeers(int groupId) const; QString getGroupPeerName(int groupId, int peerId) const; QList getGroupPeerNames(int groupId) const; - int joinGroupchat(int32_t friendnumber, uint8_t* friend_group_public_key) const; + int joinGroupchat(int32_t friendnumber, const uint8_t* friend_group_public_key) const; void quitGroupChat(int groupId) const; void dispatchVideoFrame(vpx_image img) const; @@ -180,7 +180,7 @@ signals: void friendLastSeenChanged(int friendId, const QDateTime& dateTime); void emptyGroupCreated(int groupnumber); - void groupInviteReceived(int friendnumber, uint8_t *group_public_key); + void groupInviteReceived(int friendnumber, const uint8_t *group_public_key); void groupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message); void groupNamelistChanged(int groupnumber, int peernumber, uint8_t change); @@ -224,21 +224,21 @@ signals: private: static void onFriendRequest(Tox* tox, const uint8_t* cUserId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); - static void onFriendMessage(Tox* tox, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core); - static void onFriendNameChange(Tox* tox, int friendId, uint8_t* cName, uint16_t cNameSize, void* core); + static void onFriendMessage(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); + static void onFriendNameChange(Tox* tox, int friendId, const uint8_t* cName, uint16_t cNameSize, void* core); static void onFriendTypingChange(Tox* tox, int friendId, uint8_t isTyping, void* core); - static void onStatusMessageChanged(Tox* tox, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core); + static void onStatusMessageChanged(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); static void onUserStatusChanged(Tox* tox, int friendId, uint8_t userstatus, void* core); static void onConnectionStatusChanged(Tox* tox, int friendId, uint8_t status, void* core); - static void onAction(Tox* tox, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core); - static void onGroupInvite(Tox *tox, int friendnumber, uint8_t *group_public_key, void *userdata); - static void onGroupMessage(Tox *tox, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata); + static void onAction(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); + static void onGroupInvite(Tox *tox, int friendnumber, const uint8_t *group_public_key, void *userdata); + static void onGroupMessage(Tox *tox, int groupnumber, int friendgroupnumber, const uint8_t * message, uint16_t length, void *userdata); static void onGroupNamelistChange(Tox *tox, int groupnumber, int peernumber, uint8_t change, void *userdata); static void onFileSendRequestCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, - uint8_t *filename, uint16_t filename_length, void *userdata); + const uint8_t *filename, uint16_t filename_length, void *userdata); static void onFileControlCallback(Tox *tox, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, - uint8_t control_type, uint8_t *data, uint16_t length, void *core); - static void onFileDataCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata); + uint8_t control_type, const uint8_t *data, uint16_t length, void *core); + static void onFileDataCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata); static void onAvInvite(int32_t call_index, void* toxav); static void onAvStart(int32_t call_index, void* toxav); @@ -273,7 +273,7 @@ private: private: Tox* tox; ToxAv* toxav; - QTimer *toxTimer, *saveTimer, *fileTimer, *bootstrapTimer; + QTimer *toxTimer, *fileTimer, *bootstrapTimer; //, *saveTimer; Camera* camera; QList dhtServerList; int dhtServerId; diff --git a/img/status/dot_busy.png b/img/status/dot_busy.png new file mode 100644 index 000000000..316bbdb1d Binary files /dev/null and b/img/status/dot_busy.png differ diff --git a/img/status/dot_busy_2x.png b/img/status/dot_busy_2x.png new file mode 100644 index 000000000..77f6c981a Binary files /dev/null and b/img/status/dot_busy_2x.png differ diff --git a/img/status/dot_busy_notification.png b/img/status/dot_busy_notification.png new file mode 100644 index 000000000..4a2bde641 Binary files /dev/null and b/img/status/dot_busy_notification.png differ diff --git a/main.cpp b/main.cpp index 26e43905e..1f3dc01e2 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,8 @@ #include "widget/widget.h" +#include "settings.h" #include #include +#include int main(int argc, char *argv[]) { @@ -8,7 +10,19 @@ int main(int argc, char *argv[]) a.setApplicationName("Toxgui"); a.setOrganizationName("Tox"); - // install Unicode 6.1 supporting font + // Load translations + QTranslator translator; + if (Settings::getInstance().getUseTranslations()) + { + QString locale = QLocale::system().name().section('_', 0, 0); + if (translator.load(locale,":translations/")) + qDebug() << "Loaded translation "+locale; + else + qDebug() << "Error loading translation "+locale; + a.installTranslator(&translator); + } + + // Install Unicode 6.1 supporting font QFontDatabase::addApplicationFont("://DejaVuSans.ttf"); Widget* w = Widget::getInstance(); diff --git a/res.qrc b/res.qrc index 5f56c9c1f..451d13f0f 100644 --- a/res.qrc +++ b/res.qrc @@ -97,5 +97,10 @@ ui/window/restoreButtonPressed.png ui/friendList/friendList.css ui/window/window.css + img/status/dot_busy.png + img/status/dot_busy_2x.png + img/status/dot_busy_notification.png + translations/fr.qm + translations/ru.qm diff --git a/settings.cpp b/settings.cpp index 204119f6b..3885fdd5c 100644 --- a/settings.cpp +++ b/settings.cpp @@ -72,18 +72,11 @@ void Settings::load() s.endArray(); s.endGroup(); - //NOTE: uncomment when logging will be implemented -/* - s.beginGroup("Logging"); - enableLogging = s.value("enableLogging", false).toBool(); - encryptLogs = s.value("encryptLogs", true).toBool(); - s.endGroup(); -*/ - s.beginGroup("General"); username = s.value("username", "My name").toString(); statusMessage = s.value("statusMessage", "My status").toString(); enableIPv6 = s.value("enableIPv6", true).toBool(); + useTranslations = s.value("useTranslations", true).toBool(); s.endGroup(); s.beginGroup("Widgets"); @@ -132,18 +125,11 @@ void Settings::save() s.endArray(); s.endGroup(); - //NOTE: uncomment when logging will be implemented -/* - s.beginGroup("Logging"); - s.setValue("storeLogs", enableLogging); - s.setValue("encryptLogs", encryptLogs); - s.endGroup(); -*/ - s.beginGroup("General"); s.setValue("username", username); s.setValue("statusMessage", statusMessage); s.setValue("enableIPv6", enableIPv6); + s.setValue("useTranslations",useTranslations); s.endGroup(); s.beginGroup("Widgets"); @@ -221,6 +207,16 @@ void Settings::setEnableIPv6(bool newValue) enableIPv6 = newValue; } +bool Settings::getUseTranslations() const +{ + return useTranslations; +} + +void Settings::setUseTranslations(bool newValue) +{ + useTranslations = newValue; +} + bool Settings::getEnableLogging() const { return enableLogging; diff --git a/settings.h b/settings.h index d113f8e11..38667ef01 100644 --- a/settings.h +++ b/settings.h @@ -52,6 +52,9 @@ public: bool getEnableIPv6() const; void setEnableIPv6(bool newValue); + bool getUseTranslations() const; + void setUseTranslations(bool newValue); + bool getEnableLogging() const; void setEnableLogging(bool newValue); @@ -134,6 +137,7 @@ private: QString statusMessage; bool enableIPv6; + bool useTranslations; bool enableLogging; bool encryptLogs; diff --git a/tools/libeay32.dll b/tools/libeay32.dll new file mode 100644 index 000000000..8d31f8668 Binary files /dev/null and b/tools/libeay32.dll differ diff --git a/tools/libiconv2.dll b/tools/libiconv2.dll new file mode 100644 index 000000000..544dd92f5 Binary files /dev/null and b/tools/libiconv2.dll differ diff --git a/tools/libintl3.dll b/tools/libintl3.dll new file mode 100644 index 000000000..ec11e6b19 Binary files /dev/null and b/tools/libintl3.dll differ diff --git a/tools/libssl32.dll b/tools/libssl32.dll new file mode 100644 index 000000000..a30ff0e9e Binary files /dev/null and b/tools/libssl32.dll differ diff --git a/tools/unzip.exe b/tools/unzip.exe new file mode 100644 index 000000000..b10387734 Binary files /dev/null and b/tools/unzip.exe differ diff --git a/tools/wget.exe b/tools/wget.exe new file mode 100644 index 000000000..54b372e6b Binary files /dev/null and b/tools/wget.exe differ diff --git a/toxgui.pro b/toxgui.pro index e97216a2e..1fdca4926 100644 --- a/toxgui.pro +++ b/toxgui.pro @@ -5,11 +5,41 @@ #------------------------------------------------- QT += core gui multimedia multimediawidgets - greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -TARGET = toxgui -TEMPLATE = app +TARGET = toxgui +TEMPLATE = app +FORMS += widget.ui +CONFIG += c++11 + +TRANSLATIONS = translations/fr.ts \ + translations/ru.ts + +RESOURCES += res.qrc + +target.path = /usr/local/bin +INSTALLS += target + +INCLUDEPATH += libs/include +win32 { + LIBS += $$PWD/libs/lib/libtoxav.a $$PWD/libs/lib/libopus.a $$PWD/libs/lib/libvpx.a $$PWD/libs/lib/libtoxcore.a -lws2_32 $$PWD/libs/lib/libsodium.a +} else { + LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -lsodium -lvpx +} + +#### Static linux build +#LIBS += -Wl,-Bstatic -ltoxcore -ltoxav -lsodium -lvpx -lopus -lgstaudiodecoder -lgstcamerabin -lgstmediacapture \ +# -lgstmediaplayer -lqgsttools_p -lgstaudio-0.10 -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstpbutils-0.10 \ +# -lgstapp-0.10 -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 \ +# -lqtaudio_alsa -lasound -lqtmultimedia_m3u \ +# -lqtaccessiblewidgets -lqconnmanbearer -lqgenericbearer -lqnmbearer \ +# -lqxcb -lX11-xcb -lXi -lxcb-render-util -lxcb-glx -lxcb-render -ldbus-1 \ +# -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape \ +# -lxcb-keysyms -lxcb-xkb -lfontconfig -lfreetype -lXrender -lXext -lX11 \ +# -lmtdev -lqdds -lqicns -lqico -lqjp2 -lqmng -lqtga -lqtiff -lqwbmp -lqwebp \ +# -lpng -lz -licui18n -licuuc -licudata -lm -ldl -lgthread-2.0 \ +# -pthread -lglib-2.0 -lrt -lGL -lpthread -Wl,-Bdynamic +#QMAKE_CXXFLAGS += -Os -flto -static-libstdc++ -static-libgcc HEADERS += widget/form/addfriendform.h \ widget/form/chatform.h \ @@ -37,30 +67,8 @@ HEADERS += widget/form/addfriendform.h \ widget/selfcamview.h \ widget/videosurface.h \ widget/camera.h \ - widget/netcamview.h - -FORMS += widget.ui - -CONFIG += c++11 - -RESOURCES += \ - res.qrc - -LIBS += -ltoxcore -ltoxav -lsodium -lvpx - -#### Static linux build -#LIBS += -Wl,-Bstatic -ltoxcore -ltoxav -lsodium -lvpx -lopus -lgstaudiodecoder -lgstcamerabin -lgstmediacapture \ -# -lgstmediaplayer -lqgsttools_p -lgstaudio-0.10 -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstpbutils-0.10 \ -# -lgstapp-0.10 -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 \ -# -lqtaudio_alsa -lasound -lqtmultimedia_m3u \ -# -lqtaccessiblewidgets -lqconnmanbearer -lqgenericbearer -lqnmbearer \ -# -lqxcb -lX11-xcb -lXi -lxcb-render-util -lxcb-glx -lxcb-render -ldbus-1 \ -# -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape \ -# -lxcb-keysyms -lxcb-xkb -lfontconfig -lfreetype -lXrender -lXext -lX11 \ -# -lmtdev -lqdds -lqicns -lqico -lqjp2 -lqmng -lqtga -lqtiff -lqwbmp -lqwebp \ -# -lpng -lz -licui18n -licuuc -licudata -lm -ldl -lgthread-2.0 \ -# -pthread -lglib-2.0 -lrt -lGL -lpthread -Wl,-Bdynamic -#QMAKE_CXXFLAGS += -Os -flto -static-libstdc++ -static-libgcc + widget/netcamview.h \ + widget/tool/clickablelabel.h SOURCES += \ widget/form/addfriendform.cpp \ @@ -90,50 +98,5 @@ SOURCES += \ widget/selfcamview.cpp \ widget/videosurface.cpp \ widget/camera.cpp \ - widget/netcamview.cpp - - - -### EXAMPLE BUILD SETTINGS FOR WINDOWS -#win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -ltoxcore - -#INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include -#DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include - -#win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/toxcore.lib -#else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libtoxcore.a - -#win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -ltoxav - -#INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include -#DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include - -#win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/toxav.lib -#else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libtoxav.a - -#win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -lvpx - -#INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include -#DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include - -#win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/vpx.lib -#else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libvpx.a - - -#win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -lopus - -#INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include -#DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include - -#win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/opus.lib -#else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libopus.a - -#win32: LIBS += -lws2_32 - -#win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -lsodium - -#INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include -#DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include - -#win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/sodium.lib -#else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libsodium.a + widget/netcamview.cpp \ + widget/tool/clickablelabel.cpp diff --git a/translations/fr.qm b/translations/fr.qm new file mode 100644 index 000000000..e3d68b2e1 Binary files /dev/null and b/translations/fr.qm differ diff --git a/translations/fr.ts b/translations/fr.ts new file mode 100644 index 000000000..2ba83d433 --- /dev/null +++ b/translations/fr.ts @@ -0,0 +1,306 @@ + + + + + AddFriendForm + + + Add Friends + Ajouter des amis + + + + Tox ID + Tox ID of the person you're sending a friend request to + ID Tox + + + + Message + The message you send in friend requests + Message + + + + Send friend request + Envoyer la demande d'ami + + + + Tox me maybe? + Default message in friend requests if the field is left blank. Write something appropriate! + Je souhaiterais vous ajouter à mes contacts + + + + Please fill in a valid Tox ID + Tox ID of the friend you're sending a friend request to + Merci de remplir un ID Tox valide + + + + Error while looking up DNS + The DNS gives the Tox ID associated to toxme.se addresses + Erreur en consultant le serveur DNS + + + + Unexpected number of text records + Error with the DNS + Nombre d'entrées texte innatendu + + + + Unexpected number of values in text record + Error with the DNS + Nombre d'entrées numériques dans l'entrée texte innatendu + + + + The DNS lookup does not contain any Tox ID + Error with the DNS + La réponse DNS ne contient aucun ID Tox + + + + + The DNS lookup does not contain a valid Tox ID + Error with the DNS + La réponse DNS ne contient pas d'ID Tox valide + + + + Camera + + + Camera eror + Erreur de caméra + + + + Camera format %1 not supported, can't use the camera + Format %1 de la caméra non supporté, impossible de l'utiliser + + + + ChatForm + + + Send a file + Envoyer un fichier + + + + + Save chat log + Sauvegarder l'historique de conversation + + + + CopyableElideLabel + + + Copy + Copier + + + + FileTransfertWidget + + + Save a file + Title of the file saving dialog + Sauvegarder un fichier + + + + FriendRequestDialog + + + Friend request + Title of the window to aceept/deny a friend request + Demande d'ami + + + + Someone wants to make friends with you + Quelqu'un veut devenir votre ami + + + + User ID: + ID utilisateur: + + + + Friend request message: + Message de demande d'ami: + + + + Accept + Accept a friend request + Accepter + + + + Reject + Reject a friend request + Rejeter + + + + FriendWidget + + + Copy friend ID + Menu to copy the Tox ID of that friend + Copier l'ID ami + + + + Invite in group + Menu to invite a friend in a groupchat + Inviter dans un groupe + + + + Remove friend + Menu to remove the friend from our friendlist + Supprimer ami + + + + GroupChatForm + + + %1 users in chat + Number of users in chat + %1 personnes + + + + <Unknown> + <Inconnu> + + + + %1 users in chat + %1 personnes + + + + Save chat log + Sauvegarder l'historique de conversation + + + + GroupWidget + + + + %1 users in chat + %1 personnes + + + + + 0 users in chat + 0 personnes + + + + Quit group + Menu to quit a groupchat + Quitter le groupe + + + + SelfCamView + + + Tox video test + Title of the window to test the video/webcam + Test vidéo Tox + + + + SettingsForm + + + User Settings + "Headline" of the window + Configuration + + + + Name + Username/nick + Nom + + + + Status + Status message + Status + + + + Test video + Text on a button to test the video/webcam + Tester la vidéo + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + Activer IPv6 (recommandé) + + + + Widget + + + Tox + Tox + + + + Your name + Votre nom + + + + Your status + Votre status + + + + Close + Fermer + + + + Ctrl+Q + Ctrl+Q + + + + Online + Button to set your status to 'Online' + Connecté + + + + Away + Button to set your status to 'Away' + Indisponnible + + + + Busy + Button to set your status to 'Busy' + Occupé + + + diff --git a/translations/ru.qm b/translations/ru.qm new file mode 100644 index 000000000..6f4aee656 Binary files /dev/null and b/translations/ru.qm differ diff --git a/translations/ru.ts b/translations/ru.ts new file mode 100644 index 000000000..fb4a178ce --- /dev/null +++ b/translations/ru.ts @@ -0,0 +1,311 @@ + + + + + AddFriendForm + + + Add Friends + Добавление друзей + + + + Tox ID + Tox ID of the person you're sending a friend request to + Tox ID + + + + Message + The message you send in friend requests + Сообщение + + + + Send friend request + Мне не нравится, но другого не придумал, и фейсбук использует это + Отправить запрос на добавление в друзья + + + + Tox me maybe? + Default message in friend requests if the field is left blank. Write something appropriate! + Вот таким нехитрым и незамысловатым образом решаются сложные переводчиские проблемы + Добавь меня, а? + + + + Please fill in a valid Tox ID + Tox ID of the friend you're sending a friend request to + Пожалуйста, введите корректный Tox ID + + + + Error while looking up DNS + The DNS gives the Tox ID associated to toxme.se addresses + Ошибка при просмотре DNS + + + + Unexpected number of text records + Error with the DNS + Непредвиденное количество текстовых записей + + + + Unexpected number of values in text record + Error with the DNS + Непредвиденное количество значений в текстовой записи + + + + The DNS lookup does not contain any Tox ID + Error with the DNS + В ответе DNS ни одного Tox ID + + + + + The DNS lookup does not contain a valid Tox ID + Error with the DNS + Ответ DNS не содержит корректных Tox ID + + + + Camera + + + Camera eror + Ошибка камеры + + + + Camera format %1 not supported, can't use the camera + Формат камеры %1 не поддерживается, невозможно использовать камеру + + + + ChatForm + + + Send a file + Отправить файл + + + + + Save chat log + Сохранить лог чата + + + + CopyableElideLabel + + + Copy + Копировать + + + + FileTransfertWidget + + + Save a file + Title of the file saving dialog + Сохранить файл + + + + FriendRequestDialog + + + Friend request + Title of the window to aceept/deny a friend request + Мне не нравится, но другого не придумал, и фейсбук использует это + Запрос на добавление в друзья + + + + Someone wants to make friends with you + «Подружиться», вероятно, недостаточно вежливо + Кто-то хочет добавить вас в друзья + + + + User ID: + ID пользователя: + + + + Friend request message: + Текст запроса: + + + + Accept + Accept a friend request + Принять + + + + Reject + Reject a friend request + Отклонить + + + + FriendWidget + + + Copy friend ID + Menu to copy the Tox ID of that friend + Копировать ID друга + + + + Invite in group + Menu to invite a friend in a groupchat + Пригласить в группу + + + + Remove friend + Menu to remove the friend from our friendlist + Удалить друга + + + + GroupChatForm + + + %1 users in chat + Number of users in chat + %1 пользователей в чате + + + + <Unknown> + <Неизвестно> + + + + %1 users in chat + %1 пользователей в чате + + + + Save chat log + Сохранить лог чата + + + + GroupWidget + + + Quit group + Menu to quit a groupchat + Покинуть группу + + + + + %1 users in chat + %1 пользователей в чате + + + + + 0 users in chat + Ни одного пользователя в чате + + + + SelfCamView + + + Tox video test + Title of the window to test the video/webcam + Проверка видео + + + + SettingsForm + + + User Settings + "Headline" of the window + Пользовательские настройки + + + + Name + Username/nick + Имя + + + + Status + Status message + Статус + + + + Test video + Text on a button to test the video/webcam + Проверить видео + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + Включить IPv6 (рекомендуется) + + + + Widget + + + Tox + Tox + + + + Your name + Ваше имя + + + + Your status + Ваш статус + + + + Close + Закрыть + + + + Ctrl+Q + Ctrl+Q + + + + Online + Button to set your status to 'Online' + В сети + + + + Away + Button to set your status to 'Away' + Вероятно, это не столь долгое путешествие + Отошёл + + + + Busy + Button to set your status to 'Busy' + Занят + + + diff --git a/widget.ui b/widget.ui index 02bc6c4b7..e04339411 100644 --- a/widget.ui +++ b/widget.ui @@ -781,16 +781,7 @@ 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -1788,7 +1779,7 @@ - + 40 @@ -1808,7 +1799,7 @@ - ../../c/toxgui/img/status/dot_away_2x.png + :/img/status/dot_away_2x.png Qt::AlignCenter @@ -1821,10 +1812,6 @@ - profilePicture - statImg - nameLabel - statusLabel @@ -1858,7 +1845,7 @@ 0 0 - 225 + 258 199 @@ -2304,16 +2291,7 @@ 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -2914,16 +2892,7 @@ 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -3047,6 +3016,11 @@ QLabel
widget/tool/editablelabelwidget.h
+ + ClickableLabel + QLabel +
widget/tool/clickablelabel.h
+
diff --git a/widget/camera.cpp b/widget/camera.cpp index 1a9b782cc..0c35e333b 100644 --- a/widget/camera.cpp +++ b/widget/camera.cpp @@ -142,8 +142,8 @@ bool Camera::isFormatSupported(const QVideoSurfaceFormat& format) const } else { - QMessageBox::warning(0, "Camera eror", - QString("Camera format %1 not supported, can't use the camera") + QMessageBox::warning(0, tr("Camera eror"), + tr("Camera format %1 not supported, can't use the camera") .arg(format.pixelFormat())); return false; } diff --git a/widget/filetransfertwidget.cpp b/widget/filetransfertwidget.cpp index 97aba6164..5fc699f69 100644 --- a/widget/filetransfertwidget.cpp +++ b/widget/filetransfertwidget.cpp @@ -1,6 +1,7 @@ #include "filetransfertwidget.h" #include "widget.h" #include "core.h" +#include "math.h" #include #include @@ -229,7 +230,7 @@ void FileTransfertWidget::rejectRecvRequest() void FileTransfertWidget::acceptRecvRequest() { - QString path = QFileDialog::getSaveFileName(0,"Save a file",QDir::currentPath()+'/'+filename->text()); + QString path = QFileDialog::getSaveFileName(0,tr("Save a file","Title of the file saving dialog"),QDir::currentPath()+'/'+filename->text()); if (path.isEmpty()) return; diff --git a/widget/form/addfriendform.cpp b/widget/form/addfriendform.cpp index 3dd8b9b49..883d81c4e 100644 --- a/widget/form/addfriendform.cpp +++ b/widget/form/addfriendform.cpp @@ -12,12 +12,12 @@ AddFriendForm::AddFriendForm() : dns(this) main = new QWidget(), head = new QWidget(); QFont bold; bold.setBold(true); - headLabel.setText("Add Friends"); + headLabel.setText(tr("Add Friends")); headLabel.setFont(bold); - toxIdLabel.setText("Tox ID"); - messageLabel.setText("Message"); - sendButton.setText("Send friend request"); + toxIdLabel.setText(tr("Tox ID","Tox ID of the person you're sending a friend request to")); + messageLabel.setText(tr("Message","The message you send in friend requests")); + sendButton.setText(tr("Send friend request")); main->setLayout(&layout); layout.addWidget(&toxIdLabel); @@ -64,7 +64,7 @@ void AddFriendForm::showWarning(const QString &message) const QString AddFriendForm::getMessage() const { const QString msg = message.toPlainText(); - return !msg.isEmpty() ? msg : "Tox me maybe?"; + return !msg.isEmpty() ? msg : tr("Tox me maybe?","Default message in friend requests if the field is left blank. Write something appropriate!"); } void AddFriendForm::onSendTriggered() @@ -72,7 +72,7 @@ void AddFriendForm::onSendTriggered() QString id = toxId.text().trimmed(); if (id.isEmpty()) { - showWarning("Please fill in a valid Tox ID"); + showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to")); } else if (isToxId(id)) { emit friendRequested(id, getMessage()); this->toxId.setText(""); @@ -89,38 +89,38 @@ void AddFriendForm::handleDnsLookup() const QString idKeyWord("id="); if (dns.error() != QDnsLookup::NoError) { - showWarning("Error while looking up DNS"); + showWarning(tr("Error while looking up DNS","The DNS gives the Tox ID associated to toxme.se addresses")); return; } const QList textRecords = dns.textRecords(); if (textRecords.length() != 1) { - showWarning("Unexpected number of text records"); + showWarning(tr("Unexpected number of text records", "Error with the DNS")); return; } const QList textRecordValues = textRecords.first().values(); if (textRecordValues.length() != 1) { - showWarning("Unexpected number of values in text record"); + showWarning(tr("Unexpected number of values in text record", "Error with the DNS")); return; } const QString entry(textRecordValues.first()); int idx = entry.indexOf(idKeyWord); if (idx < 0) { - showWarning("The DNS lookup does not contain any Tox ID"); + showWarning(tr("The DNS lookup does not contain any Tox ID", "Error with the DNS")); return; } idx += idKeyWord.length(); if (entry.length() < idx + static_cast(TOX_ID_SIZE)) { - showWarning("The DNS lookup does not contain a valid Tox ID"); + showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS")); return; } const QString friendAdress = entry.mid(idx, TOX_ID_SIZE); if (!isToxId(friendAdress)) { - showWarning("The DNS lookup does not contain a valid Tox ID"); + showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS")); return; } diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 4090119aa..6e1737444 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -258,7 +258,7 @@ void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date) void ChatForm::onAttachClicked() { - QString path = QFileDialog::getOpenFileName(0,"Send a file"); + QString path = QFileDialog::getOpenFileName(0,tr("Send a file")); if (path.isEmpty()) return; @@ -583,13 +583,13 @@ void ChatForm::onChatContextMenuRequested(QPoint pos) QWidget* sender = (QWidget*)QObject::sender(); pos = sender->mapToGlobal(pos); QMenu menu; - menu.addAction("Save chat log", this, SLOT(onSaveLogClicked())); + menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked())); menu.exec(pos); } void ChatForm::onSaveLogClicked() { - QString path = QFileDialog::getSaveFileName(0,"Save chat log"); + QString path = QFileDialog::getSaveFileName(0,tr("Save chat log")); if (path.isEmpty()) return; diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index 7116ae7f1..fa279f03b 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -29,7 +29,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup) name->setText(group->widget->name.text()); name->setFont(bold); nusers->setFont(small); - nusers->setText(QString("%1 users in chat").arg(group->peers.size())); + nusers->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); avatar->setPixmap(QPixmap(":/img/group.png")); QString names; for (QString& s : group->peers) @@ -152,7 +152,7 @@ void GroupChatForm::addGroupMessage(QString message, int peerId) if (group->peers.contains(peerId)) msgAuthor = new QLabel(group->peers[peerId]); else - msgAuthor = new QLabel(""); + msgAuthor = new QLabel(tr("")); QLabel *msgText = new QLabel(message); QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm")); @@ -217,7 +217,7 @@ void GroupChatForm::onSliderRangeChanged() void GroupChatForm::onUserListChanged() { - nusers->setText(QString("%1 users in chat").arg(group->nPeers)); + nusers->setText(tr("%1 users in chat").arg(group->nPeers)); QString names; for (QString& s : group->peers) names.append(s+", "); @@ -236,7 +236,7 @@ void GroupChatForm::onChatContextMenuRequested(QPoint pos) void GroupChatForm::onSaveLogClicked() { - QString path = QFileDialog::getSaveFileName(0,"Save chat log"); + QString path = QFileDialog::getSaveFileName(0,tr("Save chat log")); if (path.isEmpty()) return; diff --git a/widget/form/settingsform.cpp b/widget/form/settingsform.cpp index 4e000848a..d3e93a995 100644 --- a/widget/form/settingsform.cpp +++ b/widget/form/settingsform.cpp @@ -2,6 +2,8 @@ #include "widget/widget.h" #include "settings.h" #include +#include +#include SettingsForm::SettingsForm() : QObject() @@ -9,19 +11,25 @@ SettingsForm::SettingsForm() main = new QWidget(), head = new QWidget(); QFont bold, small; bold.setBold(true); - small.setPixelSize(7); - headLabel.setText("User Settings"); + small.setPixelSize(13); + headLabel.setText(tr("User Settings","\"Headline\" of the window")); headLabel.setFont(bold); - nameLabel.setText("Name"); - statusTextLabel.setText("Status"); - idLabel.setText("Tox ID"); + nameLabel.setText(tr("Name","Username/nick")); + statusTextLabel.setText(tr("Status","Status message")); + idLabel.setText("Tox ID (click here to copy)"); id.setFont(small); id.setTextInteractionFlags(Qt::TextSelectableByMouse); + id.setReadOnly(true); + id.setFrameStyle(QFrame::NoFrame); + id.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + id.setFixedHeight(id.document()->size().height()); - videoTest.setText("Test video"); - enableIPv6.setText("Enable IPv6 (recommended)"); + videoTest.setText(tr("Test video","Text on a button to test the video/webcam")); + enableIPv6.setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6")); enableIPv6.setChecked(Settings::getInstance().getEnableIPv6()); + useTranslations.setText(tr("Use translations","Text on a checkbox to enable translations")); + useTranslations.setChecked(Settings::getInstance().getUseTranslations()); main->setLayout(&layout); layout.addWidget(&nameLabel); @@ -32,6 +40,7 @@ SettingsForm::SettingsForm() layout.addWidget(&id); layout.addWidget(&videoTest); layout.addWidget(&enableIPv6); + layout.addWidget(&useTranslations); layout.addStretch(); head->setLayout(&headLayout); @@ -39,6 +48,7 @@ SettingsForm::SettingsForm() connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked())); connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated())); + connect(&idLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked())); } SettingsForm::~SettingsForm() @@ -69,3 +79,14 @@ void SettingsForm::onEnableIPv6Updated() { Settings::getInstance().setEnableIPv6(enableIPv6.isChecked()); } + +void SettingsForm::copyIdClicked() +{ + id.selectAll();; + QApplication::clipboard()->setText(id.toPlainText()); +} + +void SettingsForm::onUseTranslationUpdated() +{ + Settings::getInstance().setUseTranslations(useTranslations.isChecked()); +} diff --git a/widget/form/settingsform.h b/widget/form/settingsform.h index a6dc7c642..0091e8fe8 100644 --- a/widget/form/settingsform.h +++ b/widget/form/settingsform.h @@ -8,6 +8,9 @@ #include #include #include +#include +#include +#include "widget/tool/clickablelabel.h" #include "ui_widget.h" #include "widget/selfcamview.h" @@ -26,11 +29,15 @@ public slots: private slots: void onTestVideoClicked(); void onEnableIPv6Updated(); + void onUseTranslationUpdated(); + void copyIdClicked(); private: - QLabel headLabel, nameLabel, statusTextLabel, idLabel, id; + QLabel headLabel, nameLabel, statusTextLabel; + QTextEdit id; + ClickableLabel idLabel; QPushButton videoTest; - QCheckBox enableIPv6; + QCheckBox enableIPv6, useTranslations; QVBoxLayout layout, headLayout; QWidget *main, *head; diff --git a/widget/friendwidget.cpp b/widget/friendwidget.cpp index 94b8283ce..49ebec8ae 100644 --- a/widget/friendwidget.cpp +++ b/widget/friendwidget.cpp @@ -68,8 +68,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) { QPoint pos = event->globalPos(); QMenu menu; - menu.addAction("Copy friend ID"); - QMenu* inviteMenu = menu.addMenu("Invite in group"); + QAction* copyId = menu.addAction(tr("Copy friend ID","Menu to copy the Tox ID of that friend")); + QMenu* inviteMenu = menu.addMenu(tr("Invite in group","Menu to invite a friend in a groupchat")); QMap groupActions; for (Group* group : GroupList::groupList) { @@ -79,17 +79,17 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) if (groupActions.isEmpty()) inviteMenu->setEnabled(false); menu.addSeparator(); - menu.addAction("Remove friend"); + QAction* removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist")); QAction* selectedItem = menu.exec(pos); if (selectedItem) { - if (selectedItem->text() == "Copy friend ID") + if (selectedItem == copyId) { emit copyFriendIdToClipboard(friendId); return; } - else if (selectedItem->text() == "Remove friend") + else if (selectedItem == removeFriendAction) { hide(); emit removeFriend(friendId); diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index a1c9b3358..f0392daf3 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -35,9 +35,9 @@ GroupWidget::GroupWidget(int GroupId, QString Name) this->setPalette(pal3); Group* g = GroupList::findGroup(groupId); if (g) - nusers.setText(QString("%1 users in chat").arg(g->peers.size())); + nusers.setText(GroupWidget::tr("%1 users in chat").arg(g->peers.size())); else - nusers.setText("0 users in chat"); + nusers.setText(GroupWidget::tr("0 users in chat")); textLayout.addStretch(); textLayout.addWidget(&name); @@ -70,17 +70,14 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event) { QPoint pos = event->globalPos(); QMenu menu; - menu.addAction("Quit group"); + QAction* quitGroup = menu.addAction(tr("Quit group","Menu to quit a groupchat")); QAction* selectedItem = menu.exec(pos); - if (selectedItem) + if (selectedItem == quitGroup) { - if (selectedItem->text() == "Quit group") - { - hide(); - emit removeGroup(groupId); - return; - } + hide(); + emit removeGroup(groupId); + return; } } @@ -128,9 +125,9 @@ void GroupWidget::onUserListChanged() { Group* g = GroupList::findGroup(groupId); if (g) - nusers.setText(QString("%1 users in chat").arg(g->nPeers)); + nusers.setText(tr("%1 users in chat").arg(g->nPeers)); else - nusers.setText("0 users in chat"); + nusers.setText(tr("0 users in chat")); } void GroupWidget::setAsActiveChatroom() diff --git a/widget/selfcamview.cpp b/widget/selfcamview.cpp index 52b4766c1..30eabc798 100644 --- a/widget/selfcamview.cpp +++ b/widget/selfcamview.cpp @@ -13,7 +13,7 @@ SelfCamView::SelfCamView(Camera* Cam, QWidget* parent) mainLayout{new QHBoxLayout()}, cam(Cam) { setLayout(mainLayout); - setWindowTitle("Tox video test"); + setWindowTitle(SelfCamView::tr("Tox video test","Title of the window to test the video/webcam")); setMinimumSize(320,240); updateDisplayTimer.setInterval(5); diff --git a/widget/tool/clickablelabel.cpp b/widget/tool/clickablelabel.cpp new file mode 100644 index 000000000..1e1b61f9d --- /dev/null +++ b/widget/tool/clickablelabel.cpp @@ -0,0 +1,11 @@ +#include "clickablelabel.h" + +ClickableLabel::ClickableLabel(QWidget *parent) : + QLabel(parent) +{ +} + +void ClickableLabel::mousePressEvent(QMouseEvent*) +{ + emit clicked(); +} diff --git a/widget/tool/clickablelabel.h b/widget/tool/clickablelabel.h new file mode 100644 index 000000000..78b1be2b6 --- /dev/null +++ b/widget/tool/clickablelabel.h @@ -0,0 +1,20 @@ +#ifndef CLICKABLELABEL_H +#define CLICKABLELABEL_H + +#include + +class ClickableLabel : public QLabel +{ + Q_OBJECT +public: + explicit ClickableLabel(QWidget *parent = 0); + +signals: + void clicked(); + +protected: + void mousePressEvent ( QMouseEvent * event ); + +}; + +#endif // CLICKABLELABEL_H diff --git a/widget/tool/copyableelidelabel.cpp b/widget/tool/copyableelidelabel.cpp index 39927db69..ae05717ca 100644 --- a/widget/tool/copyableelidelabel.cpp +++ b/widget/tool/copyableelidelabel.cpp @@ -26,7 +26,7 @@ CopyableElideLabel::CopyableElideLabel(QWidget* parent) : setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &CopyableElideLabel::customContextMenuRequested, this, &CopyableElideLabel::showContextMenu); - actionCopy = new QAction(tr("Copy"), this); + actionCopy = new QAction(CopyableElideLabel::tr("Copy"), this); connect(actionCopy, &QAction::triggered, [this]() { QApplication::clipboard()->setText(text()); }); diff --git a/widget/tool/copyableelidelabel.h b/widget/tool/copyableelidelabel.h index de7c53c08..69bc09382 100644 --- a/widget/tool/copyableelidelabel.h +++ b/widget/tool/copyableelidelabel.h @@ -21,6 +21,7 @@ class CopyableElideLabel : public ElideLabel { + Q_OBJECT public: explicit CopyableElideLabel(QWidget* parent = 0); diff --git a/widget/tool/friendrequestdialog.cpp b/widget/tool/friendrequestdialog.cpp index 1c7e66139..cb7868e4b 100644 --- a/widget/tool/friendrequestdialog.cpp +++ b/widget/tool/friendrequestdialog.cpp @@ -27,22 +27,22 @@ FriendRequestDialog::FriendRequestDialog(QWidget *parent, const QString &userId, QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - setWindowTitle("Friend request"); + setWindowTitle(tr("Friend request","Title of the window to aceept/deny a friend request")); - QLabel *friendsLabel = new QLabel("Someone wants to make friends with you.", this); - QLabel *userIdLabel = new QLabel("User ID:", this); + QLabel *friendsLabel = new QLabel(tr("Someone wants to make friends with you"), this); + QLabel *userIdLabel = new QLabel(tr("User ID:"), this); QLineEdit *userIdEdit = new QLineEdit(userId, this); userIdEdit->setCursorPosition(0); userIdEdit->setReadOnly(true); - QLabel *messageLabel = new QLabel("Friend request message:", this); + QLabel *messageLabel = new QLabel(tr("Friend request message:"), this); QPlainTextEdit *messageEdit = new QPlainTextEdit(message, this); messageEdit->setReadOnly(true); QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal, this); - buttonBox->addButton("Accept", QDialogButtonBox::AcceptRole); - buttonBox->addButton("Reject", QDialogButtonBox::RejectRole); + buttonBox->addButton(tr("Accept","Accept a friend request"), QDialogButtonBox::AcceptRole); + buttonBox->addButton(tr("Reject","Reject a friend request"), QDialogButtonBox::RejectRole); connect(buttonBox, &QDialogButtonBox::accepted, this, &FriendRequestDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FriendRequestDialog::reject); diff --git a/widget/widget.cpp b/widget/widget.cpp index d9cfb794a..59a6c4660 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -160,7 +160,6 @@ Widget::Widget(QWidget *parent) : ui->pbMin->setMouseTracking(true); ui->pbMax->setMouseTracking(true); ui->pbClose->setMouseTracking(true); - ui->statusHead->setAttribute(Qt::WA_TransparentForMouseEvents); ui->statusHead->setMouseTracking(true); QList currentSizes = ui->centralWidget->sizes(); @@ -214,6 +213,7 @@ Widget::Widget(QWidget *parent) : connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked())); connect(ui->nameLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onUsernameChanged(QString,QString))); connect(ui->statusLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onStatusMessageChanged(QString,QString))); + connect(ui->statImg, SIGNAL(clicked()), this, SLOT(onStatusImgClicked())); connect(&settingsForm.name, SIGNAL(textChanged(QString)), this, SLOT(onUsernameChanged(QString))); connect(&settingsForm.statusText, SIGNAL(textChanged(QString)), this, SLOT(onStatusMessageChanged(QString))); connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString))); @@ -258,7 +258,7 @@ Widget* Widget::getInstance() //Super ugly hack to enable resizable friend widgets //There should be a way to set them to resize automagicly, but I can't seem to find it. -void Widget::splitterMoved(int pos, int index) +void Widget::splitterMoved(int, int) { updateFriendListWidth(); } @@ -307,8 +307,10 @@ void Widget::onStatusSet(Status status) { if (status == Status::Online) ui->statImg->setPixmap(QPixmap(":img/status/dot_online_2x.png")); - else if (status == Status::Busy || status == Status::Away) + else if (status == Status::Away) ui->statImg->setPixmap(QPixmap(":img/status/dot_idle_2x.png")); + else if (status == Status::Busy) + ui->statImg->setPixmap(QPixmap(":img/status/dot_busy_2x.png")); else if (status == Status::Offline) ui->statImg->setPixmap(QPixmap(":img/status/dot_away_2x.png")); } @@ -540,10 +542,14 @@ void Widget::updateFriendStatusLights(int friendId) f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online.png")); else if (status == Status::Online && f->hasNewMessages == 1) f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png")); - else if ((status == Status::Busy || status == Status::Away) && f->hasNewMessages == 0) + else if (status == Status::Away && f->hasNewMessages == 0) f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_idle.png")); - else if ((status == Status::Busy || status == Status::Away) && f->hasNewMessages == 1) + else if (status == Status::Away && f->hasNewMessages == 1) f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_idle_notification.png")); + else if (status == Status::Busy && f->hasNewMessages == 0) + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_busy.png")); + else if (status == Status::Busy && f->hasNewMessages == 1) + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_busy_notification.png")); else if (status == Status::Offline && f->hasNewMessages == 0) f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_away.png")); else if (status == Status::Offline && f->hasNewMessages == 1) @@ -587,7 +593,7 @@ void Widget::copyFriendIdToClipboard(int friendId) } } -void Widget::onGroupInviteReceived(int32_t friendId, uint8_t* publicKey) +void Widget::onGroupInviteReceived(int32_t friendId, const uint8_t* publicKey) { int groupId = core->joinGroupchat(friendId, publicKey); if (groupId == -1) @@ -1137,3 +1143,19 @@ void Widget::minimizeBtnClicked() } } +void Widget::onStatusImgClicked() +{ + QMenu menu; + QAction* online = menu.addAction(tr("Online","Button to set your status to 'Online'")); + QAction* away = menu.addAction(tr("Away","Button to set your status to 'Away'")); + QAction* busy = menu.addAction(tr("Busy","Button to set your status to 'Busy'")); + + QPoint pos = QCursor::pos(); + QAction* selectedItem = menu.exec(pos); + if (selectedItem == online) + core->setStatus(Status::Online); + else if (selectedItem == away) + core->setStatus(Status::Away); + else if (selectedItem == busy) + core->setStatus(Status::Busy); +} diff --git a/widget/widget.h b/widget/widget.h index ca0984d9e..219fafc56 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -85,13 +85,14 @@ private slots: void onFriendMessageReceived(int friendId, const QString& message); void onFriendRequestReceived(const QString& userId, const QString& message); void onEmptyGroupCreated(int groupId); - void onGroupInviteReceived(int32_t friendId, uint8_t *publicKey); + void onGroupInviteReceived(int32_t friendId, const uint8_t *publicKey); void onGroupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message); void onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t change); void onGroupWidgetClicked(GroupWidget* widget); void removeFriend(int friendId); void copyFriendIdToClipboard(int friendId); void removeGroup(int groupId); + void onStatusImgClicked(); void splitterMoved(int pos, int index); protected slots: