Esempio n. 1
0
TitleWidget::TitleWidget(MainWindow *window) : TWidget(window)
, wnd(window)
, hideLevel(0)
, hider(0)
, _back(this, st::titleBackButton, lang(lng_menu_back))
, _cancel(this, lang(lng_cancel), st::titleTextButton)
, _settings(this, lang(lng_menu_settings), st::titleTextButton)
, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
, _about(this, lang(lng_menu_about), st::titleTextButton)
, _lock(this, window)
, _update(this, window, lang(lng_menu_update))
, _minimize(this, window)
, _maximize(this, window)
, _restore(this, window)
, _close(this, window)
, _a_update(animation(this, &TitleWidget::step_update))
, lastMaximized(!(window->windowState() & Qt::WindowMaximized))
{
	setGeometry(0, 0, wnd->width(), st::titleHeight);
	setAttribute(Qt::WA_OpaquePaintEvent);
	_lock.hide();
	_update.hide();
    _cancel.hide();
    _back.hide();
	if (
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
		Sandbox::updatingState() == Application::UpdatingReady ||
#endif
		cHasPasscode()
	) {
		showUpdateBtn();
	}
	stateChanged();

	connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked()));
	connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings()));
	connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
	connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
	connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));

#ifndef TDESKTOP_DISABLE_AUTOUPDATE
	Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
#endif

    if (cPlatform() != dbipWindows) {
        _minimize.hide();
        _maximize.hide();
        _restore.hide();
        _close.hide();
    }
}
Esempio n. 2
0
void TitleWidget::updateBackButton() {
	if (!cWideMode() && App::main() && App::main()->selectingPeer()) {
		_cancel.show();
		if (!_back.isHidden()) _back.hide();
		_settings.hide();
		_contacts.hide();
		_about.hide();
	} else {
		_cancel.hide();
		bool authed = (MTP::authedId() > 0);
		if (cWideMode()) {
			if (!_back.isHidden()) _back.hide();
			_settings.show();
			if (authed) _contacts.show();
			_about.show();
		} else {
			bool need = App::wnd()->needBackButton();
			if (need && _back.isHidden()) {
				_back.show();
				_settings.hide();
				_contacts.hide();
				_about.hide();
			} else if (!need && !_back.isHidden()) {
				_back.hide();
				_settings.show();
				if (authed) _contacts.show();
				_about.show();
			}
		}
	}
	showUpdateBtn();
	update();
}
Esempio n. 3
0
TitleWidget::TitleWidget(Window *window)
	: QWidget(window)
	, wnd(window)
    , hideLevel(0)
    , hider(0)
	, _back(this, st::titleBackButton, lang(lng_menu_back))
	, _cancel(this, lang(lng_cancel), st::titleTextButton)
	, _settings(this, lang(lng_menu_settings), st::titleTextButton)
	, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
	, _about(this, lang(lng_menu_about), st::titleTextButton)
	, _update(this, window, lang(lng_menu_update))
	, _minimize(this, window)
	, _maximize(this, window)
	, _restore(this, window)
	, _close(this, window)
    , lastMaximized(!(window->windowState() & Qt::WindowMaximized))
{
	setGeometry(0, 0, wnd->width(), st::titleHeight);
	_update.hide();
    _cancel.hide();
    _back.hide();
	if (App::app()->updatingState() == Application::UpdatingReady) {
		showUpdateBtn();
	}
	stateChanged();

	connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked()));
	connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings()));
	connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
	connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
	connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));
	connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));

    if (cPlatform() != dbipWindows) {
        _minimize.hide();
        _maximize.hide();
        _restore.hide();
        _close.hide();
    }
}
Esempio n. 4
0
void TitleWidget::updateBackButton() {
	if (App::passcoded()) {
		if (!_cancel.isHidden()) _cancel.hide();
		if (!_back.isHidden()) _back.hide();
		if (!_settings.isHidden()) _settings.hide();
		if (!_contacts.isHidden()) _contacts.hide();
		if (!_about.isHidden()) _about.hide();
		_lock.setSysBtnStyle(st::sysUnlock);
	} else {
		_lock.setSysBtnStyle(st::sysLock);
		if (!cWideMode() && App::main() && App::main()->selectingPeer()) {
			_cancel.show();
			if (!_back.isHidden()) _back.hide();
			if (!_settings.isHidden()) _settings.hide();
			if (!_contacts.isHidden()) _contacts.hide();
			if (!_about.isHidden()) _about.hide();
		} else {
			if (!_cancel.isHidden()) _cancel.hide();
			bool authed = (MTP::authedId() > 0);
			if (cWideMode()) {
				if (!_back.isHidden()) _back.hide();
				if (_settings.isHidden()) _settings.show();
				if (authed && _contacts.isHidden()) _contacts.show();
				if (_about.isHidden()) _about.show();
			} else {
				if (App::wnd()->needBackButton()) {
					if (_back.isHidden()) _back.show();
					if (!_settings.isHidden()) _settings.hide();
					if (!_contacts.isHidden()) _contacts.hide();
					if (!_about.isHidden()) _about.hide();
				} else {
					if (!_back.isHidden()) _back.hide();
					if (_settings.isHidden()) _settings.show();
					if (authed && _contacts.isHidden()) _contacts.show();
					if (_about.isHidden()) _about.show();
				}
			}
		}
	}
	showUpdateBtn();
	update();
}