void GeneralWidget::refreshControls() {
	style::margins marginSub(0, 0, 0, st::settingsSubSkip);
	style::margins marginLarge(0, 0, 0, st::settingsLargeSkip);
	style::margins marginSmall(0, 0, 0, st::settingsSmallSkip);
	style::margins slidedPadding(0, marginSmall.bottom() / 2, 0, marginSmall.bottom() - (marginSmall.bottom() / 2));

#ifndef TDESKTOP_DISABLE_AUTOUPDATE
	addChildRow(_updateAutomatically, marginSub, lang(lng_settings_update_automatically), SLOT(onUpdateAutomatically()), cAutoUpdate());
	style::margins marginLink(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
	addChildRow(_updateRow, marginLink, slidedPadding);
	connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
	if (!cAutoUpdate()) {
		_updateRow->hideFast();
	}
#endif // !TDESKTOP_DISABLE_AUTOUPDATE

	if (cPlatform() == dbipWindows || cSupportTray()) {
		addChildRow(_enableTrayIcon, marginSmall, lang(lng_settings_workmode_tray), SLOT(onEnableTrayIcon()), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray));
		if (cPlatform() == dbipWindows) {
			addChildRow(_enableTaskbarIcon, marginLarge, lang(lng_settings_workmode_window), SLOT(onEnableTaskbarIcon()), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray));

#ifndef OS_WIN_STORE
			addChildRow(_autoStart, marginSmall, lang(lng_settings_auto_start), SLOT(onAutoStart()), cAutoStart());
			addChildRow(_startMinimized, marginLarge, slidedPadding, lang(lng_settings_start_min), SLOT(onStartMinimized()), (cStartMinimized() && !Global::LocalPasscode()));
			subscribe(Global::RefLocalPasscodeChanged(), [this] {
				_startMinimized->entity()->setChecked(cStartMinimized() && !Global::LocalPasscode());
			});
			if (!cAutoStart()) {
				_startMinimized->hideFast();
			}
			addChildRow(_addInSendTo, marginSmall, lang(lng_settings_add_sendto), SLOT(onAddInSendTo()), cSendToMenu());
#endif // OS_WIN_STORE
		}
	}
}
Beispiel #2
0
void PsMainWindow::psUpdateWorkmode() {
    if (!cSupportTray()) return;

    if (cWorkMode() == dbiwmWindowOnly) {
        if (noQtTrayIcon) {
            if (useAppIndicator) {
                ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_PASSIVE);
            } else if (useStatusIcon) {
                ps_gtk_status_icon_set_visible(_trayIcon, false);
            }
        } else {
            if (trayIcon) {
                trayIcon->setContextMenu(0);
                trayIcon->deleteLater();
            }
            trayIcon = 0;
        }
    } else {
        if (noQtTrayIcon) {
            if (useAppIndicator) {
                ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
            } else if (useStatusIcon) {
                ps_gtk_status_icon_set_visible(_trayIcon, true);
            }
        } else {
            psSetupTrayIcon();
        }
    }
}
Beispiel #3
0
void PsMainWindow::psStatusIconCheck() {
    _trayIconCheck(0);
    if (cSupportTray() || !--_psCheckStatusIconLeft) {
        _psCheckStatusIconTimer.stop();
        return;
    }
}
Beispiel #4
0
void PsMainWindow::psSetupTrayIcon() {
    if (noQtTrayIcon) {
        if (!cSupportTray()) return;
        psUpdateCounter();
    } else {
        if (!trayIcon) {
            trayIcon = new QSystemTrayIcon(this);

            QIcon icon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly));

            trayIcon->setIcon(icon);
            trayIcon->setToolTip(QString::fromStdWString(AppName));
            connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
            connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
            App::wnd()->updateTrayMenu();
        }
        psUpdateCounter();

        trayIcon->show();
        psUpdateDelegate();
    }
}