FormEditAccount::FormEditAccount(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormEditAccount), m_editableRoot(nullptr) { m_ui->setupUi(this); m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint); setWindowIcon(qApp->icons()->fromTheme(QSL("tinytinyrss"))); m_ui->m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates " "of feeds will be probably much slower and may time-out often.")); m_ui->m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(MINIMAL_API_LEVEL)); m_ui->m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username")); m_ui->m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password")); m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account")); m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account")); m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("FULL URL of your TT-RSS instance WITH trailing \"/api/\" string")); m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Information, tr("No test done yet."), tr("Here, results of connection test are shown.")); setTabOrder(m_ui->m_txtUrl->lineEdit(), m_ui->m_checkServerSideUpdate); setTabOrder(m_ui->m_checkServerSideUpdate, m_ui->m_txtUsername->lineEdit()); setTabOrder(m_ui->m_txtUsername->lineEdit(), m_ui->m_txtPassword->lineEdit()); setTabOrder(m_ui->m_txtPassword->lineEdit(), m_ui->m_checkShowPassword); setTabOrder(m_ui->m_checkShowPassword, m_ui->m_gbHttpAuthentication); setTabOrder(m_ui->m_gbHttpAuthentication, m_ui->m_txtHttpUsername->lineEdit()); setTabOrder(m_ui->m_txtHttpUsername->lineEdit(), m_ui->m_txtHttpPassword->lineEdit()); setTabOrder(m_ui->m_txtHttpPassword->lineEdit(), m_ui->m_checkShowHttpPassword); setTabOrder(m_ui->m_checkShowHttpPassword, m_ui->m_btnTestSetup); setTabOrder(m_ui->m_btnTestSetup, m_ui->m_buttonBox); connect(m_ui->m_checkShowPassword, SIGNAL(toggled(bool)), this, SLOT(displayPassword(bool))); connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(onClickedOk())); connect(m_ui->m_buttonBox, SIGNAL(rejected()), this, SLOT(onClickedCancel())); connect(m_ui->m_txtPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onPasswordChanged())); connect(m_ui->m_txtUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onUsernameChanged())); connect(m_ui->m_txtHttpPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onHttpPasswordChanged())); connect(m_ui->m_txtHttpUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onHttpUsernameChanged())); connect(m_ui->m_txtUrl->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onUrlChanged())); connect(m_ui->m_txtPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton())); connect(m_ui->m_txtUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton())); connect(m_ui->m_txtUrl->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton())); connect(m_ui->m_btnTestSetup, SIGNAL(clicked()), this, SLOT(performTest())); connect(m_ui->m_gbHttpAuthentication, SIGNAL(toggled(bool)), this, SLOT(onHttpPasswordChanged())); connect(m_ui->m_gbHttpAuthentication, SIGNAL(toggled(bool)), this, SLOT(onHttpUsernameChanged())); connect(m_ui->m_checkShowHttpPassword, SIGNAL(toggled(bool)), this, SLOT(displayHttpPassword(bool))); onPasswordChanged(); onUsernameChanged(); onUrlChanged(); onHttpPasswordChanged(); onHttpUsernameChanged(); checkOkButton(); displayPassword(false); displayHttpPassword(false); }
FormEditTtRssAccount::FormEditTtRssAccount(QWidget* parent) : QDialog(parent), m_ui(new Ui::FormEditTtRssAccount), m_editableRoot(nullptr) { m_ui->setupUi(this); m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok); GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("tinytinyrss"))); m_ui->m_lblTestResult->label()->setWordWrap(true); m_ui->m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates " "of feeds will be probably much slower and may time-out often.")); m_ui->m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(TTRSS_MINIMAL_API_LEVEL)); m_ui->m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username")); m_ui->m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password")); m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account")); m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account")); m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your TT-RSS instance WITHOUT trailing \"/api/\" string")); m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Information, tr("No test done yet."), tr("Here, results of connection test are shown.")); GuiUtilities::setLabelAsNotice(*m_ui->m_lblDescription, false); GuiUtilities::setLabelAsNotice(*m_ui->m_lblServerSideUpdateInformation, false); setTabOrder(m_ui->m_txtUrl->lineEdit(), m_ui->m_checkServerSideUpdate); setTabOrder(m_ui->m_checkServerSideUpdate, m_ui->m_txtUsername->lineEdit()); setTabOrder(m_ui->m_txtUsername->lineEdit(), m_ui->m_txtPassword->lineEdit()); setTabOrder(m_ui->m_txtPassword->lineEdit(), m_ui->m_checkShowPassword); setTabOrder(m_ui->m_checkShowPassword, m_ui->m_gbHttpAuthentication); setTabOrder(m_ui->m_gbHttpAuthentication, m_ui->m_txtHttpUsername->lineEdit()); setTabOrder(m_ui->m_txtHttpUsername->lineEdit(), m_ui->m_txtHttpPassword->lineEdit()); setTabOrder(m_ui->m_txtHttpPassword->lineEdit(), m_ui->m_checkShowHttpPassword); setTabOrder(m_ui->m_checkShowHttpPassword, m_ui->m_btnTestSetup); setTabOrder(m_ui->m_btnTestSetup, m_ui->m_buttonBox); connect(m_ui->m_checkShowPassword, &QCheckBox::toggled, this, &FormEditTtRssAccount::displayPassword); connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormEditTtRssAccount::onClickedOk); connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &FormEditTtRssAccount::onClickedCancel); connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onPasswordChanged); connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onUsernameChanged); connect(m_ui->m_txtHttpPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onHttpPasswordChanged); connect(m_ui->m_txtHttpUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onHttpUsernameChanged); connect(m_ui->m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onUrlChanged); connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::checkOkButton); connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::checkOkButton); connect(m_ui->m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::checkOkButton); connect(m_ui->m_btnTestSetup, &QPushButton::clicked, this, &FormEditTtRssAccount::performTest); connect(m_ui->m_gbHttpAuthentication, &QGroupBox::toggled, this, &FormEditTtRssAccount::onHttpPasswordChanged); connect(m_ui->m_gbHttpAuthentication, &QGroupBox::toggled, this, &FormEditTtRssAccount::onHttpUsernameChanged); connect(m_ui->m_checkShowHttpPassword, &QCheckBox::toggled, this, &FormEditTtRssAccount::displayHttpPassword); onPasswordChanged(); onUsernameChanged(); onUrlChanged(); onHttpPasswordChanged(); onHttpUsernameChanged(); checkOkButton(); displayPassword(false); displayHttpPassword(false); }
FormEditOwnCloudAccount::FormEditOwnCloudAccount(QWidget* parent) : QDialog(parent), m_ui(new Ui::FormEditOwnCloudAccount), m_editableRoot(nullptr) { m_ui->setupUi(this); m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok); GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("owncloud"))); m_ui->m_lblTestResult->label()->setWordWrap(true); m_ui->m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates " "of feeds will be probably much slower and may time-out often.")); m_ui->m_lblDescription->setText(tr("Note that at least version %1 is required.").arg(OWNCLOUD_MIN_VERSION)); m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your ownCloud account")); m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your ownCloud account")); m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your ownCloud server, without any API path")); m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Information, tr("No test done yet."), tr("Here, results of connection test are shown.")); m_ui->m_lblLimitMessages->setText( tr("Limiting number of downloaded messages per feed makes updating of feeds faster but if your feed contains " "bigger number of messages than specified limit, then some messages might not be downloaded during feed update.")); connect(m_ui->m_spinLimitMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [=](int value) { if (value <= 0) { m_ui->m_spinLimitMessages->setSuffix(QSL(" ") + tr("= unlimited")); } else { m_ui->m_spinLimitMessages->setSuffix(QSL(" ") + tr("messages")); } }); GuiUtilities::setLabelAsNotice(*m_ui->m_lblLimitMessages, false); GuiUtilities::setLabelAsNotice(*m_ui->m_lblServerSideUpdateInformation, false); GuiUtilities::setLabelAsNotice(*m_ui->m_lblDescription, false); setTabOrder(m_ui->m_txtUrl->lineEdit(), m_ui->m_checkServerSideUpdate); setTabOrder(m_ui->m_checkServerSideUpdate, m_ui->m_spinLimitMessages); setTabOrder(m_ui->m_spinLimitMessages, m_ui->m_txtUsername->lineEdit()); setTabOrder(m_ui->m_txtUsername->lineEdit(), m_ui->m_txtPassword->lineEdit()); setTabOrder(m_ui->m_txtPassword->lineEdit(), m_ui->m_checkShowPassword); setTabOrder(m_ui->m_checkShowPassword, m_ui->m_btnTestSetup); setTabOrder(m_ui->m_btnTestSetup, m_ui->m_buttonBox); connect(m_ui->m_checkShowPassword, &QCheckBox::toggled, this, &FormEditOwnCloudAccount::displayPassword); connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormEditOwnCloudAccount::onClickedOk); connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &FormEditOwnCloudAccount::onClickedCancel); connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditOwnCloudAccount::onPasswordChanged); connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditOwnCloudAccount::onUsernameChanged); connect(m_ui->m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditOwnCloudAccount::onUrlChanged); connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditOwnCloudAccount::checkOkButton); connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditOwnCloudAccount::checkOkButton); connect(m_ui->m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditOwnCloudAccount::checkOkButton); connect(m_ui->m_btnTestSetup, &QPushButton::clicked, this, &FormEditOwnCloudAccount::performTest); onPasswordChanged(); onUsernameChanged(); onUrlChanged(); checkOkButton(); displayPassword(false); }
FormFeedDetails::FormFeedDetails(ServiceRoot *service_root, QWidget *parent) : QDialog(parent), m_editableFeed(nullptr), m_serviceRoot(service_root) { initialize(); createConnections(); // Initialize that shit. onTitleChanged(QString()); onDescriptionChanged(QString()); onUrlChanged(QString()); onUsernameChanged(QString()); onPasswordChanged(QString()); }
void FormFeedDetails::createConnections() { // General connections. connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(apply())); connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onTitleChanged(QString))); connect(m_ui->m_txtDescription->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onDescriptionChanged(QString))); connect(m_ui->m_txtUrl->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onUrlChanged(QString))); connect(m_ui->m_txtUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onUsernameChanged(QString))); connect(m_ui->m_txtPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onPasswordChanged(QString))); connect(m_ui->m_gbAuthentication, SIGNAL(toggled(bool)), this, SLOT(onAuthenticationSwitched())); connect(m_ui->m_cmbAutoUpdateType, SIGNAL(currentIndexChanged(int)), this, SLOT(onAutoUpdateTypeChanged(int))); connect(m_ui->m_btnFetchMetadata, SIGNAL(clicked()), this, SLOT(guessFeed())); // Icon connections. connect(m_actionFetchIcon, SIGNAL(triggered()), this, SLOT(guessIconOnly())); connect(m_actionLoadIconFromFile, SIGNAL(triggered()), this, SLOT(onLoadIconFromFile())); connect(m_actionNoIcon, SIGNAL(triggered()), this, SLOT(onNoIconSelected())); connect(m_actionUseDefaultIcon, SIGNAL(triggered()), this, SLOT(onUseDefaultIcon())); }
Widget::Widget(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), activeChatroomWidget{nullptr} { ui->setupUi(this); ui->statusbar->hide(); ui->menubar->hide(); //restore window state restoreGeometry(Settings::getInstance().getWindowGeometry()); restoreState(Settings::getInstance().getWindowState()); ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()); if (Settings::getInstance().getUseNativeDecoration()) { ui->titleBar->hide(); this->layout()->setContentsMargins(0, 0, 0, 0); ui->friendList->setObjectName("friendList"); ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css")); } else { this->setObjectName("activeWindow"); this->setStyleSheet(Style::get(":ui/window/window.css")); ui->statusPanel->setStyleSheet(QString("")); ui->friendList->setStyleSheet(QString("")); ui->friendList->setObjectName("friendList"); ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css")); ui->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png")); ui->pbMin->setObjectName("minimizeButton"); ui->pbMax->setObjectName("maximizeButton"); ui->pbClose->setObjectName("closeButton"); setWindowFlags(Qt::CustomizeWindowHint); setWindowFlags(Qt::FramelessWindowHint); addAction(ui->actionClose); connect(ui->pbMin, SIGNAL(clicked()), this, SLOT(minimizeBtnClicked())); connect(ui->pbMax, SIGNAL(clicked()), this, SLOT(maximizeBtnClicked())); connect(ui->pbClose, SIGNAL(clicked()), this, SLOT(close())); m_titleMode = FullTitle; moveWidget = false; inResizeZone = false; allowToResize = false; resizeVerSup = false; resizeHorEsq = false; resizeDiagSupEsq = false; resizeDiagSupDer = false; if (isMaximized()) { showMaximized(); ui->pbMax->setObjectName("restoreButton"); } } isWindowMinimized = 0; ui->mainContent->setLayout(new QVBoxLayout()); ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); ui->mainHead->layout()->setSpacing(0); contactListWidget = new FriendListWidget(); ui->friendList->setWidget(contactListWidget); ui->friendList->setLayoutDirection(Qt::RightToLeft); ui->nameLabel->setEditable(true); ui->statusLabel->setEditable(true); // delay setting username and message until Core inits //ui->nameLabel->setText(core->getUsername()); ui->nameLabel->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}"); //ui->statusLabel->setText(core->getStatusMessage()); ui->statusLabel->setStyleSheet("QLabel { color : white; font-size: 8pt;}"); ui->statusButton->setStyleSheet(Style::get(":/ui/statusButton/statusButton.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); ui->titleBar->setMouseTracking(true); ui->LTitle->setMouseTracking(true); ui->tbMenu->setMouseTracking(true); ui->pbMin->setMouseTracking(true); ui->pbMax->setMouseTracking(true); ui->pbClose->setMouseTracking(true); ui->statusHead->setMouseTracking(true); //ui->friendList->viewport()->installEventFilter(this); // disable proportional scaling ui->mainSplitter->setStretchFactor(0,0); ui->mainSplitter->setStretchFactor(1,1); ui->statusButton->setObjectName("offline"); ui->statusButton->style()->polish(ui->statusButton); camera = new Camera; settingsDialog = new SettingsDialog(this); // Disable some widgets until we're connected to the DHT ui->statusButton->setEnabled(false); qRegisterMetaType<Status>("Status"); qRegisterMetaType<vpx_image>("vpx_image"); qRegisterMetaType<uint8_t>("uint8_t"); qRegisterMetaType<int32_t>("int32_t"); qRegisterMetaType<int64_t>("int64_t"); qRegisterMetaType<ToxFile>("ToxFile"); qRegisterMetaType<ToxFile::FileDirection>("ToxFile::FileDirection"); coreThread = new QThread(this); core = new Core(camera, coreThread); core->moveToThread(coreThread); connect(coreThread, &QThread::started, core, &Core::start); connect(core, &Core::connected, this, &Widget::onConnected); connect(core, &Core::disconnected, this, &Widget::onDisconnected); connect(core, &Core::failedToStart, this, &Widget::onFailedToStartCore); connect(core, &Core::statusSet, this, &Widget::onStatusSet); connect(core, &Core::usernameSet, this, &Widget::setUsername); connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage); 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::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); connect(core, &Core::friendUsernameLoaded, this, &Widget::onFriendUsernameLoaded); connect(core, &Core::friendStatusMessageLoaded, this, &Widget::onFriendStatusMessageLoaded); 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(this, &Widget::statusSet, core, &Core::setStatus); connect(this, &Widget::friendRequested, core, &Core::requestFriendship); connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest); 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(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline())); 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))); coreThread->start(); friendForm.show(*ui); }
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 }
void FormFeedDetails::onAuthenticationSwitched() { onUsernameChanged(m_ui->m_txtUsername->lineEdit()->text()); onPasswordChanged(m_ui->m_txtPassword->lineEdit()->text()); }
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 }