diff --git a/README.md b/README.md index d6358283e..dd7c45fdb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ However, it is not a fork. - Group chats - File transfers, with previewing of images - Audio calls -- Video calls (alpha) +- Video calls - Tox DNS - Translations in various languages diff --git a/core.cpp b/core.cpp index 4b081000a..81d022588 100644 --- a/core.cpp +++ b/core.cpp @@ -718,12 +718,11 @@ void Core::setUsername(const QString& username) } } -QString Core::getSelfId() +ToxID Core::getSelfId() { uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE]; tox_get_address(tox, friendAddress); - - return CFriendAddress::toString(friendAddress); + return ToxID::fromString(CFriendAddress::toString(friendAddress)); } QString Core::getStatusMessage() diff --git a/core.h b/core.h index 96ab86d2d..13d051017 100644 --- a/core.h +++ b/core.h @@ -49,7 +49,7 @@ public: QString getUsername(); QString getStatusMessage(); - QString getSelfId(); + ToxID getSelfId(); void increaseVideoBusyness(); void decreaseVideoBusyness(); diff --git a/corestructs.h b/corestructs.h index ebaab4534..a2bb6f31f 100644 --- a/corestructs.h +++ b/corestructs.h @@ -10,6 +10,32 @@ class QTimer; enum class Status : int {Online = 0, Away, Busy, Offline}; +#define TOX_ID_PUBLIC_KEY_LENGTH 64 +#define TOX_ID_NO_SPAM_LENGTH 8 +#define TOX_ID_CHECKSUM_LENGTH 4 + +struct ToxID +{ + QString publicKey; + QString noSpam; + QString checkSum; + + QString toString() const + { + return publicKey + noSpam + checkSum; + } + + ToxID static fromString(QString id) + { + ToxID toxID; + toxID.publicKey = id.left(TOX_ID_PUBLIC_KEY_LENGTH); + toxID.noSpam = id.mid(TOX_ID_PUBLIC_KEY_LENGTH, TOX_ID_NO_SPAM_LENGTH); + toxID.checkSum = id.right(TOX_ID_CHECKSUM_LENGTH); + return toxID; + } + +}; + struct DhtServer { QString name; diff --git a/misc/smileypack.cpp b/misc/smileypack.cpp index 5af07194f..57a754c76 100644 --- a/misc/smileypack.cpp +++ b/misc/smileypack.cpp @@ -40,24 +40,38 @@ SmileyPack& SmileyPack::getInstance() return smileyPack; } -QList > SmileyPack::listSmileyPacks(const QString &path) +QList > SmileyPack::listSmileyPacks(const QStringList &paths) { QList > smileyPacks; - QDir dir(path); - foreach (const QString& subdirectory, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) + for (QString path : paths) { - dir.cd(subdirectory); + if (path.leftRef(1) == "~") + path.replace(0, 1, QDir::homePath()); - QFileInfoList entries = dir.entryInfoList(QStringList() << "emoticons.xml", QDir::Files); - if (entries.size() > 0) // does it contain a file called emoticons.xml? + QDir dir(path); + if (!dir.exists()) + continue; + + for (const QString& subdirectory : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { - QString packageName = dir.dirName(); - QString relPath = QDir(QCoreApplication::applicationDirPath()).relativeFilePath(entries[0].absoluteFilePath()); - smileyPacks << QPair(packageName, relPath); + dir.cd(subdirectory); + + QFileInfoList entries = dir.entryInfoList(QStringList() << "emoticons.xml", QDir::Files); + if (entries.size() > 0) // does it contain a file called emoticons.xml? + { + QString packageName = dir.dirName(); + QString absPath = entries[0].absoluteFilePath(); + QString relPath = QDir(QCoreApplication::applicationDirPath()).relativeFilePath(absPath); + + if (relPath.leftRef(2) == "..") + smileyPacks << QPair(packageName, absPath); + else + smileyPacks << QPair(packageName, relPath); // use relative path for subdirectories + } + + dir.cdUp(); } - - dir.cdUp(); } return smileyPacks; diff --git a/misc/smileypack.h b/misc/smileypack.h index 9f4ea31ba..1d4c9ef30 100644 --- a/misc/smileypack.h +++ b/misc/smileypack.h @@ -22,7 +22,10 @@ #include #include -#define SMILEYPACK_DEFAULT_PATH "./smileys" +#define SMILEYPACK_SEARCH_PATHS \ + { \ + "./smileys", "/usr/share/qtox/smileys", "/usr/share/emoticons", "~/.kde4/share/emoticons", "~/.kde/share/emoticons" \ + } //maps emoticons to smileys class SmileyPack : public QObject @@ -30,10 +33,10 @@ class SmileyPack : public QObject Q_OBJECT public: static SmileyPack& getInstance(); - static QList> listSmileyPacks(const QString& path = SMILEYPACK_DEFAULT_PATH); + static QList > listSmileyPacks(const QStringList& paths = SMILEYPACK_SEARCH_PATHS); static bool isValid(const QString& filename); - bool load(const QString &filename); + bool load(const QString& filename); QString smileyfied(QString msg); QList getEmoticons() const; QString getAsRichText(const QString& key); diff --git a/qtox.pro b/qtox.pro index 7399e260f..5c550cd1f 100644 --- a/qtox.pro +++ b/qtox.pro @@ -32,7 +32,9 @@ CONFIG += c++11 TRANSLATIONS = translations/de.ts \ translations/fr.ts \ translations/it.ts \ - translations/ru.ts + translations/ru.ts \ + translations/pl.ts \ + translations/mannol.ts RESOURCES += res.qrc diff --git a/res.qrc b/res.qrc index 6a121b0ad..f258db6f5 100644 --- a/res.qrc +++ b/res.qrc @@ -139,5 +139,7 @@ img/settings/identity.png img/settings/privacy.png img/settings/av.png + translations/pl.qm + translations/mannol.qm diff --git a/translations/de.qm b/translations/de.qm index c5132443e..8a6769d20 100644 Binary files a/translations/de.qm and b/translations/de.qm differ diff --git a/translations/de.ts b/translations/de.ts index ab61ba9ad..f8b790182 100644 --- a/translations/de.ts +++ b/translations/de.ts @@ -1,75 +1,102 @@ + + AVPage + + + Video Settings + + + + + + Show video preview + On a button + + + + + Hide video preview + On a button + + + AddFriendForm - + Add Friends Freunde hinzufügen - + Tox ID Tox ID of the person you're sending a friend request to Tox ID - + Message The message you send in friend requests Nachricht - + Send friend request Freundschaftseinladung versenden - + Tox me maybe? Default message in friend requests if the field is left blank. Write something appropriate! Lass uns Toxen! - + Please fill in a valid Tox ID Tox ID of the friend you're sending a friend request to Bitte gib eine gültige Tox ID ein - + + You can't add yourself as a friend! + When trying to add your own Tox ID as friend + + + + This address does not exist The DNS gives the Tox ID associated to toxme.se addresses - + Error while looking up DNS The DNS gives the Tox ID associated to toxme.se addresses Fehler beim Auflösen des DNS - + Unexpected number of text records Error with the DNS Unererwartete Anzahl von Texteinträgen - + Unexpected number of values in text record Error with the DNS Unerwartete Anzahl von Werten innerhalb des Texteintrages - + The DNS lookup does not contain any Tox ID Error with the DNS Der DNS Eintrag enthält keine gültige TOX ID - + The DNS lookup does not contain a valid Tox ID Error with the DNS Der DNS Eintrag enthält keine gültige TOX ID @@ -78,74 +105,77 @@ Camera - Camera eror - Kamerafehler + Kamerafehler - Camera format %1 not supported, can't use the camera - Kameraformat %1 wird nicht unterstützt. Die Kamera kann nicht verwendet werden + Kameraformat %1 wird nicht unterstützt. Die Kamera kann nicht verwendet werden ChatForm - + Send a file Datei versenden - - Save chat log - Chatverlauf speichern + Chatverlauf speichern CopyableElideLabel - Copy - Kopieren + Kopieren - FileTransfertWidget + FileTransferInstance - + Save a file Title of the file saving dialog - Datei speichern + Datei speichern - + Location not writable Title of permissions popup - + You do not have permission to write that location. Choose another, or cancel the save dialog. text of permissions popup + + FileTransfertWidget + + Save a file + Title of the file saving dialog + Datei speichern + + FilesForm - + Transfered Files "Headline" of the window - + Downloads - + Uploads @@ -189,69 +219,149 @@ FriendWidget - + Copy friend ID Menu to copy the Tox ID of that friend Tox ID kopieren - + Invite in group Menu to invite a friend in a groupchat In Gruppe einladen - + Remove friend Menu to remove the friend from our friendlist Freund entfernen + + GeneralPage + + + General Settings + + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + IPv6 aktivieren (empfohlen) + + + + Use translations + Text on a checkbox to enable translations + + + + + Make Tox portable + Text on a checkbox to make qTox a portable application + + + + + Save settings to the working directory instead of the usual conf dir + describes makeToxPortable checkbox + + + + + Theme + + + + + Smiley Pack + + + + + GenericChatForm + + + + Save chat log + Chatverlauf speichern + + GroupChatForm - + %1 users in chat Number of users in chat %1 Personen im Chat - + <Unknown> <Unbekannt> - + %1 users in chat %1 Personen im Chat - Save chat log - Chatverlauf speichern + Chatverlauf speichern GroupWidget - - + + %1 users in chat %1 Personen im Chat - - + + 0 users in chat 0 Personen im Chat - + Quit group Menu to quit a groupchat Gruppe verlassen + + IdentityPage + + + Public Information + + + + + Name + Username/nick + Benutzername + + + + Status + Status message + Status + + + + Tox ID + Tox ID + + + + Your Tox ID + + + MainWindow @@ -303,73 +413,81 @@ SelfCamView - + Tox video test Title of the window to test the video/webcam Tox Video testen - SettingsForm + SettingsDialog - - User Settings - "Headline" of the window - Einstellungen + + qTox – Settings + - - Name - Username/nick - Benutzername + + General + - - Status - Status message - Status + + Identity + - - (click here to copy) - Click on this text to copy TID to clipboard + + Privacy - - Test video - Text on a button to test the video/webcam - Video testen + + Audio/Video + - - Enable IPv6 (recommended) - Text on a checkbox to enable IPv6 - IPv6 aktivieren (empfohlen) + + Ok + - - Use translations - Text on a checkbox to enable translations + + Cancel - - Make Tox portable - Text on a checkbox to make qTox a portable application + + Apply + + + SettingsForm - - Save settings to the working directory instead of the usual conf dir - describes makeToxPortable checkbox - + User Settings + "Headline" of the window + Einstellungen - - Smiley Pack - Text on smiley pack label - + Name + Username/nick + Benutzername + + + Status + Status message + Status + + + Test video + Text on a button to test the video/webcam + Video testen + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + IPv6 aktivieren (empfohlen) @@ -395,22 +513,28 @@ Strg+Q - + Online Button to set your status to 'Online' Online - + Away Button to set your status to 'Away' Abwesend - + Busy Button to set your status to 'Busy' Beschäftigt + + + <Unknown> + Placeholder when we don't know someone's name in a group chat + <Unbekannt> + diff --git a/translations/fr.qm b/translations/fr.qm index e3d68b2e1..278415266 100644 Binary files a/translations/fr.qm and b/translations/fr.qm differ diff --git a/translations/fr.ts b/translations/fr.ts index 435d022c7..2057d56da 100644 --- a/translations/fr.ts +++ b/translations/fr.ts @@ -1,75 +1,102 @@ + + AVPage + + + Video Settings + Options vidéo + + + + + Show video preview + On a button + Montrer l'aperçu vidéo + + + + Hide video preview + On a button + Cacher l'aperçu vidéo + + 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 - + + You can't add yourself as a friend! + When trying to add your own Tox ID as friend + Vous ne pouvez pas vous ajouter vous même en temps qu'ami! + + + This address does not exist The DNS gives the Tox ID associated to toxme.se addresses - + Cette addresse n'existe pas - + 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 @@ -78,76 +105,79 @@ Camera - Camera eror - Erreur de caméra + 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 + 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 + Sauvegarder l'historique de conversation CopyableElideLabel - Copy - Copier + Copier - FileTransfertWidget + FileTransferInstance - + Save a file Title of the file saving dialog Sauvegarder un fichier - + Location not writable Title of permissions popup - + Impossible d'écrire ici - + You do not have permission to write that location. Choose another, or cancel the save dialog. text of permissions popup - + Vous n'avez pas la permission d'écrire ici. Choisissez un audre endroit, ou annulez. + + + + FileTransfertWidget + + Save a file + Title of the file saving dialog + Sauvegarder un fichier FilesForm - + Transfered Files "Headline" of the window - + Transfers - + Downloads - + Téléchargements - + Uploads - + Envois @@ -189,187 +219,275 @@ 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 + + GeneralPage + + + General Settings + Options Générales + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + Activer IPv6 (recommandé) + + + + Use translations + Text on a checkbox to enable translations + Utiliser les traductions + + + + Make Tox portable + Text on a checkbox to make qTox a portable application + Rendre Tox portable + + + + Save settings to the working directory instead of the usual conf dir + describes makeToxPortable checkbox + Sauvegarde les options dans le dossier courant au lieu du dossier de configuration habituel + + + + Theme + Thème + + + + Smiley Pack + Pack de smileys + + + + GenericChatForm + + + + Save chat log + Sauvegarder l'historique de conversation + + 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 + 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 + + IdentityPage + + + Public Information + Informations Publiques + + + + Name + Username/nick + Nom + + + + Status + Status message + Status + + + + Tox ID + ID Tox + + + + Your Tox ID + Votre ID Tox + + MainWindow qTox - + qTox Your name - Votre nom + Votre nom Your status - Votre status + Votre status Add friends - + Ajouter des amis Create a group chat - + Creer un groupe View completed file transfers - + Voir les transfers de fichiers terminés Change your settings - + Changer les options Close - Fermer + Fermer Ctrl+Q - Ctrl+Q + Ctrl+Q SelfCamView - + Tox video test Title of the window to test the video/webcam Test vidéo Tox + + SettingsDialog + + + qTox – Settings + qTox — Options + + + + General + General + + + + Identity + Identité + + + + Privacy + Vie Privée + + + + Audio/Video + Audio/Vidéo + + + + Ok + Ok + + + + Cancel + Annuler + + + + Apply + Appliquer + + SettingsForm - User Settings "Headline" of the window - Configuration + Configuration - Name Username/nick - Nom + Nom - Status Status message - Status - - - - (click here to copy) - Click on this text to copy TID to clipboard - + Status - Test video Text on a button to test the video/webcam - Tester la vidéo + Tester la vidéo - Enable IPv6 (recommended) Text on a checkbox to enable IPv6 - Activer IPv6 (recommandé) - - - - Use translations - Text on a checkbox to enable translations - - - - - Make Tox portable - Text on a checkbox to make qTox a portable application - - - - - Save settings to the working directory instead of the usual conf dir - describes makeToxPortable checkbox - - - - - Smiley Pack - Text on smiley pack label - + Activer IPv6 (recommandé) @@ -395,22 +513,28 @@ Ctrl+Q - + Online Button to set your status to 'Online' - Connecté + Connecté - + Away Button to set your status to 'Away' - Indisponnible + Indisponnible - + Busy Button to set your status to 'Busy' - Occupé + Occupé + + + + <Unknown> + Placeholder when we don't know someone's name in a group chat + <Inconnu> diff --git a/translations/it.qm b/translations/it.qm index 890aaaea2..2523c49cb 100644 Binary files a/translations/it.qm and b/translations/it.qm differ diff --git a/translations/it.ts b/translations/it.ts index 65a34eb9f..35b4c928d 100644 --- a/translations/it.ts +++ b/translations/it.ts @@ -1,75 +1,102 @@ + + AVPage + + + Video Settings + + + + + + Show video preview + On a button + + + + + Hide video preview + On a button + + + AddFriendForm - + Add Friends Aggiungi Contatto - + Tox ID Tox ID of the person you're sending a friend request to Tox ID - + Message The message you send in friend requests Messaggio - + Send friend request Invia richiesta d'amicizia - + Tox me maybe? Default message in friend requests if the field is left blank. Write something appropriate! Permettimi di aggiungerti alla mia lista contatti - + Please fill in a valid Tox ID Tox ID of the friend you're sending a friend request to Inserisci un Tox ID valido - + + You can't add yourself as a friend! + When trying to add your own Tox ID as friend + + + + This address does not exist The DNS gives the Tox ID associated to toxme.se addresses Questo indirizzo non esiste - + Error while looking up DNS The DNS gives the Tox ID associated to toxme.se addresses Errore nel consultare il server DNS - + Unexpected number of text records Error with the DNS Numero inaspettato di text-records - + Unexpected number of values in text record Error with the DNS Numero inaspettato di valori nel text-record - + The DNS lookup does not contain any Tox ID Error with the DNS La risposta del server DNS non contiene nessun Tox ID - + The DNS lookup does not contain a valid Tox ID Error with the DNS La risposta del server DNS non contiene un Tox ID valido @@ -78,7 +105,7 @@ ChatForm - + Send a file Invia un file @@ -86,19 +113,19 @@ FileTransferInstance - + Save a file Title of the file saving dialog Salva file - + Location not writable Title of permissions popup Errore - + You do not have permission to write that location. Choose another, or cancel the save dialog. text of permissions popup Non hai sufficienti permessi per scrivere in questa locazione. Scegli un'altra posizione, o annulla il salvataggio. @@ -107,18 +134,18 @@ FilesForm - + Transfered Files "Headline" of the window Files Trasferiti - + Downloads Ricevuti - + Uploads Inviati @@ -162,29 +189,71 @@ FriendWidget - + Copy friend ID Menu to copy the Tox ID of that friend Copia Tox ID del contatto - + Invite in group Menu to invite a friend in a groupchat Invita nel gruppo - + Remove friend Menu to remove the friend from our friendlist Rimuovi contatto + + GeneralPage + + + General Settings + + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + Abilita IPv6 (consigliato) + + + + Use translations + Text on a checkbox to enable translations + Abilita traduzioni + + + + Make Tox portable + Text on a checkbox to make qTox a portable application + Rendi qTox portabile + + + + Save settings to the working directory instead of the usual conf dir + describes makeToxPortable checkbox + Slava le impostazioni nella directory di lavoro corrente, invece della directory di default + + + + Theme + + + + + Smiley Pack + Emoticons + + GenericChatForm - - + + Save chat log Salva il log della chat @@ -192,18 +261,18 @@ GroupChatForm - + %1 users in chat Number of users in chat %1 utenti in chat - + <Unknown> <Sconosciuto> - + %1 users in chat %1 utenti in chat @@ -229,6 +298,36 @@ Esci dal gruppo + + IdentityPage + + + Public Information + + + + + Name + Username/nick + Nome + + + + Status + Status message + Stato + + + + Tox ID + Tox ID + + + + Your Tox ID + + + MainWindow @@ -280,94 +379,133 @@ SelfCamView - + Tox video test Title of the window to test the video/webcam qTox video test + + SettingsDialog + + + qTox – Settings + + + + + General + + + + + Identity + + + + + Privacy + + + + + Audio/Video + + + + + Ok + + + + + Cancel + + + + + Apply + + + SettingsForm - User Settings "Headline" of the window - Impostazioni + Impostazioni - Name Username/nick - Nome + Nome - Status Status message - Stato + Stato - (click here to copy) Click on this text to copy TID to clipboard - (clicca qui per copiare) + (clicca qui per copiare) - Test video Text on a button to test the video/webcam - Prova la webcam + Prova la webcam - Enable IPv6 (recommended) Text on a checkbox to enable IPv6 - Abilita IPv6 (consigliato) + Abilita IPv6 (consigliato) - Use translations Text on a checkbox to enable translations - Abilita traduzioni + Abilita traduzioni - Make Tox portable Text on a checkbox to make qTox a portable application - Rendi qTox portabile + Rendi qTox portabile - Save settings to the working directory instead of the usual conf dir describes makeToxPortable checkbox - Slava le impostazioni nella directory di lavoro corrente, invece della directory di default + Slava le impostazioni nella directory di lavoro corrente, invece della directory di default - Smiley Pack Text on smiley pack label - Emoticons + Emoticons Widget - + Online Button to set your status to 'Online' Online - + Away Button to set your status to 'Away' Assente - + Busy Button to set your status to 'Busy' Occupato + + + <Unknown> + Placeholder when we don't know someone's name in a group chat + <Sconosciuto> + diff --git a/translations/mannol.qm b/translations/mannol.qm new file mode 100644 index 000000000..1d4f6d7b6 Binary files /dev/null and b/translations/mannol.qm differ diff --git a/translations/mannol.ts b/translations/mannol.ts new file mode 100644 index 000000000..ccc08ff82 --- /dev/null +++ b/translations/mannol.ts @@ -0,0 +1,458 @@ + + + + + AVPage + + + Video Settings + + + + + + Show video preview + On a button + + + + + Hide video preview + On a button + + + + + AddFriendForm + + + Add Friends + + + + + Tox ID + Tox ID of the person you're sending a friend request to + + + + + 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 + + + + + You can't add yourself as a friend! + When trying to add your own Tox ID as friend + + + + + This address does not exist + The DNS gives the Tox ID associated to toxme.se addresses + + + + + Error while looking up DNS + The DNS gives the Tox ID associated to toxme.se addresses + + + + + 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 + + + + + + The DNS lookup does not contain a valid Tox ID + Error with the DNS + + + + + ChatForm + + + Send a file + + + + + FileTransferInstance + + + Save a file + Title of the file saving dialog + + + + + Location not writable + Title of permissions popup + + + + + You do not have permission to write that location. Choose another, or cancel the save dialog. + text of permissions popup + + + + + FilesForm + + + Transfered Files + "Headline" of the window + + + + + Downloads + + + + + Uploads + + + + + FriendRequestDialog + + + Friend request + Title of the window to aceept/deny a friend request + + + + + Someone wants to make friends with you + Ayy ! You have mothafucking friend request you little bitch ! + + + + User 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 + + + + + Invite in group + Menu to invite a friend in a groupchat + + + + + Remove friend + Menu to remove the friend from our friendlist + + + + + GeneralPage + + + General Settings + + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + + + + + Use translations + Text on a checkbox to enable translations + + + + + Make Tox portable + Text on a checkbox to make qTox a portable application + + + + + Save settings to the working directory instead of the usual conf dir + describes makeToxPortable checkbox + + + + + Theme + + + + + Smiley Pack + + + + + GenericChatForm + + + + Save chat log + + + + + GroupChatForm + + + %1 users in chat + Number of users in chat + + + + + <Unknown> + + + + + %1 users in chat + + + + + GroupWidget + + + + %1 users in chat + + + + + + 0 users in chat + + + + + Quit group + Menu to quit a groupchat + + + + + IdentityPage + + + Public Information + + + + + Name + Username/nick + + + + + Status + Status message + + + + + Tox ID + + + + + Your Tox ID + + + + + MainWindow + + + qTox + + + + + Your name + + + + + Your status + + + + + Add friends + + + + + Create a group chat + + + + + View completed file transfers + + + + + Change your settings + + + + + Close + + + + + Ctrl+Q + + + + + SelfCamView + + + Tox video test + Title of the window to test the video/webcam + + + + + SettingsDialog + + + qTox – Settings + + + + + General + + + + + Identity + + + + + Privacy + + + + + Audio/Video + + + + + Ok + + + + + Cancel + + + + + Apply + + + + + Widget + + + Online + Button to set your status to 'Online' + + + + + Away + Button to set your status to 'Away' + + + + + Busy + Button to set your status to 'Busy' + + + + + <Unknown> + Placeholder when we don't know someone's name in a group chat + + + + diff --git a/translations/pl.qm b/translations/pl.qm new file mode 100644 index 000000000..d05682dd1 Binary files /dev/null and b/translations/pl.qm differ diff --git a/translations/pl.ts b/translations/pl.ts new file mode 100644 index 000000000..edff773c3 --- /dev/null +++ b/translations/pl.ts @@ -0,0 +1,462 @@ + + + + + AVPage + + + Video Settings + Ustawienia wideo + + + + + Show video preview + On a button + + + + + Hide video preview + On a button + + + + + AddFriendForm + + + Add Friends + Dodaj znajomych + + + + Tox ID + Tox ID of the person you're sending a friend request to + Tox ID + + + + Message + The message you send in friend requests + Wiadomość + + + + Send friend request + Wyślij zapytanie do znajomego + + + + Tox me maybe? + Default message in friend requests if the field is left blank. Write something appropriate! + Może Tox ze mną? + + + + Please fill in a valid Tox ID + Tox ID of the friend you're sending a friend request to + Proszę wpisać poprawny Tox ID + + + + You can't add yourself as a friend! + When trying to add your own Tox ID as friend + Nie możesz dodać siebie jako znajomego! + + + + This address does not exist + The DNS gives the Tox ID associated to toxme.se addresses + Ten adres nie istnieje + + + + Error while looking up DNS + The DNS gives the Tox ID associated to toxme.se addresses + Błąd podczas sprawdzania DNS + + + + Unexpected number of text records + Error with the DNS + Nieoczekiwana liczba wpisów tekstowych + + + + Unexpected number of values in text record + Error with the DNS + Nieoczekiwana liczba wartości we wpisie tekstowym + + + + The DNS lookup does not contain any Tox ID + Error with the DNS + DNS nie zawiera żadnego Tox ID + + + + + The DNS lookup does not contain a valid Tox ID + Error with the DNS + DNS nie zawiera poprawnego Tox ID + + + + ChatForm + + + Send a file + Wyślij plik + + + + FileTransferInstance + + + Save a file + Title of the file saving dialog + Zapisz plik + + + + Location not writable + Title of permissions popup + Nie można zapisać w lokacji + + + + You do not have permission to write that location. Choose another, or cancel the save dialog. + text of permissions popup + Nie masz uprawnienia by zapisać w tej lokacji. Wybierz inną lub anuluj zapis. + + + + FilesForm + + + Transfered Files + "Headline" of the window + Przesłane pliki + + + + Downloads + Pobrane + + + + Uploads + Wysłane + + + + FriendRequestDialog + + + Friend request + Title of the window to aceept/deny a friend request + no idea how it shoule be translated + Zapytanie znajomego + + + + Someone wants to make friends with you + Ktoś chce być twoim znajomym + + + + User ID: + ID użytkownika: + + + + Friend request message: + better wording needed? + Wiadomość w zapytaniu do znajomej/go: + + + + Accept + Accept a friend request + Zaakceptuj + + + + Reject + Reject a friend request + Odrzuć + + + + FriendWidget + + + Copy friend ID + Menu to copy the Tox ID of that friend + Kopiuj ID znajomej/go + + + + Invite in group + Menu to invite a friend in a groupchat + Zaproś do grupy + + + + Remove friend + Menu to remove the friend from our friendlist + Usuń znajomego + + + + GeneralPage + + + General Settings + Główne ustawienia + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + Użyj IPv6 (rekomendowane) + + + + Use translations + Text on a checkbox to enable translations + Użyj tłumaczenia + + + + Make Tox portable + Text on a checkbox to make qTox a portable application + Zrób Tox przenośnym + + + + Save settings to the working directory instead of the usual conf dir + describes makeToxPortable checkbox + Zamiast domyślnego katalogu użyj obecnego do zapisania ustawień + + + + Theme + Motyw + + + + Smiley Pack + needs better translation + Paczka uśmiechów + + + + GenericChatForm + + + + Save chat log + Zapisz historię rozmowy + + + + GroupChatForm + + + %1 users in chat + Number of users in chat + %1 użytkowników w czacie + + + + <Unknown> + <Nieznany/a> + + + + %1 users in chat + %1 użytkowników w czacie + + + + GroupWidget + + + + %1 users in chat + %1 użytkowników w czacie + + + + + 0 users in chat + 0 użytkowników w czacie + + + + Quit group + Menu to quit a groupchat + Opuść grupę + + + + IdentityPage + + + Public Information + Informacja publiczna + + + + Name + Username/nick + Nick + + + + Status + Status message + Status + + + + Tox ID + Tox ID + + + + Your Tox ID + Twój Tox ID + + + + MainWindow + + + qTox + qTox + + + + Your name + Twój nick + + + + Your status + Twój status + + + + Add friends + Dodaj znajomych + + + + Create a group chat + Utwórz czat grupowy + + + + View completed file transfers + Zobacz zakończone transfery plików + + + + Change your settings + translated as "change settings"; seems to be simpler this way + Zmień ustawienia + + + + Close + Zamknij + + + + Ctrl+Q + Ctrl+Q + + + + SelfCamView + + + Tox video test + Title of the window to test the video/webcam + Tox test wideo + + + + SettingsDialog + + + qTox – Settings + qTox – Ustawienia + + + + General + Główne + + + + Identity + Tożsamość + + + + Privacy + Prywatność + + + + Audio/Video + Audio/Wideo + + + + Ok + Ok + + + + Cancel + Anuluj + + + + Apply + Zastosuj + + + + Widget + + + Online + Button to set your status to 'Online' + Online + + + + Away + Button to set your status to 'Away' + Nieobecny/a + + + + Busy + Button to set your status to 'Busy' + Zajęty/a + + + + <Unknown> + Placeholder when we don't know someone's name in a group chat + <Nieznany/a> + + + diff --git a/translations/ru.qm b/translations/ru.qm index c77294313..50ef1c79f 100644 Binary files a/translations/ru.qm and b/translations/ru.qm differ diff --git a/translations/ru.ts b/translations/ru.ts index 1e2118770..56c4aaebf 100644 --- a/translations/ru.ts +++ b/translations/ru.ts @@ -1,77 +1,109 @@ + + AVPage + + + Video Settings + Настройки видео + + + + + Show video preview + On a button + + + + + Hide video preview + On a button + + + 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 - + + You can't add yourself as a friend! + When trying to add your own Tox ID as friend + + + + You can't add yourself as a friend ! + When trying to add your own Tox ID as friend + Нельзя добавить самого себя в друзья! + + + This address does not exist The DNS gives the Tox ID associated to toxme.se addresses Нет такого адреса - + 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 @@ -80,74 +112,87 @@ Camera - Camera eror - Ошибка камеры + Ошибка камеры - Camera format %1 not supported, can't use the camera - Формат камеры %1 не поддерживается, невозможно использовать камеру + Формат камеры %1 не поддерживается, невозможно использовать камеру ChatForm - + Send a file Отправить файл - - Save chat log - Сохранить лог чата + Сохранить лог чата CopyableElideLabel - Copy - Копировать + Копировать - FileTransfertWidget + FileTransferInstance - + Save a file Title of the file saving dialog Сохранить файл - + Location not writable Title of permissions popup - + Непригодная для записи локация - + You do not have permission to write that location. Choose another, or cancel the save dialog. text of permissions popup - + У вас нет прав записи в эту локацию. Выберете другую или закройте диалог сохранения. + + + + FileTransfertWidget + + Save a file + Title of the file saving dialog + Сохранить файл + + + Location not writable + Title of permissions popup + Непригодная для записи локация + + + You do not have permission to write that location. Choose another, or cancel the save dialog. + text of permissions popup + У вас нет прав записи в эту локацию. Выберете другую или закройте диалог сохранения. FilesForm - + Transfered Files "Headline" of the window Переданные файлы - + Downloads Загрузки - + Uploads Выгрузки @@ -193,246 +238,369 @@ 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 Удалить друга + + GeneralPage + + + General Settings + Основные настройки + + + + Enable IPv6 (recommended) + Text on a checkbox to enable IPv6 + Включить IPv6 (рекомендуется) + + + + Use translations + Text on a checkbox to enable translations + Русскоязычный интерфейс + + + + Make Tox portable + Text on a checkbox to make qTox a portable application + Портативный режим + + + + Save settings to the working directory instead of the usual conf dir + describes makeToxPortable checkbox + Сохранять настройки в рабочую директорию вместо страндартной директории настроек + + + + Theme + Тема + + + + Smiley Pack + Набор смайликов + + + + GenericChatForm + + + + Save chat log + Сохранить лог чата + + 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 Ни одного пользователя в чате + + IdentityPage + + + Public Information + Публичные данные + + + + Name + Username/nick + Имя + + + + Status + Status message + Статус + + + + Tox ID + Tox ID + + + + Your Tox ID + Ваш Tox ID + + MainWindow qTox - + qTox Your name - Ваше имя + Ваше имя Your status - Ваш статус + Ваш статус Add friends - Добавить друзей + Добавить друзей Create a group chat - Создать групповой чат + Создать групповой чат View completed file transfers - + Завершённые файлопередачи Change your settings - Изменить ваши настройки + Изменить ваши настройки Close - Закрыть + Закрыть Ctrl+Q - Ctrl+Q + Ctrl+Q SelfCamView - + Tox video test Title of the window to test the video/webcam Проверка видео + + SettingsDialog + + Settings Dialog + Диалог настроек + + + + qTox – Settings + + + + + General + Основное + + + + Identity + Личные данные + + + + Privacy + Безопасность + + + + Audio/Video + Аудио и видео + + + + Ok + ОК + + + + Cancel + Отмена + + + + Apply + Применить + + SettingsForm - User Settings "Headline" of the window - Пользовательские настройки + Пользовательские настройки - Name Username/nick - Имя + Имя - Status Status message - Статус + Статус - (click here to copy) Click on this text to copy TID to clipboard - (нажмите здесь чтобы скопировать) + (нажмите здесь чтобы скопировать) - Test video Text on a button to test the video/webcam - Проверить видео + Проверить видео - Enable IPv6 (recommended) Text on a checkbox to enable IPv6 - Включить IPv6 (рекомендуется) + Включить IPv6 (рекомендуется) - Use translations Text on a checkbox to enable translations Так гораздо понятнее, чем «использовать переводы» - Русскоязычный интерфейс + Русскоязычный интерфейс - Make Tox portable Text on a checkbox to make qTox a portable application - Портативный режим + Портативный режим - Save settings to the working directory instead of the usual conf dir describes makeToxPortable checkbox - + Сохранять настройки в рабочую директорию вместо страндартной директории настроек - Smiley Pack Text on smiley pack label - + Набор смайликов Widget Tox - Tox + Tox Your name - Ваше имя + Ваше имя Your status - Ваш статус + Ваш статус Add friends - Добавить друзей + Добавить друзей Create a group chat - Создать групповой чат + Создать групповой чат (button inactive currently) - (кнопка на данный момент неактивна) + (кнопка на данный момент неактивна) Change your settings - Изменить ваши настройки + Изменить ваши настройки Close - Закрыть + Закрыть Ctrl+Q - 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' - Занят + Занят + + + + <Unknown> + Placeholder when we don't know someone's name in a group chat + <Неизвестно> diff --git a/ui/chatArea/innerStyle.css b/ui/chatArea/innerStyle.css index 61380b073..28bcb32c8 100644 --- a/ui/chatArea/innerStyle.css +++ b/ui/chatArea/innerStyle.css @@ -22,8 +22,8 @@ div.date { white-space: nowrap; } -div.quote { - background-color: #6bc260; +span.quote { + color: #6bc260; } div.green { diff --git a/widget/chatareawidget.cpp b/widget/chatareawidget.cpp index 203633386..f06ec9534 100644 --- a/widget/chatareawidget.cpp +++ b/widget/chatareawidget.cpp @@ -20,6 +20,7 @@ #include #include #include +#include ChatAreaWidget::ChatAreaWidget(QWidget *parent) : QTextBrowser(parent) @@ -44,10 +45,10 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent) : chatTextTable->format().setCellSpacing(2); chatTextTable->format().setWidth(QTextLength(QTextLength::PercentageLength,100)); - nameFormat.setAlignment(Qt::AlignRight); - nameFormat.setNonBreakableLines(true); - dateFormat.setAlignment(Qt::AlignLeft); - dateFormat.setNonBreakableLines(true); +// nameFormat.setAlignment(Qt::AlignRight); +// nameFormat.setNonBreakableLines(true); +// dateFormat.setAlignment(Qt::AlignLeft); +// dateFormat.setNonBreakableLines(true); connect(this, &ChatAreaWidget::anchorClicked, this, &ChatAreaWidget::onAnchorClicked); connect(verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged())); @@ -104,15 +105,13 @@ void ChatAreaWidget::insertMessage(ChatAction *msgAction) checkSlider(); int row = chatTextTable->rows() - 1; - chatTextTable->cellAt(row,0).firstCursorPosition().setBlockFormat(nameFormat); - chatTextTable->cellAt(row,2).firstCursorPosition().setBlockFormat(dateFormat); QTextCursor cur = chatTextTable->cellAt(row,1).firstCursorPosition(); cur.clearSelection(); cur.setKeepPositionOnInsert(true); + chatTextTable->appendRows(1); chatTextTable->cellAt(row,0).firstCursorPosition().insertHtml(msgAction->getName()); chatTextTable->cellAt(row,1).firstCursorPosition().insertHtml(msgAction->getMessage()); - chatTextTable->cellAt(row,2).firstCursorPosition().insertHtml(msgAction->getDate()); - chatTextTable->appendRows(1); + chatTextTable->cellAt(row,2).firstCursorPosition().insertText(msgAction->getDate()); msgAction->setTextCursor(cur); diff --git a/widget/form/addfriendform.cpp b/widget/form/addfriendform.cpp index 3a44ae672..55f5e80dd 100644 --- a/widget/form/addfriendform.cpp +++ b/widget/form/addfriendform.cpp @@ -95,8 +95,8 @@ void AddFriendForm::onSendTriggered() if (id.isEmpty()) { 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)) { - if (id.toUpper() == Core::getInstance()->getSelfId().toUpper()) - showWarning(tr("You can't add yourself as a friend !","When trying to add your own Tox ID as friend")); + if (id.toUpper() == Core::getInstance()->getSelfId().toString().toUpper()) + showWarning(tr("You can't add yourself as a friend!","When trying to add your own Tox ID as friend")); else emit friendRequested(id, getMessage()); this->toxId.setText(""); diff --git a/widget/settingsdialog.cpp b/widget/settingsdialog.cpp new file mode 100644 index 000000000..d81973286 --- /dev/null +++ b/widget/settingsdialog.cpp @@ -0,0 +1,380 @@ +#include "settingsdialog.h" +#include "settings.h" +#include "widget.h" +#include "camera.h" +#include "selfcamview.h" +#include "core.h" +#include "smileypack.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// ======================================= +// settings pages +//======================================== +class GeneralPage : public QWidget +{ + Q_OBJECT +public: + GeneralPage(QWidget *parent = 0) : + QWidget(parent) + { + QGroupBox *group = new QGroupBox(tr("General Settings"), this); + + enableIPv6 = new QCheckBox(this); + enableIPv6->setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6")); + useTranslations = new QCheckBox(this); + useTranslations->setText(tr("Use translations","Text on a checkbox to enable translations")); + makeToxPortable = new QCheckBox(this); + makeToxPortable->setText(tr("Make Tox portable","Text on a checkbox to make qTox a portable application")); + makeToxPortable->setToolTip(tr("Save settings to the working directory instead of the usual conf dir","describes makeToxPortable checkbox")); + + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->addWidget(enableIPv6); + vLayout->addWidget(useTranslations); + vLayout->addWidget(makeToxPortable); + group->setLayout(vLayout); + + // theme + QGroupBox* themeGroup = new QGroupBox(tr("Theme")); + QLabel* smileyLabel = new QLabel(tr("Smiley Pack")); + smileyPack = new QComboBox(this); + + auto smileyPacks = SmileyPack::listSmileyPacks(); + for(auto pack : smileyPacks) + smileyPack->addItem(QString("%1 (%2)").arg(pack.first).arg(pack.second), pack.second); + + QVBoxLayout* themeLayout = new QVBoxLayout(); + themeLayout->addWidget(smileyLabel); + themeLayout->addWidget(smileyPack); + themeGroup->setLayout(themeLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + mainLayout->addWidget(group); + mainLayout->addWidget(themeGroup); + mainLayout->addStretch(1); + setLayout(mainLayout); + } + + QCheckBox* enableIPv6; + QCheckBox* useTranslations; + QCheckBox* makeToxPortable; + QComboBox* smileyPack; +}; + +class IdentityPage : public QWidget +{ + Q_OBJECT +public: + IdentityPage(QWidget* parent = 0) : + QWidget(parent) + { + // public + QGroupBox *publicGroup = new QGroupBox(tr("Public Information"), this); + QLabel* userNameLabel = new QLabel(tr("Name","Username/nick"), this); + userName = new QLineEdit(this); + QLabel* statusMessageLabel = new QLabel(tr("Status","Status message"), this); + statusMessage = new QLineEdit(this); + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->addWidget(userNameLabel); + vLayout->addWidget(userName); + vLayout->addWidget(statusMessageLabel); + vLayout->addWidget(statusMessage); + publicGroup->setLayout(vLayout); + + // tox + QGroupBox* toxGroup = new QGroupBox(tr("Tox ID"), this); + QLabel* toxIdLabel = new QLabel(tr("Your Tox ID"), this); + toxID = new QLineEdit(this); + toxID->setReadOnly(true); + QVBoxLayout* toxLayout = new QVBoxLayout(); + toxLayout->addWidget(toxIdLabel); + toxLayout->addWidget(toxID); + toxGroup->setLayout(toxLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + mainLayout->setSpacing(30); + mainLayout->addWidget(publicGroup); + mainLayout->addWidget(toxGroup); + mainLayout->addStretch(1); + setLayout(mainLayout); + } + + QLineEdit* userName; + QLineEdit* statusMessage; + QLineEdit* toxID; +}; + +class PrivacyPage : public QWidget +{ +public: + PrivacyPage(QWidget* parent = 0) : + QWidget(parent) + {} +}; + +class AVPage : public QWidget +{ + Q_OBJECT +public: + AVPage(SettingsDialog* parent = 0) : + QWidget(parent) + { + QGroupBox *group = new QGroupBox(tr("Video Settings"), this); + + camView = new SelfCamView(parent->getWidget()->getCamera()); + camView->hide(); // hide by default + testVideo = new QPushButton(tr("Show video preview","On a button")); + connect(testVideo, SIGNAL(clicked()), this, SLOT(onTestVideoPressed())); + + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->addWidget(testVideo); + vLayout->addWidget(camView); + group->setLayout(vLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + mainLayout->addWidget(group); + mainLayout->addStretch(1); + setLayout(mainLayout); + } + + ~AVPage() + { + delete camView; + } + + void showTestVideo() + { + testVideo->setText(tr("Hide video preview","On a button")); + camView->show(); + } + + void closeTestVideo() + { + testVideo->setText(tr("Show video preview","On a button")); + camView->close(); + } + + QPushButton* testVideo; + SelfCamView* camView; + +public slots: + void onTestVideoPressed() + { + if (camView->isVisible()) { + closeTestVideo(); + } else { + showTestVideo(); + } + } +}; + +// allows Q_OBJECT macro inside cpp +#include "settingsdialog.moc" + + + +// ======================================= +// settings dialog +//======================================== +SettingsDialog::SettingsDialog(Widget *parent) : + QDialog(parent), + widget(parent) +{ + createPages(); + createButtons(); + createConnections(); + createLayout(); + setWindowTitle(tr("qTox – Settings")); +} + +void SettingsDialog::createPages() +{ + generalPage = new GeneralPage(this); + identityPage = new IdentityPage(this); + privacyPage = new PrivacyPage(this); + avPage = new AVPage(this); + + contentsWidget = new QListWidget; + contentsWidget->setViewMode(QListView::IconMode); + contentsWidget->setIconSize(QSize(100, 73)); + contentsWidget->setMovement(QListView::Static); + contentsWidget->setMaximumWidth(110); + contentsWidget->setMinimumWidth(110); + contentsWidget->setSpacing(0); + contentsWidget->setFlow(QListView::TopToBottom); + + pagesWidget = new QStackedWidget; + pagesWidget->addWidget(generalPage); + pagesWidget->addWidget(identityPage); + pagesWidget->addWidget(privacyPage); + pagesWidget->addWidget(avPage); + + QListWidgetItem *generalButton = new QListWidgetItem(contentsWidget); + generalButton->setIcon(QIcon(":/img/settings/general.png")); + generalButton->setText(tr("General")); + generalButton->setTextAlignment(Qt::AlignHCenter); + generalButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + + QListWidgetItem *identity = new QListWidgetItem(contentsWidget); + identity->setIcon(QIcon(":/img/settings/identity.png")); + identity->setText(tr("Identity")); + identity->setTextAlignment(Qt::AlignHCenter); + identity->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + + QListWidgetItem *privacy = new QListWidgetItem(contentsWidget); + privacy->setIcon(QIcon(":/img/settings/privacy.png")); + privacy->setText(tr("Privacy")); + privacy->setTextAlignment(Qt::AlignHCenter); + privacy->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + + QListWidgetItem *av = new QListWidgetItem(contentsWidget); + av->setIcon(QIcon(":/img/settings/av.png")); + av->setText(tr("Audio/Video")); + av->setTextAlignment(Qt::AlignHCenter); + av->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + + contentsWidget->setCurrentRow(0); +} + +void SettingsDialog::createButtons() +{ + okButton = new QPushButton(tr("Ok"), this); + cancelButton = new QPushButton(tr("Cancel"), this); + applyButton = new QPushButton(tr("Apply"), this); +} + +void SettingsDialog::createConnections() +{ + connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed())); + connect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); + connect(applyButton, SIGNAL(clicked()), this, SLOT(applyPressed())); + connect( + contentsWidget, + SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), + this, + SLOT(changePage(QListWidgetItem*,QListWidgetItem*)) + ); +} + +void SettingsDialog::createLayout() +{ + setMinimumSize(800, 500); + + QHBoxLayout *buttonsLayout = new QHBoxLayout(); + buttonsLayout->addStretch(1); + buttonsLayout->addWidget(okButton); + buttonsLayout->addWidget(cancelButton); + buttonsLayout->addWidget(applyButton); + + QHBoxLayout *hLayout = new QHBoxLayout(); + hLayout->addWidget(contentsWidget); + hLayout->addWidget(pagesWidget, 1); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + mainLayout->addLayout(hLayout); + mainLayout->addLayout(buttonsLayout); + setLayout(mainLayout); +} + +void SettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) +{ + if (!current) { + current = previous; + } + pagesWidget->setCurrentIndex(contentsWidget->row(current)); +} + +void SettingsDialog::okPressed() +{ + writeConfig(); + close(); +} + +void SettingsDialog::cancelPressed() +{ + close(); +} + +void SettingsDialog::applyPressed() +{ + writeConfig(); +} + +void SettingsDialog::readConfig() +{ + Settings& settings = Settings::getInstance(); + Core* core = widget->getCore(); + + generalPage->enableIPv6->setChecked(settings.getEnableIPv6()); + generalPage->useTranslations->setChecked(settings.getUseTranslations()); + generalPage->makeToxPortable->setChecked(settings.getMakeToxPortable()); + + identityPage->userName->setText(core->getUsername()); + identityPage->statusMessage->setText(core->getStatusMessage()); + identityPage->toxID->setText(core->getSelfId().toString()); +} + +void SettingsDialog::writeConfig() +{ + Settings& settings = Settings::getInstance(); + Core* core = widget->getCore(); + + + // only save settings if something changed + bool saveSettings = false; + if (settings.getEnableIPv6() != generalPage->enableIPv6->isChecked()) { + settings.setEnableIPv6(generalPage->enableIPv6->isChecked()); + saveSettings = true; + } + + if (settings.getUseTranslations() != generalPage->useTranslations->isChecked()) { + settings.setUseTranslations(generalPage->useTranslations->isChecked()); + saveSettings = true; + } + + if (settings.getMakeToxPortable() != generalPage->makeToxPortable->isChecked()) { + settings.setMakeToxPortable(generalPage->makeToxPortable->isChecked()); + saveSettings = true; + } + + if (settings.getSmileyPack() != generalPage->smileyPack->currentData().toString()) { + settings.setSmileyPack(generalPage->smileyPack->currentData().toString()); + saveSettings = true; + } + + if (saveSettings) { + settings.save(); + } + + + // changing core settings will automatically save them + QString userName = identityPage->userName->text(); + if (core->getUsername() != userName) { + core->setUsername(userName); + } + + QString statusMessage = identityPage->statusMessage->text(); + if (core->getStatusMessage() != statusMessage) { + core->setStatusMessage(statusMessage); + } +} + +Widget* SettingsDialog::getWidget() +{ + return widget; +} + +void SettingsDialog::closeEvent(QCloseEvent* e){ + avPage->closeTestVideo(); + QDialog::closeEvent(e); +} diff --git a/widget/settingsdialog.h b/widget/settingsdialog.h new file mode 100644 index 000000000..55575b447 --- /dev/null +++ b/widget/settingsdialog.h @@ -0,0 +1,64 @@ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include +#include + +class Widget; +class SelfCamView; +class Camera; +class GeneralPage; +class IdentityPage; +class PrivacyPage; +class AVPage; + +class QListWidget; +class QListWidgetItem; +class QStackedWidget; +class QPushButton; +class QCheckBox; +class QLineEdit; + +// ======================================= +// settings dialog +//======================================== +class SettingsDialog : public QDialog +{ + Q_OBJECT +public: + explicit SettingsDialog(Widget *parent); + + void readConfig(); + void writeConfig(); + Widget* getWidget(); + void closeEvent(QCloseEvent *); + +public slots: + void changePage(QListWidgetItem *current, QListWidgetItem *previous); + void okPressed(); + void cancelPressed(); + void applyPressed(); + +private: + void createPages(); + void createButtons(); + void createConnections(); + void createLayout(); + + Widget* widget; + + // pages + GeneralPage* generalPage; + IdentityPage* identityPage; + PrivacyPage* privacyPage; + AVPage* avPage; + QListWidget* contentsWidget; + QStackedWidget* pagesWidget; + + // buttons + QPushButton* okButton; + QPushButton* cancelButton; + QPushButton* applyButton; +}; + +#endif // SETTINGSDIALOG_H diff --git a/widget/tool/chataction.cpp b/widget/tool/chataction.cpp index dacde43ee..c05fd36b9 100644 --- a/widget/tool/chataction.cpp +++ b/widget/tool/chataction.cpp @@ -50,7 +50,7 @@ QString ChatAction::getName() QString ChatAction::getDate() { - QString res = "
" + date + "
"; + QString res = date; return res; } @@ -102,9 +102,9 @@ QString MessageAction::getMessage() for (QString& s : messageLines) { if (QRegExp("^[ ]*>.*").exactMatch(s)) - message_ += "
" + s.right(s.length()-4) + "

"; + message_ += ">" + s.right(s.length()-4) + "
"; else - message_ += s + "
"; + message_ += s + "
"; } message_ = message_.left(message_.length()-4); diff --git a/widget/widget.cpp b/widget/widget.cpp index 29aef03be..62e362f00 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -155,7 +155,6 @@ Widget::Widget(QWidget *parent) ui->statusButton->style()->polish(ui->statusButton); camera = new Camera; - camview = new SelfCamView(camera); // Disable some widgets until we're connected to the DHT ui->statusButton->setEnabled(false); @@ -226,7 +225,6 @@ Widget::~Widget() if (!coreThread->isFinished()) coreThread->terminate(); delete core; - delete camview; hideMainForms(); @@ -653,11 +651,6 @@ Group *Widget::createGroup(int groupId) return newgroup; } -void Widget::showTestCamview() -{ - camview->show(); -} - void Widget::onEmptyGroupCreated(int groupId) { createGroup(groupId); diff --git a/widget/widget.h b/widget/widget.h index ec054863c..9512f00e9 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -54,7 +54,6 @@ public: QThread* getCoreThread(); Camera* getCamera(); static Widget* getInstance(); - void showTestCamview(); void newMessageAlert(); bool isFriendWidgetCurActiveWidget(Friend* f); bool getIsWindowMinimized(); @@ -140,7 +139,6 @@ private: static Widget* instance; GenericChatroomWidget* activeChatroomWidget; FriendListWidget* contactListWidget; - SelfCamView* camview; Camera* camera; bool notify(QObject *receiver, QEvent *event); bool eventFilter(QObject *, QEvent *event);