ProfileForm::ProfileForm(QWidget* parent) : QWidget{parent} , qr{nullptr} { bodyUI = new Ui::IdentitySettings; bodyUI->setupUi(this); core = Core::getInstance(); bodyUI->userNameLabel->setToolTip(tr("Tox user names cannot exceed %1 characters.") .arg(TOX_MAX_NAME_LENGTH)); bodyUI->userName->setMaxLength(TOX_MAX_NAME_LENGTH); // tox toxId = new ClickableTE(); toxId->setReadOnly(true); toxId->setFrame(false); toxId->setFont(Style::getFont(Style::Small)); toxId->setToolTip(bodyUI->toxId->toolTip()); QVBoxLayout* toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout()); delete toxIdGroup->replaceWidget(bodyUI->toxId, toxId); // Original toxId is in heap, delete it bodyUI->toxId->hide(); /* Toxme section init */ bodyUI->toxmeServersList->addItem("toxme.io"); QString toxmeInfo = Settings::getInstance().getToxmeInfo(); if (toxmeInfo.isEmpty()) // User not registered { showRegisterToxme(); } else { showExistingToxme(); } bodyUI->qrLabel->setWordWrap(true); QRegExp re("[^@ ]+"); QRegExpValidator* validator = new QRegExpValidator(re, this); bodyUI->toxmeUsername->setValidator(validator); profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg"); profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg")); profilePicture->setContextMenuPolicy(Qt::CustomContextMenu); profilePicture->setClickable(true); profilePicture->installEventFilter(this); profilePicture->setAccessibleName("Profile avatar"); profilePicture->setAccessibleDescription("Set a profile avatar shown to all contacts"); connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked())); connect(profilePicture, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showProfilePictureContextMenu(const QPoint&))); QHBoxLayout* publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout()); publicGrouplayout->insertWidget(0, profilePicture); publicGrouplayout->insertSpacing(1, 7); timer.setInterval(750); timer.setSingleShot(true); connect(&timer, &QTimer::timeout, this, [=]() { bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false; }); connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked())); connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked())); connect(core, &Core::idSet, this, &ProfileForm::setToxId); connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited())); connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited())); connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked); connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked); connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked); connect(bodyUI->logoutButton, &QPushButton::clicked, this, &ProfileForm::onLogoutClicked); connect(bodyUI->deletePassButton, &QPushButton::clicked, this, &ProfileForm::onDeletePassClicked); connect(bodyUI->changePassButton, &QPushButton::clicked, this, &ProfileForm::onChangePassClicked); connect(bodyUI->deletePassButton, &QPushButton::clicked, this, &ProfileForm::setPasswordButtonsText); connect(bodyUI->changePassButton, &QPushButton::clicked, this, &ProfileForm::setPasswordButtonsText); connect(bodyUI->saveQr, &QPushButton::clicked, this, &ProfileForm::onSaveQrClicked); connect(bodyUI->copyQr, &QPushButton::clicked, this, &ProfileForm::onCopyQrClicked); connect(bodyUI->toxmeRegisterButton, &QPushButton::clicked, this, &ProfileForm::onRegisterButtonClicked); connect(bodyUI->toxmeUpdateButton, &QPushButton::clicked, this, &ProfileForm::onRegisterButtonClicked); connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); }); connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); }); for (QComboBox* cb : findChildren<QComboBox*>()) { cb->installEventFilter(this); cb->setFocusPolicy(Qt::StrongFocus); } retranslateUi(); Translator::registerHandler(std::bind(&ProfileForm::retranslateUi, this), this); }
ProfileForm::ProfileForm(QWidget *parent) : QWidget{parent}, qr{nullptr} { bodyUI = new Ui::IdentitySettings; bodyUI->setupUi(this); core = Core::getInstance(); head = new QWidget(this); QHBoxLayout* headLayout = new QHBoxLayout(); head->setLayout(headLayout); QLabel* imgLabel = new QLabel(); headLayout->addWidget(imgLabel); QLabel* nameLabel = new QLabel(); QFont bold; bold.setBold(true); nameLabel->setFont(bold); headLayout->addWidget(nameLabel); headLayout->addStretch(1); nameLabel->setText(tr("User Profile")); imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation)); // tox toxId = new ClickableTE(); toxId->setReadOnly(true); toxId->setFrame(false); toxId->setFont(Style::getFont(Style::Small)); toxId->setToolTip(bodyUI->toxId->toolTip()); QVBoxLayout *toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout()); toxIdGroup->replaceWidget(bodyUI->toxId, toxId); bodyUI->toxId->hide(); bodyUI->qrLabel->setWordWrap(true); profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg"); profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg")); profilePicture->setClickable(true); connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked())); QHBoxLayout *publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout()); publicGrouplayout->insertWidget(0, profilePicture); publicGrouplayout->insertSpacing(1, 7); timer.setInterval(750); timer.setSingleShot(true); connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false;}); connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked())); connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked())); connect(core, &Core::idSet, this, &ProfileForm::setToxId); connect(core, &Core::statusSet, this, &ProfileForm::onStatusSet); connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited())); connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited())); connect(bodyUI->loadButton, &QPushButton::clicked, this, &ProfileForm::onLoadClicked); connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked); connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked); connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked); connect(bodyUI->importButton, &QPushButton::clicked, this, &ProfileForm::onImportClicked); connect(bodyUI->newButton, &QPushButton::clicked, this, &ProfileForm::onNewClicked); connect(core, &Core::avStart, this, &ProfileForm::disableSwitching); connect(core, &Core::avStarting, this, &ProfileForm::disableSwitching); connect(core, &Core::avInvite, this, &ProfileForm::disableSwitching); connect(core, &Core::avRinging, this, &ProfileForm::disableSwitching); connect(core, &Core::avCancel, this, &ProfileForm::enableSwitching); connect(core, &Core::avEnd, this, &ProfileForm::enableSwitching); connect(core, &Core::avEnding, this, &ProfileForm::enableSwitching); connect(core, &Core::avPeerTimeout, this, &ProfileForm::enableSwitching); connect(core, &Core::avRequestTimeout, this, &ProfileForm::enableSwitching); connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); }); connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); }); for (QComboBox* cb : findChildren<QComboBox*>()) { cb->installEventFilter(this); cb->setFocusPolicy(Qt::StrongFocus); } }
void Widget::init() { ui->setupUi(this); if (QSystemTrayIcon::isSystemTrayAvailable()) { icon = new QSystemTrayIcon(this); icon->setIcon(this->windowIcon()); trayMenu = new QMenu; statusOnline = new QAction(tr("Online"), this); statusOnline->setIcon(QIcon(":ui/statusButton/dot_online.png")); connect(statusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline())); statusAway = new QAction(tr("Away"), this); statusAway->setIcon(QIcon(":ui/statusButton/dot_idle.png")); connect(statusAway, SIGNAL(triggered()), this, SLOT(setStatusAway())); statusBusy = new QAction(tr("Busy"), this); connect(statusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy())); statusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png")); actionQuit = new QAction(tr("&Quit"), this); connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); trayMenu->addAction(new QAction(tr("Change status to:"), this)); trayMenu->addAction(statusOnline); trayMenu->addAction(statusAway); trayMenu->addAction(statusBusy); trayMenu->addSeparator(); trayMenu->addAction(actionQuit); icon->setContextMenu(trayMenu); connect(icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onIconClick(QSystemTrayIcon::ActivationReason))); icon->show(); if(Settings::getInstance().getAutostartInTray() == false) this->show(); } else { qWarning() << "No system tray detected!"; this->show(); } ui->statusbar->hide(); ui->menubar->hide(); //restore window state restoreGeometry(Settings::getInstance().getWindowGeometry()); restoreState(Settings::getInstance().getWindowState()); ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()); layout()->setContentsMargins(0, 0, 0, 0); ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css")); profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.png"); profilePicture->setPixmap(QPixmap(":/img/contact_dark.png")); profilePicture->setClickable(true); ui->myProfile->insertWidget(0, profilePicture); ui->myProfile->insertSpacing(1, 7); ui->mainContent->setLayout(new QVBoxLayout()); ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); ui->mainHead->layout()->setSpacing(0); 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")); ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); contactListWidget = new FriendListWidget(); ui->friendList->setWidget(contactListWidget); ui->friendList->setLayoutDirection(Qt::RightToLeft); ui->nameLabel->setEditable(true); ui->statusLabel->setEditable(true); ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); QMenu *statusButtonMenu = new QMenu(ui->statusButton); QAction* setStatusOnline = statusButtonMenu->addAction(Widget::tr("Online","Button to set your status to 'Online'")); setStatusOnline->setIcon(QIcon(":ui/statusButton/dot_online.png")); QAction* setStatusAway = statusButtonMenu->addAction(Widget::tr("Away","Button to set your status to 'Away'")); setStatusAway->setIcon(QIcon(":ui/statusButton/dot_idle.png")); QAction* setStatusBusy = statusButtonMenu->addAction(Widget::tr("Busy","Button to set your status to 'Busy'")); setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png")); ui->statusButton->setMenu(statusButtonMenu); // disable proportional scaling ui->mainSplitter->setStretchFactor(0,0); ui->mainSplitter->setStretchFactor(1,1); ui->statusButton->setProperty("status", "offline"); Style::repolish(ui->statusButton); // 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>("Status"); qRegisterMetaType<vpx_image>("vpx_image"); qRegisterMetaType<uint8_t>("uint8_t"); qRegisterMetaType<uint16_t>("uint16_t"); qRegisterMetaType<int32_t>("int32_t"); qRegisterMetaType<int64_t>("int64_t"); qRegisterMetaType<QPixmap>("QPixmap"); qRegisterMetaType<ToxFile>("ToxFile"); qRegisterMetaType<ToxFile::FileDirection>("ToxFile::FileDirection"); qRegisterMetaType<Core::PasswordType>("Core::PasswordType"); QString profilePath = detectProfile(); coreThread = new QThread(this); core = new Core(Camera::getInstance(), coreThread, profilePath); core->moveToThread(coreThread); connect(coreThread, &QThread::started, core, &Core::start); filesForm = new FilesForm(); addFriendForm = new AddFriendForm; settingsWidget = new SettingsWidget(); connect(core, &Core::connected, this, &Widget::onConnected); connect(core, &Core::disconnected, this, &Widget::onDisconnected); connect(core, &Core::failedToStart, this, &Widget::onFailedToStartCore); connect(core, &Core::badProxy, this, &Widget::onBadProxyCore); connect(core, &Core::statusSet, this, &Widget::onStatusSet); connect(core, &Core::usernameSet, this, &Widget::setUsername); connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage); connect(core, &Core::selfAvatarChanged, this, &Widget::onSelfAvatarLoaded); connect(core, SIGNAL(fileDownloadFinished(const QString&)), filesForm, SLOT(onFileDownloadComplete(const QString&))); 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::friendUsernameChanged, this, &Widget::onFriendUsernameChanged); connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged); connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged); connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived); connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived); connect(core, &Core::groupInviteReceived, this, &Widget::onGroupInviteReceived); connect(core, &Core::groupMessageReceived, this, &Widget::onGroupMessageReceived); connect(core, &Core::groupNamelistChanged, this, &Widget::onGroupNamelistChanged); connect(core, &Core::emptyGroupCreated, this, &Widget::onEmptyGroupCreated); connect(core, &Core::avInvite, this, &Widget::playRingtone); connect(core, &Core::blockingClearContacts, this, &Widget::clearContactsList, Qt::BlockingQueuedConnection); connect(core, &Core::blockingGetPassword, this, &Widget::getPassword, Qt::BlockingQueuedConnection); connect(core, SIGNAL(messageSentResult(int,QString,int)), this, SLOT(onMessageSendResult(int,QString,int))); connect(core, SIGNAL(groupSentResult(int,QString,int)), this, SLOT(onGroupSendResult(int,QString,int))); connect(this, &Widget::statusSet, core, &Core::setStatus); connect(this, &Widget::friendRequested, core, &Core::requestFriendship); connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest); connect(this, &Widget::changeProfile, core, &Core::switchConfiguration); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked())); connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked())); connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked())); connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked())); connect(ui->nameLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onUsernameChanged(QString, QString))); connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString))); connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked())); connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline())); connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway())); connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy())); connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString))); connect(idleTimer, &QTimer::timeout, this, &Widget::onUserAway); coreThread->start(); addFriendForm->show(*ui); #if (AUTOUPDATE_ENABLED) if (Settings::getInstance().getCheckUpdates()) AutoUpdater::checkUpdatesAsyncInteractive(); #endif }
ProfileForm::ProfileForm(QWidget *parent) : QWidget{parent}, qr{nullptr} { bodyUI = new Ui::IdentitySettings; bodyUI->setupUi(this); core = Core::getInstance(); head = new QWidget(this); QHBoxLayout* headLayout = new QHBoxLayout(); head->setLayout(headLayout); QLabel* imgLabel = new QLabel(); headLayout->addWidget(imgLabel); nameLabel = new QLabel(); QFont bold; bold.setBold(true); nameLabel->setFont(bold); headLayout->addWidget(nameLabel); headLayout->addStretch(1); imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation)); // tox toxId = new ClickableTE(); toxId->setReadOnly(true); toxId->setFrame(false); toxId->setFont(Style::getFont(Style::Small)); toxId->setToolTip(bodyUI->toxId->toolTip()); QVBoxLayout *toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout()); delete toxIdGroup->replaceWidget(bodyUI->toxId, toxId); // Original toxId is in heap, delete it bodyUI->toxId->hide(); bodyUI->qrLabel->setWordWrap(true); profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg"); profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg")); profilePicture->setContextMenuPolicy(Qt::CustomContextMenu); profilePicture->setClickable(true); profilePicture->installEventFilter(this); connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked())); connect(profilePicture, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showProfilePictureContextMenu(const QPoint&))); QHBoxLayout *publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout()); publicGrouplayout->insertWidget(0, profilePicture); publicGrouplayout->insertSpacing(1, 7); timer.setInterval(750); timer.setSingleShot(true); connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false;}); connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked())); connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked())); connect(core, &Core::idSet, this, &ProfileForm::setToxId); connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited())); connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited())); connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked); connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked); connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked); connect(bodyUI->logoutButton, &QPushButton::clicked, this, &ProfileForm::onLogoutClicked); connect(bodyUI->deletePassButton, &QPushButton::clicked, this, &ProfileForm::onDeletePassClicked); connect(bodyUI->changePassButton, &QPushButton::clicked, this, &ProfileForm::onChangePassClicked); connect(bodyUI->saveQr, &QPushButton::clicked, this, &ProfileForm::onSaveQrClicked); connect(bodyUI->copyQr, &QPushButton::clicked, this, &ProfileForm::onCopyQrClicked); connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); }); connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); }); for (QComboBox* cb : findChildren<QComboBox*>()) { cb->installEventFilter(this); cb->setFocusPolicy(Qt::StrongFocus); } retranslateUi(); Translator::registerHandler(std::bind(&ProfileForm::retranslateUi, this), this); }
void Widget::init() { ui->setupUi(this); timer = new QTimer(); timer->start(1000); offlineMsgTimer = new QTimer(); offlineMsgTimer->start(15000); //restore window state restoreGeometry(Settings::getInstance().getWindowGeometry()); restoreState(Settings::getInstance().getWindowState()); ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()); statusOnline = new QAction(tr("Online", "Button to set your status to 'Online'"), this); statusOnline->setIcon(QIcon(":img/status/dot_online.png")); connect(statusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline())); statusAway = new QAction(tr("Away", "Button to set your status to 'Away'"), this); statusAway->setIcon(QIcon(":img/status/dot_idle.png")); connect(statusAway, SIGNAL(triggered()), this, SLOT(setStatusAway())); statusBusy = new QAction(tr("Busy", "Button to set your status to 'Busy'"), this); statusBusy->setIcon(QIcon(":img/status/dot_busy.png")); connect(statusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy())); if (QSystemTrayIcon::isSystemTrayAvailable()) { icon = new SystemTrayIcon; updateTrayIcon(); trayMenu = new QMenu; actionQuit = new QAction(tr("&Quit"), this); connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); trayMenu->addAction(statusOnline); trayMenu->addAction(statusAway); trayMenu->addAction(statusBusy); trayMenu->addSeparator(); trayMenu->addAction(actionQuit); icon->setContextMenu(trayMenu); connect(icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onIconClick(QSystemTrayIcon::ActivationReason))); icon->show(); icon->hide(); if (Settings::getInstance().getShowSystemTray()) { icon->show(); if (Settings::getInstance().getAutostartInTray() == false) this->show(); } else this->show(); } else { qWarning() << "Widget: No system tray detected!"; icon = nullptr; this->show(); } ui->statusbar->hide(); ui->menubar->hide(); layout()->setContentsMargins(0, 0, 0, 0); ui->friendList->setStyleSheet(Style::resolve(Style::getStylesheet(":ui/friendList/friendList.css"))); profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.png"); profilePicture->setPixmap(QPixmap(":/img/contact_dark.png")); profilePicture->setClickable(true); ui->myProfile->insertWidget(0, profilePicture); ui->myProfile->insertSpacing(1, 7); ui->mainContent->setLayout(new QVBoxLayout()); ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); ui->mainHead->layout()->setSpacing(0); ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}")); 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")); ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); contactListWidget = new FriendListWidget(); ui->friendList->setWidget(contactListWidget); ui->friendList->setLayoutDirection(Qt::RightToLeft); ui->nameLabel->setEditable(true); ui->statusLabel->setEditable(true); ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); QMenu *statusButtonMenu = new QMenu(ui->statusButton); statusButtonMenu->addAction(statusOnline); statusButtonMenu->addAction(statusAway); statusButtonMenu->addAction(statusBusy); ui->statusButton->setMenu(statusButtonMenu); // disable proportional scaling ui->mainSplitter->setStretchFactor(0,0); ui->mainSplitter->setStretchFactor(1,1); ui->statusButton->setProperty("status", "offline"); Style::repolish(ui->statusButton); // Disable some widgets until we're connected to the DHT ui->statusButton->setEnabled(false); Style::setThemeColor(Settings::getInstance().getThemeColor()); reloadTheme(); filesForm = new FilesForm(); addFriendForm = new AddFriendForm; settingsWidget = new SettingsWidget(); Core* core = Nexus::getCore(); connect(core, SIGNAL(fileDownloadFinished(const QString&)), filesForm, SLOT(onFileDownloadComplete(const QString&))); connect(core, SIGNAL(fileUploadFinished(const QString&)), filesForm, SLOT(onFileUploadComplete(const QString&))); connect(settingsWidget, &SettingsWidget::setShowSystemTray, this, &Widget::onSetShowSystemTray); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked())); connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked())); connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked())); connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked())); connect(ui->nameLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onUsernameChanged(QString, QString))); connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString))); connect(ui->mainSplitter, &QSplitter::splitterMoved, this, &Widget::onSplitterMoved); connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked())); connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString))); connect(timer, &QTimer::timeout, this, &Widget::onUserAwayCheck); connect(timer, &QTimer::timeout, this, &Widget::onEventIconTick); connect(offlineMsgTimer, &QTimer::timeout, this, &Widget::processOfflineMsgs); addFriendForm->show(*ui); #if (AUTOUPDATE_ENABLED) if (Settings::getInstance().getCheckUpdates()) AutoUpdater::checkUpdatesAsyncInteractive(); #endif }