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 diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp index 84c4a2003..5849126d6 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"); @@ -136,6 +137,8 @@ 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(); + statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool(); s.endGroup(); s.beginGroup("State"); @@ -221,6 +224,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"); @@ -241,6 +245,8 @@ void Settings::save(QString path) s.setValue("timestampFormat", timestampFormat); s.setValue("minimizeOnClose", minimizeOnClose); s.setValue("nativeStyle", useNativeStyle); + s.setValue("style",style); + s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled); s.endGroup(); s.beginGroup("State"); @@ -358,11 +364,31 @@ 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; } +bool Settings::getStatusChangeNotificationEnabled() const +{ + return statusChangeNotificationEnabled; +} + +void Settings::setStatusChangeNotificationEnabled(bool newValue) +{ + statusChangeNotificationEnabled = newValue; +} + bool Settings::getUseTranslations() const { return useTranslations; @@ -452,6 +478,18 @@ void Settings::setEncryptTox(bool newValue) encryptTox = 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 1552f62ba..330f73618 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); @@ -79,6 +82,9 @@ public: bool getEncryptTox() const; void setEncryptTox(bool newValue); + int getAutoAwayTime() const; + void setAutoAwayTime(int newValue); + QPixmap getSavedAvatar(const QString& ownerId); void saveAvatar(QPixmap& pic, const QString& ownerId); @@ -135,10 +141,14 @@ public: bool isMinimizeOnCloseEnabled() const; void setMinimizeOnClose(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); @@ -188,6 +198,8 @@ private: bool encryptLogs; bool encryptTox; + int autoAwayTime; + QHash widgetSettings; // GUI @@ -201,11 +213,13 @@ private: QByteArray windowGeometry; QByteArray windowState; QByteArray splitterState; - + QString style; + // ChatView int firstColumnHandlePos; int secondColumnHandlePosFromRight; QString timestampFormat; + bool statusChangeNotificationEnabled; // Privacy bool typingNotification; diff --git a/src/misc/smileypack.cpp b/src/misc/smileypack.cpp index 57a754c76..f3230c3ea 100644 --- a/src/misc/smileypack.cpp +++ b/src/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/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/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index 3ac8bcf70..8a3dd0536 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -21,24 +21,39 @@ #include "src/misc/settings.h" #include "src/misc/smileypack.h" #include +#include -GeneralForm::GeneralForm() : +GeneralForm::GeneralForm(SettingsWidget *myParent) : GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png")) { + parent = myParent; + bodyUI = new Ui::GeneralSettings; bodyUI->setupUi(this); - + bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6()); bodyUI->cbUseTranslations->setChecked(Settings::getInstance().getUseTranslations()); bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable()); bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray()); + bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled()); for (auto entry : SmileyPack::listSmileyPacks()) { bodyUI->smileyPackBrowser->addItem(entry.first, entry.second); } 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->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime()); + bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP()); bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr()); int port = Settings::getInstance().getProxyPort(); @@ -52,12 +67,15 @@ 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->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); 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))); + connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged())); } GeneralForm::~GeneralForm() @@ -85,10 +103,30 @@ void GeneralForm::onSetAutostartInTray() Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked()); } +void GeneralForm::onStyleSelected(QString style) +{ + Settings::getInstance().setStyle(style); + this->setStyle(QStyleFactory::create(style)); + parent->setBodyHeadStyle(style); +} + +void GeneralForm::onAutoAwayChanged() +{ + int minutes = bodyUI->autoAwaySpinBox->value(); + Settings::getInstance().setAutoAwayTime(minutes); + Widget::getInstance()->setIdleTimer(minutes); +} + +void GeneralForm::onSetStatusChange() +{ + Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked()); +} + void GeneralForm::onSmileyBrowserIndexChanged(int index) { QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); Settings::getInstance().setSmileyPack(filename); + reloadSmiles(); } void GeneralForm::onUDPUpdated() @@ -119,3 +157,26 @@ void GeneralForm::onUseProxyUpdated() bodyUI->proxyPort->setEnabled(state); Settings::getInstance().setUseProxy(state); } + +void GeneralForm::reloadSmiles() +{ + QList emoticons = SmileyPack::getInstance().getEmoticons(); + QStringList smiles; + 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)); + 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/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index 224c6ee26..31a73eb32 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -18,8 +18,6 @@ #define GENERALFORM_H #include "genericsettings.h" -#include -#include namespace Ui { class GeneralSettings; @@ -29,7 +27,7 @@ class GeneralForm : public GenericForm { Q_OBJECT public: - GeneralForm(); + GeneralForm(SettingsWidget *parent); ~GeneralForm(); private slots: @@ -42,9 +40,15 @@ private slots: void onProxyAddrEdited(); void onProxyPortEdited(int port); void onUseProxyUpdated(); + void onStyleSelected(QString style); + void onSetStatusChange(); + void onAutoAwayChanged(); + private: Ui::GeneralSettings *bodyUI; + void reloadSmiles(); + SettingsWidget *parent; }; #endif diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index e0ffb3ab4..da70efdae 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -7,7 +7,7 @@ 0 0 527 - 369 + 500 @@ -53,6 +53,49 @@ + + + + Show contacts' status changes + + + + + + + + + Provided in minutes + + + Qt::LeftToRight + + + Auto away after: + + + + + + + + 0 + 0 + + + + minutes + + + 1 + + + 600 + + + + + @@ -72,6 +115,70 @@ + + + + + + :) + + + + + + + + + + ;) + + + + + + + + + + :p + + + + + + + + + + :O + + + + + + + + + + :'( + + + + + + + + + + + + Style + + + + + + 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); } diff --git a/src/widget/form/settingswidget.cpp b/src/widget/form/settingswidget.cpp index b5f33a3bf..1c29fec65 100644 --- a/src/widget/form/settingswidget.cpp +++ b/src/widget/form/settingswidget.cpp @@ -52,7 +52,7 @@ SettingsWidget::SettingsWidget(QWidget* parent) tabBar = new QTabBar; bodyLayout->addWidget(tabBar); - GeneralForm *gfrm = new GeneralForm; + GeneralForm *gfrm = new GeneralForm(this); ifrm = new IdentityForm; PrivacyForm *pfrm = new PrivacyForm; AVForm *avfrm = new AVForm; @@ -73,6 +73,12 @@ SettingsWidget::~SettingsWidget() { } +void SettingsWidget::setBodyHeadStyle(QString style) +{ + head->setStyle(QStyleFactory::create(style)); + body->setStyle(QStyleFactory::create(style)); +} + void SettingsWidget::show(Ui::MainWindow& ui) { ui.mainContent->layout()->addWidget(body); diff --git a/src/widget/form/settingswidget.h b/src/widget/form/settingswidget.h index 6dca68b82..2ba183fd1 100644 --- a/src/widget/form/settingswidget.h +++ b/src/widget/form/settingswidget.h @@ -19,6 +19,8 @@ #include #include +#include + class Camera; class GenericForm; class GeneralForm; @@ -40,6 +42,7 @@ public: void show(Ui::MainWindow &ui); IdentityForm *getIdentityForm() {return ifrm;} + void setBodyHeadStyle(QString style); private slots: void onTabChanged(int); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index a1abb9719..07c2aa05a 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -42,7 +42,9 @@ #include #include #include +#include #include +#include Widget *Widget::instance{nullptr}; @@ -74,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(); @@ -107,6 +118,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"); @@ -135,7 +151,6 @@ 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::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged); @@ -170,6 +185,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(); @@ -279,6 +295,11 @@ QString Widget::askProfiles() return profile; } +void Widget::setIdleTimer(int minutes) +{ + idleTimer->start(minutes * 1000*60); +} + QString Widget::getUsername() { return core->getUsername(); @@ -522,6 +543,23 @@ void Widget::onFriendStatusChanged(int friendId, Status status) f->friendStatus = status; f->widget->updateStatusLight(); + + QString fStatus = ""; + switch(f->friendStatus){ + case Status::Away: + fStatus = tr("away", "contact status"); break; + case Status::Busy: + fStatus = tr("busy", "contact status"); break; + case Status::Offline: + fStatus = tr("offline", "contact status"); break; + default: + 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(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) @@ -783,18 +821,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 db5fc282e..0eac7a9e0 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 { @@ -57,6 +58,8 @@ public: bool isFriendWidgetCurActiveWidget(Friend* f); bool getIsWindowMinimized(); static QList searchProfiles(); + void clearContactsList(); + void setIdleTimer(int minutes); ~Widget(); virtual void closeEvent(QCloseEvent *event); @@ -108,7 +111,7 @@ private slots: void onGroupSendResult(int groupId, const QString& message, int result); void playRingtone(); void onIconClick(); - void clearContactsList(); + void onUserAway(); void getPassword(); private: @@ -133,6 +136,8 @@ private: FriendListWidget* contactListWidget; MaskablePixmapWidget* profilePicture; bool notify(QObject *receiver, QEvent *event); + bool autoAwayActive = false; + QTimer* idleTimer; }; #endif // WIDGET_H diff --git a/tools/buildPackages.sh b/tools/buildPackages.sh index 501d7b429..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 +./bootstrap.sh -t debuild -us -uc -aamd64 debuild -us -uc -ai386 cd .. diff --git a/translations/it.qm b/translations/it.qm index ace34002b..631dfcb58 100644 Binary files a/translations/it.qm and b/translations/it.qm differ 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> 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