From fc0ed91c74d30e75ac41bdadb9bae79660c0aa5e Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 8 Oct 2014 16:10:57 +0100 Subject: [PATCH 01/20] preview of emoticons --- widget/form/settings/generalform.cpp | 13 ++++++ widget/form/settings/generalform.h | 1 + widget/form/settings/generalsettings.ui | 56 ++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/widget/form/settings/generalform.cpp b/widget/form/settings/generalform.cpp index 0df370048..5644f3eaf 100644 --- a/widget/form/settings/generalform.cpp +++ b/widget/form/settings/generalform.cpp @@ -38,6 +38,7 @@ GeneralForm::GeneralForm() : bodyUI->smileyPackBrowser->addItem(entry.first, entry.second); } bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack())); + reloadSmiles(); bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP()); bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr()); @@ -89,6 +90,7 @@ void GeneralForm::onSmileyBrowserIndexChanged(int index) { QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); Settings::getInstance().setSmileyPack(filename); + reloadSmiles(); } void GeneralForm::onUDPUpdated() @@ -119,3 +121,14 @@ void GeneralForm::onUseProxyUpdated() bodyUI->proxyPort->setEnabled(state); Settings::getInstance().setUseProxy(state); } + +void GeneralForm::reloadSmiles() +{ + QString smiles[] = {":)", ";)", ":p", ":O", ":'("}; + int pixSize = 30; + bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(pixSize, pixSize)); + bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(pixSize, pixSize)); + bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(pixSize, pixSize)); + bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(pixSize, pixSize)); + bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(pixSize, pixSize)); +} diff --git a/widget/form/settings/generalform.h b/widget/form/settings/generalform.h index 224c6ee26..babf08787 100644 --- a/widget/form/settings/generalform.h +++ b/widget/form/settings/generalform.h @@ -45,6 +45,7 @@ private slots: private: Ui::GeneralSettings *bodyUI; + void reloadSmiles(); }; #endif diff --git a/widget/form/settings/generalsettings.ui b/widget/form/settings/generalsettings.ui index e0ffb3ab4..23515cf2e 100644 --- a/widget/form/settings/generalsettings.ui +++ b/widget/form/settings/generalsettings.ui @@ -7,7 +7,7 @@ 0 0 527 - 369 + 397 @@ -72,6 +72,60 @@ + + + + + + :) + + + :) + + + + + + + ;) + + + ;) + + + + + + + :p + + + :p + + + + + + + :O + + + :O + + + + + + + :'( + + + :'( + + + + + From c716b615c82ece3c3471f50a1cd79fd4fbb6eaa2 Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 8 Oct 2014 23:31:20 +0100 Subject: [PATCH 02/20] style selector Unfortunately Qt developers removed some old native skins from support, only 3 skins are supported on Linux. Number of native skins depends on OS and Qt built system. --- misc/settings.cpp | 12 ++++++++++++ misc/settings.h | 6 +++++- ui/settings/mainContent.css | 6 +++++- widget/form/settings/generalform.cpp | 17 ++++++++++++++++- widget/form/settings/generalform.h | 1 + widget/form/settings/generalsettings.ui | 12 +++++++++++- widget/widget.cpp | 12 +++++++++++- 7 files changed, 61 insertions(+), 5 deletions(-) diff --git a/misc/settings.cpp b/misc/settings.cpp index 6b1ca0ed0..77a2deee1 100644 --- a/misc/settings.cpp +++ b/misc/settings.cpp @@ -135,6 +135,7 @@ void Settings::load() timestampFormat = s.value("timestampFormat", "hh:mm").toString(); minimizeOnClose = s.value("minimizeOnClose", false).toBool(); useNativeStyle = s.value("nativeStyle", false).toBool(); + style = s.value("style", "None").toString(); s.endGroup(); s.beginGroup("State"); @@ -239,6 +240,7 @@ void Settings::save(QString path) s.setValue("timestampFormat", timestampFormat); s.setValue("minimizeOnClose", minimizeOnClose); s.setValue("nativeStyle", useNativeStyle); + s.setValue("style",style); s.endGroup(); s.beginGroup("State"); @@ -356,6 +358,16 @@ bool Settings::getAutostartInTray() const return autostartInTray; } +QString Settings::getStyle() const +{ + return style; +} + +void Settings::setStyle(const QString& newStyle) +{ + style = newStyle; +} + void Settings::setAutostartInTray(bool newValue) { autostartInTray = newValue; diff --git a/misc/settings.h b/misc/settings.h index 9278fff8b..f7b574e6f 100644 --- a/misc/settings.h +++ b/misc/settings.h @@ -51,6 +51,9 @@ public: bool getAutostartInTray() const; void setAutostartInTray(bool newValue); + + QString getStyle() const; + void setStyle(const QString& newValue); bool getUseTranslations() const; void setUseTranslations(bool newValue); @@ -192,7 +195,8 @@ private: QByteArray windowGeometry; QByteArray windowState; QByteArray splitterState; - + QString style; + // ChatView int firstColumnHandlePos; int secondColumnHandlePosFromRight; diff --git a/ui/settings/mainContent.css b/ui/settings/mainContent.css index e08dc24b5..d61142925 100644 --- a/ui/settings/mainContent.css +++ b/ui/settings/mainContent.css @@ -11,7 +11,11 @@ QLabel QGroupBox::title { color: black; - background-color: white; +} + +QGroupBox +{ + background-color: white; } QWidget diff --git a/widget/form/settings/generalform.cpp b/widget/form/settings/generalform.cpp index 0df370048..d6c8fb5b4 100644 --- a/widget/form/settings/generalform.cpp +++ b/widget/form/settings/generalform.cpp @@ -21,6 +21,7 @@ #include "misc/settings.h" #include "misc/smileypack.h" #include +#include GeneralForm::GeneralForm() : GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png")) @@ -38,7 +39,14 @@ GeneralForm::GeneralForm() : bodyUI->smileyPackBrowser->addItem(entry.first, entry.second); } bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack())); - + + bodyUI->styleBrowser->addItems(QStyleFactory::keys()); + bodyUI->styleBrowser->addItem("None"); + if(QStyleFactory::keys().contains(Settings::getInstance().getStyle())) + bodyUI->styleBrowser->setCurrentText(Settings::getInstance().getStyle()); + else + bodyUI->styleBrowser->setCurrentText("None"); + bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP()); bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr()); int port = Settings::getInstance().getProxyPort(); @@ -58,6 +66,7 @@ GeneralForm::GeneralForm() : connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited); connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int))); connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated); + connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString))); } GeneralForm::~GeneralForm() @@ -85,6 +94,12 @@ void GeneralForm::onSetAutostartInTray() Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked()); } +void GeneralForm::onStyleSelected(QString style) +{ + Settings::getInstance().setStyle(style); + this->setStyle(QStyleFactory::create(style)); +} + void GeneralForm::onSmileyBrowserIndexChanged(int index) { QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); diff --git a/widget/form/settings/generalform.h b/widget/form/settings/generalform.h index 224c6ee26..19fb2f62e 100644 --- a/widget/form/settings/generalform.h +++ b/widget/form/settings/generalform.h @@ -42,6 +42,7 @@ private slots: void onProxyAddrEdited(); void onProxyPortEdited(int port); void onUseProxyUpdated(); + void onStyleSelected(QString style); private: Ui::GeneralSettings *bodyUI; diff --git a/widget/form/settings/generalsettings.ui b/widget/form/settings/generalsettings.ui index e0ffb3ab4..e4542a7d6 100644 --- a/widget/form/settings/generalsettings.ui +++ b/widget/form/settings/generalsettings.ui @@ -7,7 +7,7 @@ 0 0 527 - 369 + 397 @@ -72,6 +72,16 @@ + + + + Style + + + + + + diff --git a/widget/widget.cpp b/widget/widget.cpp index 189b43f40..2299bf8b5 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -43,6 +43,7 @@ #include #include #include +#include Widget *Widget::instance{nullptr}; @@ -74,7 +75,16 @@ Widget::Widget(QWidget *parent) ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); ui->mainHead->layout()->setSpacing(0); - ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css")); + + + if(QStyleFactory::keys().contains(Settings::getInstance().getStyle()) + && Settings::getInstance().getStyle() != "None") + { + ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle())); + ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle())); + } + + ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css")); ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css")); contactListWidget = new FriendListWidget(); From ca3182e281ac1ad6d7f3811c9a6b79dbf637b28e Mon Sep 17 00:00:00 2001 From: agilob Date: Sat, 11 Oct 2014 16:53:20 +0100 Subject: [PATCH 03/20] error handling for missing graphical icons preview of emoticons based on dynamic list of emoticons, not hardcoded anymore --- misc/smileypack.cpp | 16 ++++++++++++---- widget/form/settings/generalform.cpp | 20 +++++++++++++++++++- widget/form/settings/generalsettings.ui | 12 ++++++------ 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/misc/smileypack.cpp b/misc/smileypack.cpp index 57a754c76..f3230c3ea 100644 --- a/misc/smileypack.cpp +++ b/misc/smileypack.cpp @@ -127,12 +127,21 @@ bool SmileyPack::load(const QString& filename) { QString emoticon = stringElement.text(); filenameTable.insert(emoticon, file); - emoticonSet.push_back(emoticon); + cacheSmiley(file); // preload all smileys - + + QPixmap pm; + pm.loadFromData(getCachedSmiley(emoticon), "PNG"); + + if(pm.size().width() > 0) + emoticonSet.push_back(emoticon); + stringElement = stringElement.nextSibling().toElement(); + } - emoticons.push_back(emoticonSet); + + if(emoticonSet.size() > 0) + emoticons.push_back(emoticonSet); } // success! @@ -176,7 +185,6 @@ QIcon SmileyPack::getAsIcon(const QString &key) { QPixmap pm; pm.loadFromData(getCachedSmiley(key), "PNG"); - return QIcon(pm); } diff --git a/widget/form/settings/generalform.cpp b/widget/form/settings/generalform.cpp index 5644f3eaf..d471e9614 100644 --- a/widget/form/settings/generalform.cpp +++ b/widget/form/settings/generalform.cpp @@ -124,11 +124,29 @@ void GeneralForm::onUseProxyUpdated() void GeneralForm::reloadSmiles() { - QString smiles[] = {":)", ";)", ":p", ":O", ":'("}; + QList emoticons = SmileyPack::getInstance().getEmoticons(); + QStringList smiles; + smiles << ":)" << ";)" << ":p" << ":O" << ":'("; //just in case... + + for(int i = 0; i < emoticons.size(); i++) + { + foreach (QString icon, emoticons.at(i)) { + { + smiles.push_front(icon); + } + } + } + int pixSize = 30; bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(pixSize, pixSize)); bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(pixSize, pixSize)); bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(pixSize, pixSize)); bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(pixSize, pixSize)); bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(pixSize, pixSize)); + + bodyUI->smile1->setToolTip(smiles[0]); + bodyUI->smile2->setToolTip(smiles[1]); + bodyUI->smile3->setToolTip(smiles[2]); + bodyUI->smile4->setToolTip(smiles[3]); + bodyUI->smile5->setToolTip(smiles[4]); } diff --git a/widget/form/settings/generalsettings.ui b/widget/form/settings/generalsettings.ui index 23515cf2e..7086f3afc 100644 --- a/widget/form/settings/generalsettings.ui +++ b/widget/form/settings/generalsettings.ui @@ -7,7 +7,7 @@ 0 0 527 - 397 + 421 @@ -80,7 +80,7 @@ :) - :) + @@ -90,7 +90,7 @@ ;) - ;) + @@ -100,7 +100,7 @@ :p - :p + @@ -110,7 +110,7 @@ :O - :O + @@ -120,7 +120,7 @@ :'( - :'( + From 27e4debb72dc044bc134f749307f4e220719bafb Mon Sep 17 00:00:00 2001 From: agilob Date: Sat, 11 Oct 2014 23:25:22 +0100 Subject: [PATCH 04/20] yup, too many brackets --- widget/form/settings/generalform.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/widget/form/settings/generalform.cpp b/widget/form/settings/generalform.cpp index d471e9614..25269b28b 100644 --- a/widget/form/settings/generalform.cpp +++ b/widget/form/settings/generalform.cpp @@ -130,11 +130,8 @@ void GeneralForm::reloadSmiles() for(int i = 0; i < emoticons.size(); i++) { - foreach (QString icon, emoticons.at(i)) { - { - smiles.push_front(icon); - } - } + foreach (QString icon, emoticons.at(i)) + smiles.push_front(icon); } int pixSize = 30; From db5c115a911fabd678929d0a19766fc0e183f7cb Mon Sep 17 00:00:00 2001 From: agilob Date: Mon, 13 Oct 2014 19:50:54 +0100 Subject: [PATCH 05/20] removed duplicated emoticons --- src/widget/form/settings/generalform.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index f05b8ecea..ddf7ac95b 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -126,14 +126,11 @@ void GeneralForm::reloadSmiles() { QList emoticons = SmileyPack::getInstance().getEmoticons(); QStringList smiles; - smiles << ":)" << ";)" << ":p" << ":O" << ":'("; //just in case... - - for(int i = 0; i < emoticons.size(); i++) - { - foreach (QString icon, emoticons.at(i)) - smiles.push_front(icon); - } - + smiles << ":)" << ";)" << ":p" << ":O" << ":["; //just in case... + + for(int i = 0; i < emoticons.size(); i++) + smiles.push_front(emoticons.at(i).first()); + int pixSize = 30; bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(pixSize, pixSize)); bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(pixSize, pixSize)); From 8adbce35738802500c339c02db1ba2f6f6e21ec9 Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Wed, 15 Oct 2014 10:12:29 +0200 Subject: [PATCH 06/20] Italian translation: update --- translations/it.qm | Bin 9735 -> 12321 bytes translations/it.ts | 360 +++++++++++++++++++++++++++++++-------------- 2 files changed, 247 insertions(+), 113 deletions(-) diff --git a/translations/it.qm b/translations/it.qm index ace34002bc8dd7b4c0a410d0ea70ce2a3a976cd7..631dfcb58ece27c358c9bc301e8782f585954714 100644 GIT binary patch delta 3045 zcmb7G4Qw0b8Gap~|9|q^G>uJjcH`!!tw+>!K(!8~p^#)LggOOL)WX?5*GC+mdv{I~ zHslV5D3A)l(UrDA5ZX;DOe zT7PMZs3K-e97@;k^+b4LSr z5!Fm^KWV;5WP6P}#T06qEO4J3{1A<|+9Ipo2lAD+>-r86Ek19%G2IOP8*SpX8^G`t z+qma2QKj8B&Lj?{Z7)6!g+hmHuN|HxvY$2A@C)|4$00RM*oPW_M$}kgm%Ye$W$f}z zAmrI;e=xP5=$b#*BOwQl*U4gXEyR6%wR3PT^?Klab zHrJv9AK>jN*H#C%fS-0H&i{d^V2QeRPYg1rxqi{}BQSi+_4W}+=2_)BGj$9NFT2kA zE)rE$x&Hoj015rpHK%}4`>pO)!X7T|b3b+b9Vqss`%jnJaQ~+J^0zzDXoY)@5eod( z!}Ul+;deZ1X7Jpe@%(Y-VJP~6H!!VJfvOL9Z)t@zkv6Y-CmQ%(_U^eJW~!+3UTFC- zB%-V|;Ua|Up(+81Xx!yN78-oD%_=8^x6Vg~4<>Jgq^AIT zT%G<cU$MaXG{(xE2h!QmM6bAR~;$g~Sl+ z-&})uMn^=vf~vzLlp-AiiZ~*PJ6Yh0dWxZx2B{eH`w_}?C^K@$1TC)!nj~ip{;Rp$ zEuDIGZD8#kh|Cxgi^Nka>aZ$tYAZEbe21LL4~u+E)HEr(UFBP2T0X9}P35>JYp(C2 z5qu9{Vt+cPw5qHCLbITDG94hzuS(#>8eEWZWf< zXCnqakre%3o^{bxU5dz$$$4JQ7cX`SS&i3ZJ}G8IP2{z-r1CjMPDvT@Mtw3+|FtM> zFm}ZB&^&R_fteDk8tlo7?QBTEwFw1BLZMHYe9}@bM z>H0T}=49|Kf+^Ic;dXjF}tG$5& zPv^cE7>Xip06-P2DZplXi@C#H0(Z>dY-P|Hfd#VSp7|k#56dr;&3TPPOa=?lKk-CT z(Gupn2j|&=hcn9TVZ*#CM)`q^D5#<#1~2eQDU}kLKA&zI9~VLk-9 zNlD1a+gUkHRM@%r`7JC#UG@a^#{#QvZe3s~Hh)ZE)7n{F#qniF+1iqvwOu2Elo8@U zU39g&R-X$rF7+>*u~LHFm?8a2Akf4@=8a7`#2gb=#yFL&!TPT@)74}08ICAbs45PN zPz1%=1=zt}vQ#OQ>xbu!R_6j8A^$=FN>R?@tf+{5U}@FWvr&q(V07PV9SbgnlM}LOiPJ0FC{Ulk~YTJf;avnBm30vL(91T0i*ZYJ^%m! delta 1066 zcmbVKT})GF7=B8>)AqFIoJvI~v}#3AS;oc!Or0hh!yjZujUdKFheD5m2|Gw@amh^Q z&oZZwEuJALO$ZT56sM3b#^4rAnA=h(H=xNfanW6DBxb$X=9Xn{dq~Z$=8YHUJm2@7 z_j`Wc_w?<2e|>c2m7q6~jCI~z;2+)D_xaSTK-v|Ejt_vjNr>1vV4ff1b_amz6sCWY zLhn6D6{SG72U6r?z|#%;o(8~wA0>YaKpDmIsbauAoWk@el>ba6}Vm*q7fD2$8NFiH6*|JnRVeb_nY;syJO9K7zZpn ztm}M#0_t3AqU${dh+1!*_=N`2#JVpj6zCLh$HLqn7Trf_G&7mPtcxOgdN~ig5Q86D zNH{1i`L+S+E5&DdzXGC0{ND2e1s+NHg?DLWSXx?nh6Kx`mmBgZG$QFmt7+_k)b8r1 zfdT3K@iBH}K)T#N2}sctW`AeflXHza8*PTddWT{&R&4>CSy8*iO9NTuc4vMUi9fOr zwo`DH%RW}}8w)qs6F(kiOJfep!6Sh6q~qO5J1{@nF)&fgkw8}Wj#IE)o^$#hU^nEW zv1-;8%3oBB09uoL``lSp-IVXdN6FVMf3Gr_HYESkN+W^jU(OR_-vV>)I;S5N&|#PJ zkCP>w(G8cVXasURuF?taB}MTiOd5MhS-XVJ{dG!cD~&3fl;q;8!0eyY;7|)^ovy|^ zIHCnj>esmwynl$uQCKdji5}il?`!_&b2-|C=I;&y+uikAaqk;!MXk2Eg#tO_+UDbz zC>YnO{3LMQ(1vz@%GT@J^y04=xIcxK40pT1pL159`_%Nzd98c6Zv#7XfUXxlXXQze zIh5fuN37*hFV;XuE1Izj0km;lhkCA?9V~;5kEfzBs0Si^8G)8oJ<_PRvCXiR)vPgE zn=LbRUTh+Tfyk3dsv3;8{~>wIV!kDcN}r0woRakT1=|5n{GIG3VQ$Z@G(*B?nhP_{ zrFk!yXY%UJvi#EcD~pa<*UrOURMX~uCXJvGL8djh4iiHN|Cd;+HugXE8rDPMnY6Ad Zy=iy(uI3u1H?J4;n#0eG$K_|e;$Pfk7ES;F diff --git a/translations/it.ts b/translations/it.ts index 114976d15..8b927746c 100644 --- a/translations/it.ts +++ b/translations/it.ts @@ -4,116 +4,144 @@ AVForm - + Audio/Video settings Impostazioni Audio/Video - - - Hide video preview - On a button - Ferma webcam - - - - Show video preview - On a button - Prova webcam - AVSettings - + Form Form - + + Volume Settings (Stubs) + Impostazioni Volume (Stub) + + + + Playback + Altoparlanti + + + + Microphone + Microfono + + + Video settings Impostazioni Video - - Show video preview - Prova webcam + + Modes + Modalità + + + + Hue + Colore + + + + Brightness + Luminoistà + + + + Saturation + Saturazione + + + + Contrast + Contrasto + + + + Preview + Anteprima 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 Non puoi aggiungere te stesso come contatto! - + 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 @@ -122,7 +150,7 @@ ChatForm - + Send a file Invia un file @@ -130,12 +158,12 @@ Core - + Encrypted profile Profilo criptato - + Your tox profile seems to be encrypted, qTox can't open it Do you want to erase this profile ? Il tuo profilo Tox sembra essere criptato, qTox non può aprirlo\nVuoi eliminare questo profilo? @@ -144,19 +172,19 @@ Do you want to erase this profile ? 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. @@ -165,18 +193,18 @@ Do you want to erase this profile ? FilesForm - + Transfered Files "Headline" of the window Files Trasferiti - + Downloads Ricevuti - + Uploads Inviati @@ -184,34 +212,34 @@ Do you want to erase this profile ? FriendRequestDialog - + Friend request Title of the window to aceept/deny a friend request Richiesta d'amicizia - + Someone wants to make friends with you Qualcuno vuole chattare con te - + User ID: ID Utente: - + Friend request message: Messaggio della richiesta d'amicizia: - + Accept Accept a friend request Accetta - + Reject Reject a friend request Rifiuta @@ -220,19 +248,19 @@ Do you want to erase this profile ? 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 @@ -241,7 +269,7 @@ Do you want to erase this profile ? GeneralForm - + General Settings Impostazioni Generali @@ -249,79 +277,84 @@ Do you want to erase this profile ? GeneralSettings - + Form Form - + General Settings Impostazioni Generali - + Connection Settings Impostazioni Connessione - + Enable IPv6 (recommended) Text on a checkbox to enable IPv6 Abilita IPv6 (consigliato) - + Use translations Text on a checkbox to enable translations Abilita traduzioni - + 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 - + Make Tox portable Rendi qTox portabile - + + Start in tray + Avvia minimizzato + + + Theme Impostazioni Tema - + Smiley Pack Text on smiley pack label Emoticons - + Use proxy (SOCKS5) Usa proxy (SOCKS5) - + Address Text on proxy addr label IP - + Port Text on proxy port label Porta - + Disable UDP (not recommended) Text on checkbox to disable UDP Disabilita connessioni UDP (non raccomandato) - + This allows, e.g., toxing over Tor. It adds load to the Tox network however, so use only when necessary. force tcp checkbox tooltip Questo permette di usare qTox con Tor; tuttavia aggiunge carico alla rete Tox, quindi usalo solo se necessario. @@ -330,8 +363,8 @@ Do you want to erase this profile ? GenericChatForm - - + + Save chat log Salva il log della chat @@ -339,13 +372,13 @@ Do you want to erase this profile ? GroupChatForm - + %1 users in chat Number of users in chat %1 utenti in chat - + %1 users in chat %1 utenti in chat @@ -353,19 +386,19 @@ Do you want to erase this profile ? GroupWidget - - + + %1 users in chat %1 utenti in chat - - + + 0 users in chat 0 utenti in chat - + Quit group Menu to quit a groupchat Esci dal gruppo @@ -374,88 +407,188 @@ Do you want to erase this profile ? IdentityForm - + Your identity Il tuo profilo + + + Rename "%1" + renaming a profile + Rinomina "%1" + + + + Export profile + save dialog title + Esporta profilo + + + + Tox save file (*.tox) + save dialog filter + Tox save file (*.tox) + + + + Profile currently loaded + current profile deletion warning title + Profilo attualmente in uso + + + + This profile is currently in use. Please load a different profile before deleting this one. + current profile deletion warning text + Questo profilo è attualmente in uso. Per favore carica un profilo differente prima di eliminare questo. + + + + Deletion imminent! + deletion confirmation title + Eliminazione imminente! + + + + Are you sure you want to delete this profile? + deletion confirmation text + Sei sicuro di voler eliminare questo profilo? + + + + Import profile + import dialog title + Importa profilo + + + + Tox save file (*.tox) + import dialog filter + Tox save file (*.tox) + IdentitySettings - + Form Form - + Public Information Informazioni Pubbliche - + Name Nome - + Status Stato - + Tox ID Tox ID - + Your Tox ID (click to copy) (clicca qui per copiare) + + + Profiles + Profili + + + + Available profiles: + Profili disponibili: + + + + Load + load profile button + Carica + + + + Rename + rename profile button + Rinomina + + + + Export + export profile button + Esporta + + + + Delete + delete profile button + Elimina + + + + This is useful to remain safe on public computers + delete profile button tooltip + Utile per preservare la tua sicurezza su computer pubblici + + + + Import a profile + import profile button + Importa un profilo + MainWindow - + qTox qTox - + Your name qTox User - + Your status Toxing on qTox - + Add friends Aggiungi contatto - + Create a group chat Crea un gruppo - + View completed file transfers Visualizza i trasferimenti completati - + Change your settings Cambia le impostazioni - + Close Chiudi - + Ctrl+Q Ctrl+Q @@ -463,80 +596,81 @@ Do you want to erase this profile ? PrivacyForm - + Privacy settings Impostazioni privacy - - SelfCamView - - - Tox video test - Title of the window to test the video/webcam - qTox video test - - 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 - + + Choose a profile + Scegli un profilo + + + + Please choose which identity to use + Per favore scegli quale identità usare + + + Choose a profile picture Scegli un'immagine per il profilo - - - + + + Error Errore - + Unable to open this file Impossibile aprire il file - + Unable to read this image Impossibile leggere l'immagine - + This image is too big L'immagine è troppo grande - + Toxcore failed to start, the application will terminate after you close this message. Impossibile avviare Toxcore.\nqTox terminerà dopo che avrai chiuso questo messaggio. - + toxcore failed to start with your proxy settings. qTox cannot run; please modify your settings and restart. popup text Impossibile avviare Toxcore con le tue impostazione proxy.\nqTox non può funzionare correttamente, per favore modifica le impostazioni e riavvia il programma. - + <Unknown> Placeholder when we don't know someone's name in a group chat <Sconosciuto> From e3cf2cac20c194748a506d1c3c0683bae81c84f0 Mon Sep 17 00:00:00 2001 From: dubslow Date: Thu, 16 Oct 2014 04:47:58 -0500 Subject: [PATCH 07/20] auto away; needs UI --- src/misc/settings.cpp | 16 ++++++++++++- src/misc/settings.h | 5 +++++ src/widget/widget.cpp | 52 +++++++++++++++++++++++++++++++++++++------ src/widget/widget.h | 4 ++++ 4 files changed, 69 insertions(+), 8 deletions(-) diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp index e06c0d997..20a33b470 100644 --- a/src/misc/settings.cpp +++ b/src/misc/settings.cpp @@ -115,7 +115,8 @@ void Settings::load() useProxy = s.value("useProxy", false).toBool(); proxyAddr = s.value("proxyAddr", "").toString(); proxyPort = s.value("proxyPort", 0).toInt(); - currentProfile = s.value("currentProfile", "").toString(); + currentProfile = s.value("currentProfile", "").toString(); + autoAwayTime = s.value("autoAwayTime", 10).toInt(); s.endGroup(); s.beginGroup("Widgets"); @@ -221,6 +222,7 @@ void Settings::save(QString path) s.setValue("proxyAddr", proxyAddr); s.setValue("proxyPort", proxyPort); s.setValue("currentProfile", currentProfile); + s.setValue("autoAwayTime", autoAwayTime); s.endGroup(); s.beginGroup("Widgets"); @@ -442,6 +444,18 @@ void Settings::setEncryptLogs(bool newValue) encryptLogs = newValue; } +int Settings::getAutoAwayTime() const +{ + return autoAwayTime; +} + +void Settings::setAutoAwayTime(int newValue) +{ + if (newValue < 0) + newValue = 10; + autoAwayTime = newValue; +} + void Settings::setWidgetData(const QString& uniqueName, const QByteArray& data) { widgetSettings[uniqueName] = data; diff --git a/src/misc/settings.h b/src/misc/settings.h index cf88bde31..4e2146204 100644 --- a/src/misc/settings.h +++ b/src/misc/settings.h @@ -76,6 +76,9 @@ public: bool getEncryptLogs() const; void setEncryptLogs(bool newValue); + int getAutoAwayTime() const; + void setAutoAwayTime(int newValue); + QPixmap getSavedAvatar(const QString& ownerId); void saveAvatar(QPixmap& pic, const QString& ownerId); @@ -184,6 +187,8 @@ private: bool enableLogging; bool encryptLogs; + int autoAwayTime; + QHash widgetSettings; // GUI diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 7a9146e47..d6ebfe41b 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include Widget *Widget::instance{nullptr}; @@ -107,6 +108,11 @@ Widget::Widget(QWidget *parent) // Disable some widgets until we're connected to the DHT ui->statusButton->setEnabled(false); + idleTimer = new QTimer(); + int mins = Settings::getInstance().getAutoAwayTime(); + if (mins > 0) + idleTimer->start(mins * 1000*60); + qRegisterMetaType("Status"); qRegisterMetaType("vpx_image"); qRegisterMetaType("uint8_t"); @@ -169,6 +175,7 @@ Widget::Widget(QWidget *parent) connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway())); connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy())); connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString))); + connect(idleTimer, &QTimer::timeout, this, &Widget::onUserAway); coreThread->start(); @@ -782,18 +789,49 @@ bool Widget::isFriendWidgetCurActiveWidget(Friend* f) bool Widget::event(QEvent * e) { - if (e->type() == QEvent::WindowActivate) - { - if (activeChatroomWidget != nullptr) - { - activeChatroomWidget->resetEventFlags(); - activeChatroomWidget->updateStatusLight(); - } + switch(e->type()) { + case QEvent::WindowActivate: + if (activeChatroomWidget != nullptr) + { + activeChatroomWidget->resetEventFlags(); + activeChatroomWidget->updateStatusLight(); + } + // http://qt-project.org/faq/answer/how_can_i_detect_a_period_of_no_user_interaction + // Detecting global inactivity, like Skype, is possible but not via Qt: + // http://stackoverflow.com/a/21905027/1497645 + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::Wheel: + case QEvent::KeyPress: + case QEvent::KeyRelease: + if (autoAwayActive) + { + qDebug() << "Widget: auto away deactivated"; + autoAwayActive = false; + emit statusSet(Status::Online); + int mins = Settings::getInstance().getAutoAwayTime(); + if (mins > 0) + idleTimer->start(mins * 1000*60); + } + default: + break; } return QWidget::event(e); } +void Widget::onUserAway() +{ + if (Settings::getInstance().getAutoAwayTime() > 0 + && ui->statusButton->property("status").toString() == "online") // leave user-set statuses in place + { + qDebug() << "Widget: auto away activated"; + emit statusSet(Status::Away); + autoAwayActive = true; + } + idleTimer->stop(); +} + void Widget::setStatusOnline() { core->setStatus(Status::Online); diff --git a/src/widget/widget.h b/src/widget/widget.h index 572ba1922..4f50a133c 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -40,6 +40,7 @@ class Core; class Camera; class FriendListWidget; class MaskablePixmapWidget; +class QTimer; class Widget : public QMainWindow { @@ -109,6 +110,7 @@ private slots: void onGroupSendResult(int groupId, const QString& message, int result); void playRingtone(); void onIconClick(); + void onUserAway(); private: void hideMainForms(); @@ -132,6 +134,8 @@ private: FriendListWidget* contactListWidget; MaskablePixmapWidget* profilePicture; bool notify(QObject *receiver, QEvent *event); + bool autoAwayActive = false; + QTimer* idleTimer; }; #endif // WIDGET_H From 14ea88c0702154ccd4019b6a5ea4dd3359269cfc Mon Sep 17 00:00:00 2001 From: agilob Date: Wed, 8 Oct 2014 23:31:20 +0100 Subject: [PATCH 08/20] style selector Unfortunately Qt developers removed some old native skins from support, only 3 skins are supported on Linux. Number of native skins depends on OS and Qt built system. --- src/misc/settings.cpp | 12 ++++++++++++ src/misc/settings.h | 6 +++++- src/widget/form/settings/generalform.cpp | 17 ++++++++++++++++- src/widget/form/settings/generalform.h | 1 + src/widget/form/settings/generalsettings.ui | 12 +++++++++++- src/widget/widget.cpp | 12 +++++++++++- ui/settings/mainContent.css | 6 +++++- 7 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp index 20a33b470..47fccab47 100644 --- a/src/misc/settings.cpp +++ b/src/misc/settings.cpp @@ -137,6 +137,7 @@ void Settings::load() timestampFormat = s.value("timestampFormat", "hh:mm").toString(); minimizeOnClose = s.value("minimizeOnClose", false).toBool(); useNativeStyle = s.value("nativeStyle", false).toBool(); + style = s.value("style", "None").toString(); s.endGroup(); s.beginGroup("State"); @@ -243,6 +244,7 @@ void Settings::save(QString path) s.setValue("timestampFormat", timestampFormat); s.setValue("minimizeOnClose", minimizeOnClose); s.setValue("nativeStyle", useNativeStyle); + s.setValue("style",style); s.endGroup(); s.beginGroup("State"); @@ -360,6 +362,16 @@ bool Settings::getAutostartInTray() const return autostartInTray; } +QString Settings::getStyle() const +{ + return style; +} + +void Settings::setStyle(const QString& newStyle) +{ + style = newStyle; +} + void Settings::setAutostartInTray(bool newValue) { autostartInTray = newValue; diff --git a/src/misc/settings.h b/src/misc/settings.h index 4e2146204..9ff506ba3 100644 --- a/src/misc/settings.h +++ b/src/misc/settings.h @@ -51,6 +51,9 @@ public: bool getAutostartInTray() const; void setAutostartInTray(bool newValue); + + QString getStyle() const; + void setStyle(const QString& newValue); QString getCurrentProfile() const; void setCurrentProfile(QString profile); @@ -202,7 +205,8 @@ private: QByteArray windowGeometry; QByteArray windowState; QByteArray splitterState; - + QString style; + // ChatView int firstColumnHandlePos; int secondColumnHandlePosFromRight; diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index ddf7ac95b..e2ae4cb1c 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -21,6 +21,7 @@ #include "src/misc/settings.h" #include "src/misc/smileypack.h" #include +#include GeneralForm::GeneralForm() : GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png")) @@ -39,7 +40,14 @@ GeneralForm::GeneralForm() : } bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack())); reloadSmiles(); - + + bodyUI->styleBrowser->addItems(QStyleFactory::keys()); + bodyUI->styleBrowser->addItem("None"); + if(QStyleFactory::keys().contains(Settings::getInstance().getStyle())) + bodyUI->styleBrowser->setCurrentText(Settings::getInstance().getStyle()); + else + bodyUI->styleBrowser->setCurrentText("None"); + bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP()); bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr()); int port = Settings::getInstance().getProxyPort(); @@ -59,6 +67,7 @@ GeneralForm::GeneralForm() : connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited); connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int))); connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated); + connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString))); } GeneralForm::~GeneralForm() @@ -86,6 +95,12 @@ void GeneralForm::onSetAutostartInTray() Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked()); } +void GeneralForm::onStyleSelected(QString style) +{ + Settings::getInstance().setStyle(style); + this->setStyle(QStyleFactory::create(style)); +} + void GeneralForm::onSmileyBrowserIndexChanged(int index) { QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index babf08787..b2ca84b56 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -42,6 +42,7 @@ private slots: void onProxyAddrEdited(); void onProxyPortEdited(int port); void onUseProxyUpdated(); + void onStyleSelected(QString style); private: Ui::GeneralSettings *bodyUI; diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index 7086f3afc..d0d31b622 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -7,7 +7,7 @@ 0 0 527 - 421 + 397 @@ -126,6 +126,16 @@ + + + + Style + + + + + + diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index d6ebfe41b..124f60f90 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -44,6 +44,7 @@ #include #include #include +#include Widget *Widget::instance{nullptr}; @@ -75,7 +76,16 @@ Widget::Widget(QWidget *parent) ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); ui->mainHead->layout()->setSpacing(0); - ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css")); + + + if(QStyleFactory::keys().contains(Settings::getInstance().getStyle()) + && Settings::getInstance().getStyle() != "None") + { + ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle())); + ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle())); + } + + ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css")); ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css")); contactListWidget = new FriendListWidget(); diff --git a/ui/settings/mainContent.css b/ui/settings/mainContent.css index e08dc24b5..d61142925 100644 --- a/ui/settings/mainContent.css +++ b/ui/settings/mainContent.css @@ -11,7 +11,11 @@ QLabel QGroupBox::title { color: black; - background-color: white; +} + +QGroupBox +{ + background-color: white; } QWidget From 698902a8dcd493814f3dac964032154cd15cdb64 Mon Sep 17 00:00:00 2001 From: agilob Date: Sat, 11 Oct 2014 00:18:32 +0100 Subject: [PATCH 09/20] status changes messages and sign in notifications sign in notifications available only in settings and as a message in chat --- src/core.cpp | 2 +- src/core.h | 1 + src/misc/settings.cpp | 24 ++++++++++++++ src/misc/settings.h | 9 ++++++ src/widget/form/settings/generalform.cpp | 16 ++++++++- src/widget/form/settings/generalform.h | 2 ++ src/widget/form/settings/generalsettings.ui | 14 ++++++++ src/widget/widget.cpp | 36 ++++++++++++++++++++- src/widget/widget.h | 1 + 9 files changed, 102 insertions(+), 3 deletions(-) diff --git a/src/core.cpp b/src/core.cpp index 325028b03..b496f0960 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -410,7 +410,7 @@ void Core::onUserStatusChanged(Tox*/* tox*/, int friendId, uint8_t userstatus, v void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status, void* core) { Status friendStatus = status ? Status::Online : Status::Offline; - emit static_cast(core)->friendStatusChanged(friendId, friendStatus); + emit static_cast(core)->friendSignedIn(friendId, friendStatus); if (friendStatus == Status::Offline) { static_cast(core)->checkLastOnline(friendId); diff --git a/src/core.h b/src/core.h index 189f4060a..f0172b38c 100644 --- a/src/core.h +++ b/src/core.h @@ -115,6 +115,7 @@ signals: void friendAdded(int friendId, const QString& userId); void friendStatusChanged(int friendId, Status status); + void friendSignedIn(int friendId, Status friendStatus); void friendStatusMessageChanged(int friendId, const QString& message); void friendUsernameChanged(int friendId, const QString& username); void friendTypingChanged(int friendId, bool isTyping); diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp index 47fccab47..bbe062750 100644 --- a/src/misc/settings.cpp +++ b/src/misc/settings.cpp @@ -138,6 +138,8 @@ void Settings::load() minimizeOnClose = s.value("minimizeOnClose", false).toBool(); useNativeStyle = s.value("nativeStyle", false).toBool(); style = s.value("style", "None").toString(); + statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool(); + signInNotificationEnabled = s.value("signInNotificationEnabled", false).toBool(); s.endGroup(); s.beginGroup("State"); @@ -245,6 +247,8 @@ void Settings::save(QString path) s.setValue("minimizeOnClose", minimizeOnClose); s.setValue("nativeStyle", useNativeStyle); s.setValue("style",style); + s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled); + s.setValue("signInNotificationEnabled", signInNotificationEnabled); s.endGroup(); s.beginGroup("State"); @@ -377,6 +381,26 @@ void Settings::setAutostartInTray(bool newValue) autostartInTray = newValue; } +bool Settings::getSignInNotificationEnabled() const +{ + return signInNotificationEnabled; +} + +void Settings::setSignInNotificationEnabled(bool newValue) +{ + signInNotificationEnabled = newValue; +} + +bool Settings::getStatusChangeNotificationEnabled() const +{ + return statusChangeNotificationEnabled; +} + +void Settings::setStatusChangeNotificationEnabled(bool newValue) +{ + statusChangeNotificationEnabled = newValue; +} + bool Settings::getUseTranslations() const { return useTranslations; diff --git a/src/misc/settings.h b/src/misc/settings.h index 9ff506ba3..545619160 100644 --- a/src/misc/settings.h +++ b/src/misc/settings.h @@ -137,11 +137,18 @@ public: bool isMinimizeOnCloseEnabled() const; void setMinimizeOnClose(bool newValue); + + bool getSignInNotificationEnabled() const; + void setSignInNotificationEnabled(bool newValue); + + bool getStatusChangeNotificationEnabled() const; + void setStatusChangeNotificationEnabled(bool newValue); // Privacy bool isTypingNotificationEnabled() const; void setTypingNotification(bool enabled); + // State bool getUseNativeStyle() const; void setUseNativeStyle(bool value); @@ -211,6 +218,8 @@ private: int firstColumnHandlePos; int secondColumnHandlePosFromRight; QString timestampFormat; + bool signInNotificationEnabled; + bool statusChangeNotificationEnabled; // Privacy bool typingNotification; diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index e2ae4cb1c..df083105e 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -33,6 +33,8 @@ GeneralForm::GeneralForm() : bodyUI->cbUseTranslations->setChecked(Settings::getInstance().getUseTranslations()); bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable()); bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray()); + bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled()); + bodyUI->signInNotificationsCheckbox->setChecked(Settings::getInstance().getSignInNotificationEnabled()); for (auto entry : SmileyPack::listSmileyPacks()) { @@ -40,7 +42,7 @@ GeneralForm::GeneralForm() : } bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack())); reloadSmiles(); - + bodyUI->styleBrowser->addItems(QStyleFactory::keys()); bodyUI->styleBrowser->addItem("None"); if(QStyleFactory::keys().contains(Settings::getInstance().getStyle())) @@ -61,6 +63,8 @@ GeneralForm::GeneralForm() : connect(bodyUI->cbUseTranslations, &QCheckBox::stateChanged, this, &GeneralForm::onUseTranslationUpdated); connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &GeneralForm::onMakeToxPortableUpdated); connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray); + connect(bodyUI->statusChangesCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange); + connect(bodyUI->signInNotificationsCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetSignInNotifications); connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int))); // new syntax can't handle overloaded signals... (at least not in a pretty way) connect(bodyUI->cbUDPDisabled, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated); @@ -101,6 +105,16 @@ void GeneralForm::onStyleSelected(QString style) this->setStyle(QStyleFactory::create(style)); } +void GeneralForm::onSetStatusChange() +{ + Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked()); +} + +void GeneralForm::onSetSignInNotifications() +{ + Settings::getInstance().setSignInNotificationEnabled(bodyUI->signInNotificationsCheckbox->isChecked()); +} + void GeneralForm::onSmileyBrowserIndexChanged(int index) { QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index b2ca84b56..06eeb2ac0 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -43,6 +43,8 @@ private slots: void onProxyPortEdited(int port); void onUseProxyUpdated(); void onStyleSelected(QString style); + void onSetStatusChange(); + void onSetSignInNotifications(); private: Ui::GeneralSettings *bodyUI; diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index d0d31b622..ffbbabae4 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -53,6 +53,20 @@ + + + + Show status changes + + + + + + + Notify me when contacts sign in + + + diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 124f60f90..0080b6e60 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -151,9 +151,9 @@ Widget::Widget(QWidget *parent) connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&))); connect(core, &Core::friendAdded, this, &Widget::addFriend); connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed); - connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged); connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged); connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged); + connect(core, &Core::friendSignedIn, this, &Widget::onFriendBecameOnline); connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged); connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived); connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived); @@ -538,6 +538,40 @@ void Widget::onFriendStatusChanged(int friendId, Status status) f->friendStatus = status; f->widget->updateStatusLight(); + + QString fStatus = ""; + switch(f->friendStatus){ + case Status::Away: + fStatus = "away"; break; + case Status::Busy: + fStatus = "busy"; break; + case Status::Offline: + fStatus = "offline"; break; + default: + fStatus = "online"; break; + } + + //won't print the message if there were no messages before + if(f->chatForm->actions().size() != 0 + && Settings::getInstance().getStatusChangeNotificationEnabled() == true) + f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white"); +} + +void Widget::onFriendBecameOnline(int friendId, Status status) +{ + Friend* f = FriendList::findFriend(friendId); + if (!f) + return; + + contactListWidget->moveWidget(f->widget, status); + + f->friendStatus = status; + f->widget->updateStatusLight(); + + //won't print the message if there were no messages before + if(f->chatForm->actions().size() != 0 + && Settings::getInstance().getSignInNotificationEnabled() == true) + f->chatForm->addSystemInfoMessage(f->getName() + " has became online", "white"); } void Widget::onFriendStatusMessageChanged(int friendId, const QString& message) diff --git a/src/widget/widget.h b/src/widget/widget.h index 4f50a133c..5f3300364 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -91,6 +91,7 @@ private slots: void addFriend(int friendId, const QString& userId); void addFriendFailed(const QString& userId); void onFriendStatusChanged(int friendId, Status status); + void onFriendBecameOnline(int friendId, Status status); void onFriendStatusMessageChanged(int friendId, const QString& message); void onFriendUsernameChanged(int friendId, const QString& username); void onChatroomWidgetClicked(GenericChatroomWidget *); From fea3fa3ac71c72c106c46dbd0611ba5b6c225764 Mon Sep 17 00:00:00 2001 From: agilob Date: Sat, 11 Oct 2014 00:39:24 +0100 Subject: [PATCH 10/20] renamed function --- src/widget/widget.cpp | 4 ++-- src/widget/widget.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 0080b6e60..a5a5c839a 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -153,7 +153,7 @@ Widget::Widget(QWidget *parent) connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed); connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged); connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged); - connect(core, &Core::friendSignedIn, this, &Widget::onFriendBecameOnline); + connect(core, &Core::friendSignedIn, this, &Widget::onFriendSignIn); connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged); connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived); connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived); @@ -557,7 +557,7 @@ void Widget::onFriendStatusChanged(int friendId, Status status) f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white"); } -void Widget::onFriendBecameOnline(int friendId, Status status) +void Widget::onFriendSignIn(int friendId, Status status) { Friend* f = FriendList::findFriend(friendId); if (!f) diff --git a/src/widget/widget.h b/src/widget/widget.h index 5f3300364..eaa0917a6 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -91,7 +91,7 @@ private slots: void addFriend(int friendId, const QString& userId); void addFriendFailed(const QString& userId); void onFriendStatusChanged(int friendId, Status status); - void onFriendBecameOnline(int friendId, Status status); + void onFriendSignIn(int friendId, Status status); void onFriendStatusMessageChanged(int friendId, const QString& message); void onFriendUsernameChanged(int friendId, const QString& username); void onChatroomWidgetClicked(GenericChatroomWidget *); From 8788931f3666370c3e8fadd6069b2dfa723c0348 Mon Sep 17 00:00:00 2001 From: agilob Date: Sat, 11 Oct 2014 11:48:45 +0100 Subject: [PATCH 11/20] number of messages is more reliable then activities --- src/widget/chatareawidget.cpp | 5 +++++ src/widget/chatareawidget.h | 1 + src/widget/form/genericchatform.cpp | 5 +++++ src/widget/form/genericchatform.h | 3 ++- src/widget/widget.cpp | 8 ++------ 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/widget/chatareawidget.cpp b/src/widget/chatareawidget.cpp index 542e3be40..0e5b58eb3 100644 --- a/src/widget/chatareawidget.cpp +++ b/src/widget/chatareawidget.cpp @@ -118,6 +118,11 @@ void ChatAreaWidget::insertMessage(ChatAction *msgAction) messages.append(msgAction); } +int ChatAreaWidget::getNumberOfMessages() +{ + return messages.size(); +} + void ChatAreaWidget::onSliderRangeChanged() { QScrollBar* scroll = verticalScrollBar(); diff --git a/src/widget/chatareawidget.h b/src/widget/chatareawidget.h index d1e2dbe8f..923da19af 100644 --- a/src/widget/chatareawidget.h +++ b/src/widget/chatareawidget.h @@ -33,6 +33,7 @@ public: int nameColWidth() {return nameWidth;} void setNameColWidth(int w); + int getNumberOfMessages(); signals: void onFileTranfertInterract(QString widgetName, QString buttonName); diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 0d31288e1..a42a956dd 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -127,6 +127,11 @@ GenericChatForm::GenericChatForm(QWidget *parent) : connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); } +int GenericChatForm::getNumberOfMessages() +{ + return chatWidget->getNumberOfMessages(); +} + void GenericChatForm::setName(const QString &newName) { nameLabel->setText(newName); diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index b8c373d23..0baa4f315 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -46,7 +46,8 @@ public: virtual void show(Ui::MainWindow &ui); void addMessage(QString author, QString message, bool isAction = false, QDateTime datetime=QDateTime::currentDateTime()); void addSystemInfoMessage(const QString &message, const QString &type, const QDateTime &datetime=QDateTime::currentDateTime()); - + int getNumberOfMessages(); + signals: void sendMessage(int, QString); void sendAction(int, QString); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index a5a5c839a..e41ed7df0 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -550,9 +550,9 @@ void Widget::onFriendStatusChanged(int friendId, Status status) default: fStatus = "online"; break; } - + //won't print the message if there were no messages before - if(f->chatForm->actions().size() != 0 + if(f->chatForm->getNumberOfMessages() != 0 && Settings::getInstance().getStatusChangeNotificationEnabled() == true) f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white"); } @@ -568,10 +568,6 @@ void Widget::onFriendSignIn(int friendId, Status status) f->friendStatus = status; f->widget->updateStatusLight(); - //won't print the message if there were no messages before - if(f->chatForm->actions().size() != 0 - && Settings::getInstance().getSignInNotificationEnabled() == true) - f->chatForm->addSystemInfoMessage(f->getName() + " has became online", "white"); } void Widget::onFriendStatusMessageChanged(int friendId, const QString& message) From 8be4725acdf824cde510941c176160045879feee Mon Sep 17 00:00:00 2001 From: dubslow Date: Thu, 16 Oct 2014 09:07:35 -0500 Subject: [PATCH 12/20] cleanup "sign in change", since it's unnecessary --- src/core.cpp | 2 +- src/core.h | 1 - src/misc/settings.cpp | 12 ----------- src/misc/settings.h | 6 +----- src/widget/form/settings/generalform.cpp | 7 ------ src/widget/form/settings/generalform.h | 1 - src/widget/form/settings/generalsettings.ui | 9 +------- src/widget/widget.cpp | 24 +++++---------------- src/widget/widget.h | 3 +-- 9 files changed, 9 insertions(+), 56 deletions(-) diff --git a/src/core.cpp b/src/core.cpp index b496f0960..325028b03 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -410,7 +410,7 @@ void Core::onUserStatusChanged(Tox*/* tox*/, int friendId, uint8_t userstatus, v void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status, void* core) { Status friendStatus = status ? Status::Online : Status::Offline; - emit static_cast(core)->friendSignedIn(friendId, friendStatus); + emit static_cast(core)->friendStatusChanged(friendId, friendStatus); if (friendStatus == Status::Offline) { static_cast(core)->checkLastOnline(friendId); diff --git a/src/core.h b/src/core.h index f0172b38c..189f4060a 100644 --- a/src/core.h +++ b/src/core.h @@ -115,7 +115,6 @@ signals: void friendAdded(int friendId, const QString& userId); void friendStatusChanged(int friendId, Status status); - void friendSignedIn(int friendId, Status friendStatus); void friendStatusMessageChanged(int friendId, const QString& message); void friendUsernameChanged(int friendId, const QString& username); void friendTypingChanged(int friendId, bool isTyping); diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp index bbe062750..037b4cbb6 100644 --- a/src/misc/settings.cpp +++ b/src/misc/settings.cpp @@ -139,7 +139,6 @@ void Settings::load() useNativeStyle = s.value("nativeStyle", false).toBool(); style = s.value("style", "None").toString(); statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool(); - signInNotificationEnabled = s.value("signInNotificationEnabled", false).toBool(); s.endGroup(); s.beginGroup("State"); @@ -248,7 +247,6 @@ void Settings::save(QString path) s.setValue("nativeStyle", useNativeStyle); s.setValue("style",style); s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled); - s.setValue("signInNotificationEnabled", signInNotificationEnabled); s.endGroup(); s.beginGroup("State"); @@ -381,16 +379,6 @@ void Settings::setAutostartInTray(bool newValue) autostartInTray = newValue; } -bool Settings::getSignInNotificationEnabled() const -{ - return signInNotificationEnabled; -} - -void Settings::setSignInNotificationEnabled(bool newValue) -{ - signInNotificationEnabled = newValue; -} - bool Settings::getStatusChangeNotificationEnabled() const { return statusChangeNotificationEnabled; diff --git a/src/misc/settings.h b/src/misc/settings.h index 545619160..79675fbd8 100644 --- a/src/misc/settings.h +++ b/src/misc/settings.h @@ -137,10 +137,7 @@ public: bool isMinimizeOnCloseEnabled() const; void setMinimizeOnClose(bool newValue); - - bool getSignInNotificationEnabled() const; - void setSignInNotificationEnabled(bool newValue); - + bool getStatusChangeNotificationEnabled() const; void setStatusChangeNotificationEnabled(bool newValue); @@ -218,7 +215,6 @@ private: int firstColumnHandlePos; int secondColumnHandlePosFromRight; QString timestampFormat; - bool signInNotificationEnabled; bool statusChangeNotificationEnabled; // Privacy diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index df083105e..df952892a 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -34,7 +34,6 @@ GeneralForm::GeneralForm() : bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable()); bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray()); bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled()); - bodyUI->signInNotificationsCheckbox->setChecked(Settings::getInstance().getSignInNotificationEnabled()); for (auto entry : SmileyPack::listSmileyPacks()) { @@ -64,7 +63,6 @@ GeneralForm::GeneralForm() : connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &GeneralForm::onMakeToxPortableUpdated); connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray); connect(bodyUI->statusChangesCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange); - connect(bodyUI->signInNotificationsCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetSignInNotifications); connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int))); // new syntax can't handle overloaded signals... (at least not in a pretty way) connect(bodyUI->cbUDPDisabled, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated); @@ -110,11 +108,6 @@ void GeneralForm::onSetStatusChange() Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked()); } -void GeneralForm::onSetSignInNotifications() -{ - Settings::getInstance().setSignInNotificationEnabled(bodyUI->signInNotificationsCheckbox->isChecked()); -} - void GeneralForm::onSmileyBrowserIndexChanged(int index) { QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index 06eeb2ac0..ab8325526 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -44,7 +44,6 @@ private slots: void onUseProxyUpdated(); void onStyleSelected(QString style); void onSetStatusChange(); - void onSetSignInNotifications(); private: Ui::GeneralSettings *bodyUI; diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index ffbbabae4..f10025c52 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -56,14 +56,7 @@ - Show status changes - - - - - - - Notify me when contacts sign in + Show contacts' status changes diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index e41ed7df0..bbff4ad90 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -153,7 +153,6 @@ Widget::Widget(QWidget *parent) connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed); connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged); connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged); - connect(core, &Core::friendSignedIn, this, &Widget::onFriendSignIn); connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged); connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived); connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived); @@ -542,32 +541,19 @@ void Widget::onFriendStatusChanged(int friendId, Status status) QString fStatus = ""; switch(f->friendStatus){ case Status::Away: - fStatus = "away"; break; + fStatus = tr("away", "contact status"); break; case Status::Busy: - fStatus = "busy"; break; + fStatus = tr("busy", "contact status"); break; case Status::Offline: - fStatus = "offline"; break; + fStatus = tr("offline", "contact status"); break; default: - fStatus = "online"; break; + fStatus = tr("online", "contact status"); break; } //won't print the message if there were no messages before if(f->chatForm->getNumberOfMessages() != 0 && Settings::getInstance().getStatusChangeNotificationEnabled() == true) - f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white"); -} - -void Widget::onFriendSignIn(int friendId, Status status) -{ - Friend* f = FriendList::findFriend(friendId); - if (!f) - return; - - contactListWidget->moveWidget(f->widget, status); - - f->friendStatus = status; - f->widget->updateStatusLight(); - + f->chatForm->addSystemInfoMessage(tr("%1 is now %2", "e.g. \"Dubslow is now online\"").arg(f->getName()).arg(fStatus), "white"); } void Widget::onFriendStatusMessageChanged(int friendId, const QString& message) diff --git a/src/widget/widget.h b/src/widget/widget.h index eaa0917a6..602e8a889 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -90,8 +90,7 @@ private slots: void setStatusMessage(const QString &statusMessage); void addFriend(int friendId, const QString& userId); void addFriendFailed(const QString& userId); - void onFriendStatusChanged(int friendId, Status status); - void onFriendSignIn(int friendId, Status status); + void onFriendStatusChanged(int friendId, Status status); void onFriendStatusMessageChanged(int friendId, const QString& message); void onFriendUsernameChanged(int friendId, const QString& username); void onChatroomWidgetClicked(GenericChatroomWidget *); From 6bda375a7ebb8e7eb110c9e5caacfae3b55116e7 Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 16 Oct 2014 18:24:16 +0100 Subject: [PATCH 13/20] fixes regression sent by apprb --- src/widget/form/settings/generalform.cpp | 6 +++--- src/widget/form/settingswidget.cpp | 4 ++-- src/widget/form/settingswidget.h | 2 +- src/widget/widget.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index b03fb18ab..e6b695031 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -26,11 +26,11 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png")) { + parent = myParent; + bodyUI = new Ui::GeneralSettings; bodyUI->setupUi(this); - parent = myParent; - bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6()); bodyUI->cbUseTranslations->setChecked(Settings::getInstance().getUseTranslations()); bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable()); @@ -104,7 +104,7 @@ void GeneralForm::onStyleSelected(QString style) { Settings::getInstance().setStyle(style); this->setStyle(QStyleFactory::create(style)); - parent->setStyle(style); + parent->setBodyHeadStyle(style); } void GeneralForm::onSetStatusChange() diff --git a/src/widget/form/settingswidget.cpp b/src/widget/form/settingswidget.cpp index 8bb378c79..1c29fec65 100644 --- a/src/widget/form/settingswidget.cpp +++ b/src/widget/form/settingswidget.cpp @@ -73,10 +73,10 @@ SettingsWidget::~SettingsWidget() { } -void SettingsWidget::setStyle(QString style) +void SettingsWidget::setBodyHeadStyle(QString style) { + head->setStyle(QStyleFactory::create(style)); body->setStyle(QStyleFactory::create(style)); - head->setStyle(QStyleFactory::create(style)); } void SettingsWidget::show(Ui::MainWindow& ui) diff --git a/src/widget/form/settingswidget.h b/src/widget/form/settingswidget.h index 03d3646c2..2ba183fd1 100644 --- a/src/widget/form/settingswidget.h +++ b/src/widget/form/settingswidget.h @@ -42,7 +42,7 @@ public: void show(Ui::MainWindow &ui); IdentityForm *getIdentityForm() {return ifrm;} - void setStyle(QString style); + void setBodyHeadStyle(QString style); private slots: void onTabChanged(int); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 27a0f2a25..bbff4ad90 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -113,7 +113,7 @@ Widget::Widget(QWidget *parent) ui->statusButton->setProperty("status", "offline"); Style::repolish(ui->statusButton); - settingsWidget = new SettingsWidget(this); + settingsWidget = new SettingsWidget(); // Disable some widgets until we're connected to the DHT ui->statusButton->setEnabled(false); From db6b4885152a2777b8dfc9f218198df4055cf979 Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 16 Oct 2014 18:49:50 +0100 Subject: [PATCH 14/20] UI for autoaway --- src/widget/form/settings/generalform.cpp | 8 +++++ src/widget/form/settings/generalform.h | 2 ++ src/widget/form/settings/generalsettings.ui | 38 ++++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index b03fb18ab..162e9413b 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -52,6 +52,8 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : else bodyUI->styleBrowser->setCurrentText("None"); + bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime()); + bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP()); bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr()); int port = Settings::getInstance().getProxyPort(); @@ -73,6 +75,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int))); connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated); connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString))); + connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged())); } GeneralForm::~GeneralForm() @@ -107,6 +110,11 @@ void GeneralForm::onStyleSelected(QString style) parent->setStyle(style); } +void GeneralForm::onAutoAwayChanged() +{ + Settings::getInstance().setAutoAwayTime(bodyUI->autoAwaySpinBox->value()); +} + void GeneralForm::onSetStatusChange() { Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked()); diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index 0efa6ce4a..31a73eb32 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -42,6 +42,8 @@ private slots: void onUseProxyUpdated(); void onStyleSelected(QString style); void onSetStatusChange(); + void onAutoAwayChanged(); + private: Ui::GeneralSettings *bodyUI; diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index f10025c52..da70efdae 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -7,7 +7,7 @@ 0 0 527 - 397 + 500 @@ -60,6 +60,42 @@ + + + + + + Provided in minutes + + + Qt::LeftToRight + + + Auto away after: + + + + + + + + 0 + 0 + + + + minutes + + + 1 + + + 600 + + + + + From f854d0e90fc58b56086023e2f8bd8645c36035cd Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 16 Oct 2014 19:48:45 +0100 Subject: [PATCH 15/20] set idle timer in widget.cpp --- src/widget/form/settings/generalform.cpp | 4 +++- src/widget/widget.cpp | 5 +++++ src/widget/widget.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index 162e9413b..8a556c4e7 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -112,7 +112,9 @@ void GeneralForm::onStyleSelected(QString style) void GeneralForm::onAutoAwayChanged() { - Settings::getInstance().setAutoAwayTime(bodyUI->autoAwaySpinBox->value()); + int minutes = bodyUI->autoAwaySpinBox->value(); + Settings::getInstance().setAutoAwayTime(minutes); + Widget::getInstance()->setIdleTimer(minutes); } void GeneralForm::onSetStatusChange() diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 27a0f2a25..9370d93d0 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -294,6 +294,11 @@ QString Widget::askProfiles() return profile; } +void Widget::setIdleTimer(int minutes) +{ + idleTimer->start(mins * 1000*60); +} + QString Widget::getUsername() { return core->getUsername(); diff --git a/src/widget/widget.h b/src/widget/widget.h index 602e8a889..98e664706 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -59,6 +59,7 @@ public: bool getIsWindowMinimized(); static QList searchProfiles(); void clearContactsList(); + void setIdleTimer(int minutes); ~Widget(); virtual void closeEvent(QCloseEvent *event); From ca0801552848785d717278a392b56e93c2ee473a Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 16 Oct 2014 19:52:13 +0100 Subject: [PATCH 16/20] s/min/minutes/ --- src/widget/widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 9370d93d0..d005aa476 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -296,7 +296,7 @@ QString Widget::askProfiles() void Widget::setIdleTimer(int minutes) { - idleTimer->start(mins * 1000*60); + idleTimer->start(minutes * 1000*60); } QString Widget::getUsername() From 951dc74258939640d9f7af0201bfbf3a7ea7b254 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Thu, 16 Oct 2014 23:14:22 +0200 Subject: [PATCH 17/20] buildPackages.sh : Don't rebuild libsodium everytime --- tools/buildPackages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildPackages.sh b/tools/buildPackages.sh index 501d7b429..9c4ca99f8 100755 --- a/tools/buildPackages.sh +++ b/tools/buildPackages.sh @@ -87,7 +87,7 @@ mv qTox-master $VERNAME # Build packages cd $VERNAME -./bootstrap.sh --local +./bootstrap.sh --local -t debuild -us -uc -aamd64 debuild -us -uc -ai386 cd .. From be707b032d10e658179201a1dcc9ae2a3d2d4792 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Thu, 16 Oct 2014 23:24:45 +0200 Subject: [PATCH 18/20] buildPackages.sh : Don't use --local bootstrap --- tools/buildPackages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildPackages.sh b/tools/buildPackages.sh index 9c4ca99f8..fb33d2abb 100755 --- a/tools/buildPackages.sh +++ b/tools/buildPackages.sh @@ -87,7 +87,7 @@ mv qTox-master $VERNAME # Build packages cd $VERNAME -./bootstrap.sh --local -t +./bootstrap.sh -t debuild -us -uc -aamd64 debuild -us -uc -ai386 cd .. From 9df5ab02ec96a7eb3c5b8cc1344c24f2e80859f0 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Thu, 16 Oct 2014 23:51:34 +0200 Subject: [PATCH 19/20] Debian: Update package dependencies --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index af90ab856..1147f4397 100644 --- a/debian/control +++ b/debian/control @@ -3,11 +3,11 @@ Maintainer: John Smith Section: misc Priority: optional Standards-Version: 3.9.5 -Build-Depends: debhelper (>= 9), cdbs, qt5-qmake, libopenal-dev (>= 1:1.15.1), libopencv-dev (>= 2.4.8), libopus-dev (>= 1.0), qtbase5-dev (>= 5.2), sudo, autoconf, libtool, pkg-config, libvpx-dev +Build-Depends: debhelper (>= 9), cdbs, qt5-qmake, libopenal-dev (>= 1:1.14), libopencv-dev (>= 2.3), libopus-dev (>= 0.9), qtbase5-dev (>= 5.2), sudo, autoconf, libtool, pkg-config, libvpx-dev Package: qtox Architecture: any -Depends: libc6 (>= 2.17), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libopenal1 (>= 1.14), libopencv-core2.4, libopencv-highgui2.4, libopus0 (>= 1.0), libqt5core5a (>= 5.2), libqt5gui5 (>= 5.2), libqt5network5 (>= 5.0), libqt5widgets5 (>= 5.2), libqt5xml5 (>= 5.0), libstdc++6 (>= 4.9), libvpx1 (>= 1.0.0) +Depends: ${shlibs:Depends}, ${misc:Depends}, libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libopenal1 (>= 1.14), libopus0 (>= 0.9), libqt5core5a (>= 5.2), libqt5gui5 (>= 5.2), libqt5network5 (>= 5.0), libqt5widgets5 (>= 5.2), libqt5xml5 (>= 5.0), libstdc++6 (>= 4.9), libvpx1 (>= 1.0.0) Description: Tox client qTox is a powerful Tox client that follows the Tox design guidelines. Tox is a decentralized and encrypted replacement for Skype, supporting From 3e8557466cb82a4e3f4ab45bf9ac385810c34058 Mon Sep 17 00:00:00 2001 From: dubslow Date: Fri, 17 Oct 2014 03:02:19 -0500 Subject: [PATCH 20/20] fix #445 --- src/widget/form/settings/identityform.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/widget/form/settings/identityform.cpp b/src/widget/form/settings/identityform.cpp index d61a9fb18..a518730f4 100644 --- a/src/widget/form/settings/identityform.cpp +++ b/src/widget/form/settings/identityform.cpp @@ -168,10 +168,17 @@ void IdentityForm::onImportClicked() QString path = QFileDialog::getOpenFileName(this, tr("Import profile", "import dialog title"), QDir::homePath(), tr("Tox save file (*.tox)", "import dialog filter")); if (path.isEmpty()) return; + QFileInfo info(path); + + if (info.suffix() != "tox") + { + QMessageBox::warning(this, tr("Ignoring non-Tox file", "popup title"), tr("Warning: you've chosen a file that is not a Tox save file; ignoring.", "popup text")); + return; + } + QString profile = info.completeBaseName(); QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT); QFile::copy(path, profilePath); bodyUI->profiles->addItem(profile); - Core::getInstance()->switchConfiguration(profile); }