qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Go to the documentation of this file.
26 #include <QDesktopServices>
27 #include <QDesktopWidget>
28 #include <QMessageBox>
29 #include <QMouseEvent>
33 #include <QSvgRenderer>
37 #include <QSignalMapper>
41 #include "audio/audio.h"
90 qDebug() <<
"Handling [activate] event from other instance";
103 bool tryRemoveFile(
const QString& filepath)
106 bool writable = tmp.open(QIODevice::WriteOnly);
117 QString suffix = QFileInfo(
file.fileName).completeSuffix();
118 QString base = QFileInfo(
file.fileName).baseName();
121 filepath = QString(
"%1/%2%3.%4")
123 number > 0 ? QString(
" (%1)").arg(QString::number(number)) : QString(),
126 }
while (QFileInfo(filepath).exists());
130 if (tryRemoveFile(filepath)) {
134 qWarning() <<
"Cannot write to " << filepath;
141 : QMainWindow(parent)
144 , ui(
new Ui::MainWindow)
145 , activeChatroomWidget{
nullptr}
151 installEventFilter(
this);
152 QString locale = settings.getTranslation();
160 QIcon themeIcon = QIcon::fromTheme(
"qtox");
161 if (!themeIcon.isNull()) {
162 setWindowIcon(themeIcon);
165 timer =
new QTimer();
197 connect(
actionQuit, &QAction::triggered, qApp, &QApplication::quit);
199 layout()->setContentsMargins(0, 0, 0, 0);
206 ui->myProfile->insertSpacing(1, 7);
260 ui->friendList->setLayoutDirection(Qt::RightToLeft);
261 ui->friendList->setContextMenuPolicy(Qt::CustomContextMenu);
263 ui->statusLabel->setEditable(
true);
265 QMenu* statusButtonMenu =
new QMenu(
ui->statusButton);
269 ui->statusButton->setMenu(statusButtonMenu);
272 ui->mainSplitter->setStretchFactor(0, 0);
273 ui->mainSplitter->setStretchFactor(1, 1);
278 ui->statusButton->setEnabled(
false);
287 #if UPDATE_CHECK_ENABLED
292 #if UPDATE_CHECK_ENABLED
299 #if DESKTOP_NOTIFICATIONS
365 auto*
const quitShortcut =
new QShortcut(Qt::CTRL + Qt::Key_Q,
this);
366 connect(quitShortcut, &QShortcut::activated, qApp, &QApplication::quit);
367 new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab,
this, SLOT(
previousContact()));
368 new QShortcut(Qt::CTRL + Qt::Key_Tab,
this, SLOT(
nextContact()));
369 new QShortcut(Qt::CTRL + Qt::Key_PageUp,
this, SLOT(
previousContact()));
370 new QShortcut(Qt::CTRL + Qt::Key_PageDown,
this, SLOT(
nextContact()));
379 fileMenu = globalMenu->insertMenu(viewMenu,
new QMenu(
this));
381 editProfileAction = fileMenu->menu()->addAction(QString());
384 changeStatusMenu = fileMenu->menu()->addMenu(QString());
385 fileMenu->menu()->addAction(changeStatusMenu->menuAction());
387 changeStatusMenu->addSeparator();
391 fileMenu->menu()->addSeparator();
392 logoutAction = fileMenu->menu()->addAction(QString());
395 editMenu = globalMenu->insertMenu(viewMenu,
new QMenu(
this));
396 editMenu->menu()->addSeparator();
402 contactMenu = globalMenu->insertMenu(windowMenu,
new QMenu(
this));
404 addContactAction = contactMenu->menu()->addAction(QString());
407 nextConversationAction =
new QAction(
this);
409 nextConversationAction->setShortcut(QKeySequence::SelectNextPage);
410 connect(nextConversationAction, &QAction::triggered, [
this]() {
413 else if (QApplication::activeWindow() ==
this)
417 previousConversationAction =
new QAction(
this);
418 Nexus::getInstance().windowMenu->insertAction(frontAction, previousConversationAction);
419 previousConversationAction->setShortcut(QKeySequence::SelectPreviousPage);
420 connect(previousConversationAction, &QAction::triggered, [
this] {
423 else if (QApplication::activeWindow() ==
this)
427 windowMenu->menu()->insertSeparator(frontAction);
429 QAction* preferencesAction = viewMenu->menu()->addAction(QString());
430 preferencesAction->setMenuRole(QAction::PreferencesRole);
433 QAction* aboutAction = viewMenu->menu()->addAction(QString());
434 aboutAction->setMenuRole(QAction::AboutRole);
435 connect(aboutAction, &QAction::triggered, [
this]() {
440 QMenu* dockChangeStatusMenu =
new QMenu(tr(
"Status"),
this);
443 dockChangeStatusMenu->addSeparator();
454 ui->addButton->setCheckable(
true);
455 ui->groupButton->setCheckable(
true);
456 ui->transferButton->setCheckable(
true);
457 ui->settingsButton->setCheckable(
true);
506 QWindowStateChangeEvent* ce =
nullptr;
507 Qt::WindowStates state = windowState();
509 switch (
event->type()) {
515 case QEvent::WindowStateChange:
516 ce =
static_cast<QWindowStateChangeEvent*
>(
event);
517 if (state.testFlag(Qt::WindowMinimized) && obj) {
518 wasMaximized = ce->oldState().testFlag(Qt::WindowMaximized);
539 ui->statusButton->property(
"status").toInt()))
555 static bool checkedHasThemeIcon =
false;
556 static bool hasThemeIconBug =
false;
558 if (!checkedHasThemeIcon) {
559 hasThemeIconBug = QIcon::hasThemeIcon(
"qtox-asjkdfhawjkeghdfjgh");
560 checkedHasThemeIcon =
true;
562 if (hasThemeIconBug) {
564 <<
"Detected buggy QIcon::hasThemeIcon. Icon overrides from theme will be ignored.";
569 if (!hasThemeIconBug && QIcon::hasThemeIcon(
"qtox-" + assetSuffix)) {
570 ico = QIcon::fromTheme(
"qtox-" + assetSuffix);
573 QString path =
":/img/taskbar/" + color +
"/taskbar_" + assetSuffix +
".svg";
574 QSvgRenderer renderer(path);
577 QImage image = QImage(250, 250, QImage::Format_ARGB32);
578 image.fill(Qt::transparent);
579 QPainter painter(&image);
580 renderer.render(&painter);
581 ico = QIcon(QPixmap::fromImage(image));
592 QWidgetList windowList = QApplication::topLevelWidgets();
594 for (QWidget* window : windowList) {
595 if (window !=
this) {
644 if (
event->type() == QEvent::Move) {
649 QWidget::moveEvent(
event);
655 QWidget::closeEvent(
event);
663 QWidget::closeEvent(
event);
670 if (
event->type() == QEvent::WindowStateChange) {
680 QMainWindow::resizeEvent(
event);
737 ui->statusButton->setEnabled(
true);
743 ui->statusButton->setEnabled(
false);
749 QMessageBox critical(
this);
751 "Toxcore failed to start, the application will terminate after you close this message."));
752 critical.setIcon(QMessageBox::Critical);
754 qApp->exit(EXIT_FAILURE);
760 QMessageBox critical(
this);
761 critical.setText(tr(
"Toxcore failed to start with your proxy settings. "
762 "qTox cannot run; please modify your "
763 "settings and restart.",
765 critical.setIcon(QMessageBox::Critical);
772 ui->statusButton->setProperty(
"status",
static_cast<int>(status));
785 QWindowList windowList = QGuiApplication::topLevelWindows();
787 for (QWindow* window : windowList) {
788 if (window->objectName() ==
"detachedWindow") {
793 QWidget* contentWidget =
new QWidget(
this);
794 contentWidget->setObjectName(
"contentWidget");
797 ui->mainSplitter->addWidget(contentWidget);
799 setMinimumWidth(775);
806 int width =
ui->friendList->size().width();
811 pos = mapToGlobal(
ui->mainSplitter->widget(1)->pos());
812 size =
ui->mainSplitter->widget(1)->size();
824 setMinimumWidth(
ui->tooliconsZone->sizeHint().width());
828 resize(width, height());
846 if (title.isEmpty()) {
847 QMainWindow::setWindowTitle(QApplication::applicationName());
851 QMainWindow::setWindowTitle(tmp.remove(QRegExp(
"<[^>]*>")) + QStringLiteral(
" - ")
852 + QApplication::applicationName());
913 static const QStringList dangerousExtensions = {
"app",
"bat",
"com",
"cpl",
"dmg",
914 "exe",
"hta",
"jar",
"js",
"jse",
915 "lnk",
"msc",
"msh",
"msh1",
"msh1xml",
916 "msh2",
"msh2xml",
"mshxml",
"msi",
"msp",
917 "pif",
"ps1",
"ps1xml",
"ps2",
"ps2xml",
918 "psc1",
"psc2",
"py",
"reg",
"scf",
919 "sh",
"src",
"vb",
"vbe",
"vbs",
920 "ws",
"wsc",
"wsf",
"wsh"};
922 if (dangerousExtensions.contains(
file.suffix())) {
924 tr(
"You have asked qTox to open an executable file. "
925 "Executable files can potentially damage your computer. "
926 "Are you sure want to open this file?",
934 QFile(
file.filePath())
935 .setPermissions(
file.permissions() | QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup
939 QDesktopServices::openUrl(QUrl::fromLocalFile(
file.filePath()));
944 if (reason == QSystemTrayIcon::Trigger) {
945 if (isHidden() || isMinimized()) {
953 }
else if (!isActiveWindow()) {
959 }
else if (reason == QSystemTrayIcon::Unknown) {
1015 if (username.isEmpty()) {
1016 ui->nameLabel->setText(tr(
"Your name"));
1017 ui->nameLabel->setToolTip(tr(
"Your name"));
1019 ui->nameLabel->setText(username);
1020 ui->nameLabel->setToolTip(
1021 Qt::convertFromPlainText(username, Qt::WhiteSpaceNormal));
1035 ui->statusLabel->setText(statusMessage);
1038 ui->statusLabel->setToolTip(
"<p style='white-space:pre'>" + statusMessage.toHtmlEscaped() +
"</p>");
1056 qDebug() <<
"Failed to allocate AudioSink";
1127 bool autoAcceptSizeCheckPassed =
1128 maxAutoAcceptSize == 0 || maxAutoAcceptSize >=
file.progress.getFileSize();
1130 if (!autoAcceptDir.isEmpty() && autoAcceptSizeCheckPassed) {
1150 auto chatForm =
chatForms.find(friendPk);
1155 chatForm.value()->addSystemInfoMessage(QDateTime::currentDateTime(),
1167 assert(
core !=
nullptr);
1173 std::shared_ptr<FriendChatroom> chatroom(rawChatroom);
1174 const auto compact =
settings.getCompactLayout();
1180 auto friendMessageDispatcher =
1181 std::make_shared<FriendMessageDispatcher>(*newfriend, std::move(messageProcessor), *
core, *
core->
getExt());
1186 std::make_shared<ChatHistory>(*newfriend, history, *
core,
settings,
1187 *friendMessageDispatcher);
1188 auto friendForm =
new ChatForm(
profile, newfriend, *chatHistory, *friendMessageDispatcher);
1198 const auto chatTime = friendForm->getLatestTime();
1199 if (chatTime > activityTime && chatTime.isValid()) {
1206 auto notifyReceivedCallback = [
this, friendPk](
const ToxPk& author,
const Message&
message) {
1210 auto notifyReceivedConnection =
1212 notifyReceivedCallback);
1238 if (!avatar.isNull()) {
1239 friendForm->onAvatarChanged(friendPk, avatar);
1240 widget->onAvatarSet(friendPk, avatar);
1246 QString info = QString(tr(
"Couldn't send friend request"));
1247 if (!errorInfo.isEmpty()) {
1248 info = info + QStringLiteral(
": ") + errorInfo;
1251 QMessageBox::critical(
nullptr,
"Error", info);
1267 if (startedNegotiating) {
1268 constexpr
auto negotiationTimeoutMs = 1000;
1269 auto timer = std::unique_ptr<QTimer>(
new QTimer);
1270 timer->setSingleShot(
true);
1271 timer->setInterval(negotiationTimeoutMs);
1308 str.replace(
'\n',
' ').remove(
'\r').remove(QChar(
'\0'));
1312 chatForms[friendPk]->setStatusMessage(str);
1317 Friend* f = qobject_cast<Friend*>(sender());
1320 if (g->getPeerList().contains(friendPk)) {
1321 g->updateUsername(friendPk, displayed);
1341 QString str = username;
1342 str.replace(
'\n',
' ').remove(
'\r').remove(QChar(
'\0'));
1382 if ((chatFormIsSet || form->isVisible()) && !newWindow) {
1393 if (dialog ==
nullptr) {
1407 dialog->activateWindow();
1472 if (!contentDialog && !isSeparate && isCurrent) {
1483 #if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
1516 if (!avatar.isNull()) {
1528 if (!groupDialog && !separated && isCurrentWindow) {
1537 #if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
1569 QWidget* currentWindow;
1573 if (contentDialog !=
nullptr) {
1574 currentWindow = contentDialog->window();
1582 if (!contentDialog) {
1588 currentWindow = contentDialog->window();
1591 currentWindow = window();
1601 ui->friendList->trackWidget(widget);
1602 #if DESKTOP_NOTIFICATIONS
1603 auto notificationData = filename.isEmpty() ? notificationGenerator->friendMessageNotification(f, text)
1604 : notificationGenerator->fileTransferNotification(f, filename, filesize);
1605 notifier.notifyMessage(notificationData);
1608 if (contentDialog ==
nullptr) {
1623 const QString& message,
bool notify)
1626 QWidget* currentWindow;
1631 if (contentDialog !=
nullptr) {
1632 currentWindow = contentDialog->window();
1635 currentWindow = window();
1645 #if DESKTOP_NOTIFICATIONS
1646 auto notificationData = notificationGenerator->groupMessageNotification(g, authorPk,
message);
1647 notifier.notifyMessage(notificationData);
1650 if (contentDialog ==
nullptr) {
1665 return tr(
"Add friend",
"title of the window");
1667 return tr(
"Group invites",
"title of the window");
1669 return tr(
"File transfers",
"title of the window");
1671 return tr(
"Settings",
"title of the window");
1673 return tr(
"My profile",
"title of the window");
1682 bool inactiveWindow = isMinimized() || !currentWindow->isActiveWindow();
1684 if (!inactiveWindow && isActive) {
1690 currentWindow->show();
1694 if (inactiveWindow) {
1695 #if DESKTOP_NOTIFICATIONS
1697 QApplication::alert(currentWindow);
1700 QApplication::alert(currentWindow);
1708 if (notifySound && sound && (!isBusy || busySound)) {
1722 #if DESKTOP_NOTIFICATIONS
1723 auto notificationData = notificationGenerator->friendRequestNotification(friendPk,
message);
1724 notifier.notifyMessage(notificationData);
1739 const auto newTime = QDateTime::currentDateTime();
1763 widget->setAsInactiveChatroom();
1774 if (lastDialog !=
nullptr) {
1783 if (g->getPeerList().contains(friendPk)) {
1811 ui->friendList->updateTracking(widget);
1828 if (windowState().testFlag(Qt::WindowFullScreen)) {
1829 setWindowState(windowState() & ~Qt::WindowFullScreen);
1831 setWindowState(windowState() | Qt::WindowFullScreen);
1837 ui->settingsButton->setProperty(
"update-available",
true);
1838 ui->settingsButton->style()->unpolish(
ui->settingsButton);
1839 ui->settingsButton->style()->polish(
ui->settingsButton);
1847 return contentDialog;
1864 connect(&contentDialog, &ContentDialog::destroyed, &n, &Nexus::updateWindowsClosed);
1866 connect(contentDialog.windowHandle(), &QWindow::windowTitleChanged, &n, &Nexus::updateWindows);
1885 setWindowIcon(QIcon(
":/img/icons/qtox.svg"));
1912 QDialog::resizeEvent(
event);
1918 QDialog::moveEvent(
event);
1928 dialog->setAttribute(Qt::WA_DeleteOnClose);
1931 dialog->setObjectName(
"detached");
1932 dialog->setLayout(contentLayoutDialog);
1933 dialog->layout()->setMargin(0);
1934 dialog->layout()->setSpacing(0);
1935 dialog->setMinimumSize(720, 400);
1936 dialog->setAttribute(Qt::WA_DeleteOnClose);
1940 connect(dialog, &Dialog::destroyed, &
Nexus::getInstance(), &Nexus::updateWindowsClosed);
1942 &Nexus::updateWindowsStates);
1944 &Nexus::updateWindows);
1948 return contentLayoutDialog;
1955 QClipboard* clipboard = QApplication::clipboard();
1956 clipboard->setText(friendId.
toString(), QClipboard::Clipboard);
1962 const uint32_t friendId = inviteInfo.
getFriendId();
1967 const uint8_t confType = inviteInfo.
getType();
1968 if (confType == TOX_CONFERENCE_TYPE_TEXT || confType == TOX_CONFERENCE_TYPE_AV) {
1979 #if DESKTOP_NOTIFICATIONS
1980 auto notificationData = notificationGenerator->groupInvitationNotification(f);
1981 notifier.notifyMessage(notificationData);
1985 qWarning() <<
"onGroupInviteReceived: Unknown groupchat type:" << confType;
1993 if (groupId == std::numeric_limits<uint32_t>::max()) {
1994 qWarning() <<
"onGroupInviteAccepted: Unable to accept group invite";
2045 const auto* group = qobject_cast<Group*>(sender());
2046 assert(group !=
nullptr);
2056 form->peerAudioPlaying(peerPk);
2062 const auto groupnumber = g->
getId();
2065 qWarning() <<
"Tried to remove group" << groupnumber <<
"but GroupWidget doesn't exist";
2068 auto widget = groupWidgetIt.value();
2069 widget->setAsInactiveChatroom();
2077 if (contentDialog !=
nullptr) {
2089 qWarning() <<
"Tried to remove group" << groupnumber <<
"but GroupChatForm doesn't exist";
2109 assert(
core !=
nullptr);
2113 qWarning() <<
"Group already exists";
2117 const auto groupName = tr(
"Groupchat #%1").arg(groupnumber);
2132 std::shared_ptr<GroupChatroom> chatroom(rawChatroom);
2134 const auto compact =
settings.getCompactLayout();
2137 auto messageDispatcher =
2138 std::make_shared<GroupMessageDispatcher>(*newgroup, std::move(messageProcessor), *
core,
2140 auto groupChatLog = std::make_shared<SessionChatLog>(*
core);
2151 auto notifyReceivedCallback = [
this, groupId](
const ToxPk& author,
const Message&
message) {
2152 auto isTargeted = std::any_of(
message.metadata.begin(),
message.metadata.end(),
2154 return metadata.type == MessageMetadataType::selfMention;
2160 auto notifyReceivedConnection =
2174 widget->updateStatusLight();
2179 #if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
2199 if (title.isEmpty()) {
2226 switch (e->type()) {
2227 case QEvent::MouseButtonPress:
2228 case QEvent::MouseButtonDblClick:
2232 ui->friendList->updateVisualTracking();
2234 case QEvent::WindowActivate:
2250 case QEvent::WindowStateChange:
2258 return QMainWindow::event(e);
2263 #ifdef QTOX_PLATFORM_EXT
2265 bool online =
static_cast<Status::Status>(
ui->statusButton->property(
"status").toInt())
2267 bool away = autoAwayTime && Platform::getIdleTime() >= autoAwayTime;
2269 if (online && away) {
2270 qDebug() <<
"auto away activated at" << QTime::currentTime().toString();
2274 qDebug() <<
"auto away deactivated at" << QTime::currentTime().toString();
2291 static int32_t tries = 15;
2292 if (!
icon && tries--) {
2293 if (QSystemTrayIcon::isSystemTrayAvailable()) {
2294 icon = std::unique_ptr<QSystemTrayIcon>(
new QSystemTrayIcon);
2321 }
else if (!isVisible()) {
2327 qWarning() <<
"No system tray detected!";
2335 if (!
ui->statusButton->isEnabled()) {
2344 if (!
ui->statusButton->isEnabled()) {
2353 if (!
ui->statusButton->isEnabled()) {
2365 const auto curTime = QDateTime::currentDateTime();
2384 icon->setVisible(newValue);
2449 for (
Friend* f : frnds) {
2457 QWidgetList wgts = findChildren<QWidget*>();
2458 for (
auto x : wgts) {
2459 x->setStyleSheet(
"");
2465 ui->statusPanel->setStyleSheet(statusPanelStyle);
2466 ui->statusHead->setStyleSheet(statusPanelStyle);
2488 QString desktop = getenv(
"XDG_CURRENT_DESKTOP");
2489 if (desktop.isEmpty()) {
2490 desktop = getenv(
"DESKTOP_SESSION");
2493 desktop = desktop.toLower();
2494 if (desktop ==
"xfce" || desktop.contains(
"gnome") || desktop ==
"mate" || desktop ==
"x-cinnamon") {
2495 if (w > 0 && h > 0) {
2496 QSvgRenderer renderer(path);
2499 pm.fill(Qt::transparent);
2500 QPainter painter(&pm);
2501 renderer.render(&painter, pm.rect());
2512 QString searchString =
ui->searchContactText->text();
2540 QString text =
filterGroup->checkedAction()->text();
2541 text = action + QStringLiteral(
" | ") + text;
2542 ui->searchContactFilterBox->setText(text);
2565 QString text =
ui->searchContactText->text();
2579 QAction* createGroupAction = menu.addAction(tr(
"Create new group..."));
2580 QAction* addCircleAction = menu.addAction(tr(
"Add new circle..."));
2581 QAction* chosenAction = menu.exec(
ui->friendList->mapToGlobal(pos));
2583 if (chosenAction == addCircleAction) {
2585 }
else if (chosenAction == createGroupAction) {
2594 if (unreadFriendRequests == 0) {
2651 ui->retranslateUi(
this);
2662 ui->searchContactText->setPlaceholderText(tr(
"Search Contacts"));
2665 statusOnline->setText(tr(
"Online",
"Button to set your status to 'Online'"));
2666 statusAway->setText(tr(
"Away",
"Button to set your status to 'Away'"));
2667 statusBusy->setText(tr(
"Busy",
"Button to set your status to 'Busy'"));
2668 actionLogout->setText(tr(
"Logout",
"Tray action menu to logout user"));
2669 actionQuit->setText(tr(
"Exit",
"Tray action menu to exit Tox"));
2670 actionShow->setText(tr(
"Show",
"Tray action menu to show qTox window"));
2683 filterMenu->menuAction()->setText(tr(
"Filter..."));
2685 fileMenu->setText(tr(
"File"));
2686 editMenu->setText(tr(
"Edit"));
2687 contactMenu->setText(tr(
"Contacts"));
2688 changeStatusMenu->menuAction()->setText(tr(
"Change status"));
2689 editProfileAction->setText(tr(
"Edit profile"));
2690 logoutAction->setText(tr(
"Logout"));
2691 addContactAction->setText(tr(
"Add contact..."));
2692 nextConversationAction->setText(tr(
"Next conversation"));
2693 previousConversationAction->setText(tr(
"Previous conversation"));
2701 chatForms[f->getPublicKey()]->focusInput();
void groupTitleChanged(int groupnumber, const QString &author, const QString &title)
void setProxyType(ICoreSettings::ProxyType type) override
void onMessageBroken(DispatchedMessageId id, BrokenMessageReason reason)
static void removeFriend(const ToxPk &friendPk, bool fake=false)
void restore(const QByteArray &state, const QSize &windowSize)
Restore splitter from state. And reset in case of error. Set the splitter to a reasonnable width by d...
int showLogin(const QString &profileName=QString())
Hides the main GUI, delete the profile, and shows the login screen.
void updateFriendStatus(const ToxPk &friendPk)
void statusSet(Status::Status status)
void separateWindowChanged(bool enabled)
bool getAutostartInTray() const
static QString decideNickname(const ToxPk &friendPk, const QString &origName)
QByteArray getWindowGeometry() const
void fileTransferAccepted(ToxFile file)
void extendedMessageSupport(uint32_t friendId, bool supported)
void acceptFriendRequest(const ToxPk &friendPk)
void onNegotiationComplete()
void editFinished(const QString &newText)
ToxPk getSelfPublicKey() const override
Gets self public key.
void friendRequestReceived(const ToxPk &friendPk, const QString &message)
bool getMinimizeToTray() const
void nameColorsChanged(bool enabled)
Handles all qTox internal paths.
void windowStateChanged(Qt::WindowStates state)
void onMessageSent(DispatchedMessageId id, const Message &message)
Inserts message data into the chatlog buffer.
This class contains information needed to create a group invite.
void friendStatusMessageChanged(uint32_t friendId, const QString &message)
int getAutoAwayTime() const
void setStatus(Status::Status s)
void onNotificationActivated()
bool getShowWindow() const override
void removeGroup(const GroupId &groupId) override
void regeneratePeerList()
static void translate(const QString &localeName)
Loads the translations according to the settings or locale.
static void unregister(void *owner)
Unregisters all handlers of an owner.
void updateAvailable(QString latestVersion, QUrl link)
bool getDontGroupWindows() const
void removeFriendHistory(const ToxPk &friendPk)
Erases the chat history with one friend.
QPixmap loadAvatar()
Get our avatar from cache.
void setFriendAlias(const ToxPk &id, const QString &alias) override
QString getIconPath(Status status, bool event)
bool getNotify() const override
static ContentDialogManager * getInstance()
void groupJoined(int groupnumber, GroupId groupId)
static const QString getImagePath(const QString &filename)
static Friend * addFriend(uint32_t friendId, const ToxPk &friendPk)
ContentDialog * current()
static bool askQuestion(const QString &title, const QString &msg, bool defaultAns=false, bool warning=true, bool yesno=true)
Asks the user a question with Ok/Cancel or Yes/No buttons.
void friendMessageReceived(uint32_t friendId, const QString &message, bool isAction)
void failedToAddFriend(const ToxPk &friendPk, const QString &errorInfo=QString())
static const GroupId & id2Key(uint32_t groupNum)
CoreFile * getCoreFile() const
bool getShowSystemTray() const
static void setThemeColor(int color)
ContentDialog * getFriendDialog(const ToxPk &friendPk) const
void messageSent(DispatchedMessageId id, const Message &message)
Emitted when a message is processed and sent.
bool cancelCall(uint32_t friendNum)
void notificationClosed()
void groupPeerAudioPlaying(int groupnumber, ToxPk peerPk)
void setEventFlag(bool f) override
FriendWidget * addFriendToDialog(ContentDialog *dialog, std::shared_ptr< FriendChatroom > chatroom, GenericChatForm *form)
uint32_t getId() const override
QByteArray getDialogSettingsGeometry() const
static void setWindowTitle(const QString &title)
Change the title of the main window.
const CoreAV * getAv() const
static Friend * findFriend(const ToxPk &friendPk)
QString getAutoAcceptDir(const ToxPk &id) const override
unsigned int getUnreadFriendRequests() const
void extendedMessageReceived(uint32_t friendId, const QString &message)
static QList< Friend * > getAllFriends()
void setDialogSettingsGeometry(const QByteArray &value)
void changeGroupTitle(int groupId, const QString &title)
static GUI & getInstance()
Returns the singleton instance.
void friendAdded(uint32_t friendId, const ToxPk &friendPk)
void groupMessageReceived(int groupnumber, int peernumber, const QString &message, bool isAction)
QByteArray getSplitterState() const
void setWindowGeometry(const QByteArray &value)
void reorderLayouts(bool newGroupOnTop)
Update layouts order according to settings.
Status::Status getStatus() const
void receiptRecieved(int friedId, ReceiptNum receipt)
void focusContact(const ContactId &contactId)
void fileTransferPaused(ToxFile file)
bool getEnableGroupChatsColor() const
bool contactWidgetExists(const ContactId &groupId)
void friendDialogShown(const Friend *f)
ToxId getSelfId() const override
Returns our Tox ID.
QString getUsername() const override
Returns our username, or an empty string on failure.
void invalidateGroupCallPeerSource(const Group &group, ToxPk peerPk)
Called from core to make sure the source for that peer is invalidated when they leave.
void setUsername(const QString &newName)
Update username to show in the title.
void emptyGroupCreated(int groupnumber, const GroupId groupId, const QString &title=QString())
QString getGlobalAutoAcceptDir() const
ToxPk getGroupPeerPk(int groupId, int peerId) const override
Get the public key of a peer of a group.
void aliasChanged(const ToxPk &friendId, QString alias)
uint64_t getMaxMessageSize() const
void messageComplete(DispatchedMessageId id)
Emitted when a receiver report is received from the associated chat.
void friendAvatarRemoved(const ToxPk &friendPk)
bool getGroupchatPosition() const
bool getBusySound() const override
bool getSeparateWindow() const
void setSelfName(const QString &name)
This class represents a Tox Public Key, which is a part of Tox ID.
void setSplitterState(const QByteArray &value)
void setEventFlag(bool f) override
void setExtendedMessageSupport(bool supported)
void fileReceiveRequested(ToxFile file)
void fileTransferInfo(ToxFile file)
void setStatusMessage(const QString &message)
void setTitle(const QString &author, const QString &newTitle)
void addFriendDialog(Friend *frnd, ContentDialog *contentDialog)
void fileTransferCancelled(ToxFile file)
void fileTransferBrokenUnbroken(ToxFile file, bool broken)
bool isContactActive(const ContactId &contactId)
QDateTime getFriendActivity(const ToxPk &id) const override
void setFriendActivity(const ToxPk &id, const QDateTime &date) override
ContentDialog * getGroupDialog(const GroupId &friendPk) const
const GroupId & getPersistentId() const override
void connectFriendWidget(FriendWidget &friendWidget)
void usernameSet(const QString &username)
bool getAutoGroupInvite(const ToxPk &id) const override
static void removeGroup(const GroupId &groupId, bool fake=false)
void requestFriendship(const ToxId &friendAddress, const QString &message)
static void registerHandler(const std::function< void()> &, void *owner)
Register a function to be called when the UI needs to be retranslated.
void setStatus(Status::Status status)
QByteArray getWindowState() const
static Settings & getInstance()
Returns the singleton instance.
void groupPeerlistChanged(int groupnumber)
void removeGroup(int groupId)
History * getHistory()
Get chat history.
This class represents a long term persistent group identifier.
void fileTransferRemotePausedUnpaused(ToxFile file, bool paused)
void statusMessageSet(const QString &message)
bool getNotifySound() const override
void groupchatPositionChanged(bool enabled)
int getThemeColor() const
void groupDialogShown(Group *g)
static Widget * getDesktopGUI()
Get desktop GUI widget.
void showSystemTrayChanged(bool enabled)
bool getCloseToTray() const
bool getGroupAlwaysNotify() const override
const ToxPk & getPublicKey() const
int createGroup(uint8_t type=TOX_CONFERENCE_TYPE_AV)
static const QString getStylesheet(const QString &filename, const QFont &baseFont=QFont())
void removeFriend(const ToxPk &friendPk) override
void fileSendStarted(ToxFile file)
uint32_t getFriendId() const
bool getDesktopNotify() const override
void acceptFileRecvRequest(uint32_t friendId, uint32_t fileId, QString path)
GroupWidget * addGroupToDialog(ContentDialog *dialog, std::shared_ptr< GroupChatroom > chatroom, GenericChatForm *form)
void messageReceived(const ToxPk &sender, const Message &message)
Emitted when a message is received and processed.
const CoreExt * getExt() const
void friendTypingChanged(uint32_t friendId, bool isTyping)
void savePersonal()
Asynchronous, saves the current profile.
static Group * findGroup(const GroupId &groupId)
void setName(const QString &name) override
Friend::setName sets a new username for the friend.
static QList< Group * > getAllGroups()
NamedType< uint32_t, struct ReceiptNumTag, Orderable > ReceiptNum
void addGroupDialog(Group *group, ContentDialog *contentDialog)
FriendListSortingMode getFriendSortingMode() const
static Nexus & getInstance()
Returns the singleton instance.
void addContentDialog(ContentDialog &dialog)
Status::Status getStatus() const
Returns our user status.
void extendedReceiptReceived(uint32_t friendId, uint64_t receiptId)
void updateUsername(ToxPk pk, const QString newName)
bool getGroupAvEnabled(int groupId) const override
Check, that group has audio or video stream.
static Group * addGroup(Core &core, int groupId, const GroupId &persistentGroupId, const QString &name, bool isAvGroupchat, const QString &selfName)
void statusChanged(const ToxPk &friendId, Status::Status status)
void compactLayoutChanged(bool enabled)
void fileTransferFinished(ToxFile file)
void onMessageReceived(const ToxPk &sender, const Message &message)
Inserts message data into the chatlog buffer.
void setStatusMessage(const QString &message)
void friendStatusChanged(uint32_t friendId, Status::Status status)
void onMessageComplete(DispatchedMessageId id)
Marks the associated message as complete and notifies any listeners.
uint32_t joinGroupchat(const GroupInvite &inviteInfo)
Accept a groupchat invite.
void groupSentFailed(int groupId)
uint32_t getId() const override
void setWindowState(const QByteArray &value)
void removeFriend(uint32_t friendId)
Implement interface, that provides invormation about self profile. Also, provide methods to work with...
QString getAssetSuffix(Status status)
bool isOnline(Status status)
static const ToxPk & id2Key(uint32_t friendId)
QString getStatusMessage() const
Returns our status message, or an empty string on failure.
bool getAutoSaveEnabled() const
void updateGroupStatus(const GroupId &friendPk)
void friendUsernameChanged(uint32_t friendId, const QString &username)
Restore splitter from saved state and reset to default.
void fileSendFailed(uint32_t friendId, const QString &fname)
void selfAvatarChanged(const QPixmap &pixmap)
Manages the file transfer service of toxcore.
QString getUserName() const
void groupInviteReceived(const GroupInvite &inviteInfo)
size_t getMaxAutoAcceptSize() const
void messageBroken(DispatchedMessageId id, BrokenMessageReason reason)
void groupPeerNameChanged(int groupnumber, const ToxPk &peerPk, const QString &newName)
void friendAvatarSet(const ToxPk &friendPk, const QPixmap &pixmap)
void titleChangedByUser(const QString &title)
bool getAudioOutDevEnabled() const override
void updateFriendAddress(const QString &newAddr)
void userLeft(const ToxPk &user, const QString &name)
bool getLightTrayIcon() const