예제 #1
0
PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) : AbstractBox()
, _downState(0)
, _done(this, lang(lng_settings_save), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, _img(img)
, _peerId(peer) {
	if (peerIsChannel(_peerId)) {
		_title = lang(lng_create_channel_crop);
	} else if (peerIsChat(_peerId)) {
		_title = lang(lng_create_group_crop);
	} else {
		_title = lang(lng_settings_crop_profile);
	}

	connect(&_done, SIGNAL(clicked()), this, SLOT(onSend()));
	connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
	if (_peerId && upload) {
		connect(this, SIGNAL(ready(const QImage&)), this, SLOT(onReady(const QImage&)));
	}
예제 #2
0
AutoDownloadBox::AutoDownloadBox() : AbstractBox(st::boxWidth)
, _photoPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadPhoto() & dbiadNoPrivate), st::defaultBoxCheckbox)
, _photoGroups(this,  lang(lng_media_auto_groups), !(cAutoDownloadPhoto() & dbiadNoGroups), st::defaultBoxCheckbox)
, _audioPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadAudio() & dbiadNoPrivate), st::defaultBoxCheckbox)
, _audioGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadAudio() & dbiadNoGroups), st::defaultBoxCheckbox)
, _gifPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadGif() & dbiadNoPrivate), st::defaultBoxCheckbox)
, _gifGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadGif() & dbiadNoGroups), st::defaultBoxCheckbox)
, _gifPlay(this, lang(lng_media_auto_play), cAutoPlayGif(), st::defaultBoxCheckbox)
, _sectionHeight(st::boxTitleHeight + 2 * (st::defaultBoxCheckbox.height + st::setLittleSkip))
, _save(this, lang(lng_connection_save), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {

	setMaxHeight(3 * _sectionHeight + st::setLittleSkip + _gifPlay.height() + st::setLittleSkip + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom());

	connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));

	prepare();
}
예제 #3
0
PhotoSendBox::PhotoSendBox(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo) : _img(0),
_thumbx(0), _thumby(0), _thumbw(0), _thumbh(0), _namew(0), _textw(0),
_compressed(this, lang(lng_send_image_compressed), true),
_sendButton(this, lang(lng_send_button), st::btnSelectDone),
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
_phone(phone), _fname(fname), _lname(lname), _replyTo(replyTo) {
	connect(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));

	_compressed.hide();

	_name = lng_full_name(lt_first_name, _fname, lt_last_name, _lname);
	_namew = st::mediaFont->width(_name);
	_size = _phone;
	_textw = qMax(_namew, st::mediaFont->width(_size));

	resizeMaxHeight(st::boxWideWidth, st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom() + st::boxPadding.bottom() + _sendButton.height());
	prepare();
}
예제 #4
0
AboutBox::AboutBox() :
_done(this, lang(lng_about_done), st::aboutCloseButton),
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (DevChannel ? " dev" : ""))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle) {
	
	resizeMaxHeight(st::aboutWidth, st::aboutHeight);

	_version.move(0, st::aboutVersionTop);
	_text.move(0, st::aboutTextTop);

	_headerWidth = st::aboutHeaderFont->m.width(qsl("Telegram "));
	_subheaderWidth = st::aboutSubheaderFont->m.width(qsl("Desktop"));

	_done.move(0, height() - _done.height());

	connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));

	prepare();
}
예제 #5
0
파일: RecSkinWidget.cpp 프로젝트: yefy/skp
RecSkinPushButton::RecSkinPushButton(QWidget *parent) :
    QPushButton(parent),
    isEnter(false)
  , isSkin(false)
  , canDelete(false),
    m_num(-1)
{
    setAttribute(Qt::WA_TranslucentBackground);

    m_closeButton = new QPushButton(this);
    QPixmap pixmap(":/close.png");
    m_closeButton->setIcon(QIcon(pixmap));
    m_closeButton->resize(pixmap.size());
    m_closeButton->setFlat(true);
    m_closeButton->setToolTip(tr("delete"));
    m_closeButton->hide();
    connect(m_closeButton,SIGNAL(clicked()),
            this,SLOT(onClose()));
}
bool
HippoAbstractWindow::processMessage(UINT   message,
                                    WPARAM wParam,
                                    LPARAM lParam)
{
    switch (message) 
    {
    case WM_CLOSE:
        onClose(false);
        return true;
    case WM_DESTROY:
        onWindowDestroyed();
        return true;
    case WM_SIZE:
    case WM_MOVE:
        {
            HippoRectangle newRect;
            queryCurrentClientRect(&newRect);
            onMoveResizeMessage(&newRect);
            // below disabled since it doesn't matter for HippoAbstractControl
            // and it might break something.
#if 0
            // onMoveResizeMessage may have already done this, but if 
            // not we clean it up. This might be a tad dangerous
            // if onMoveResizeMessage recursively moves/sizes
            // but it does not right now afaik
            x_ = newRect.x;
            y_ = newRect.y;
            width_ = newRect.width;
            height_ = newRect.height;
            g_debug("SIZING: %s saved new size %d,%d %dx%d",
                HippoUStr(getClassName()).c_str(),
                x_, y_, width_, height_);
#endif
        }
        return false; // for e.g. standard Windows controls we want to run DefWindowProc() ?
    default:
        return false;
    }

    return false;
}
예제 #7
0
/**
 * \brief    Constructeur de DocumentEditorRow
 * \details  Construit une ligne d'édition pour le DocumentEditor en construisant
 *           un éditeur pliable et les boutons pour déplacer une note dans le document,
 *           l'éditer directement dans la fenêtre principale ou la supprimer
 */
DocumentEditorRow::DocumentEditorRow(Note *n, QWidget *parent) :
    QWidget(parent) {
    editor = new FoldableEditor(NotesEditorFactory::getInstance().getNewNoteEditor(n, this), this);
    QObject::connect(editor, SIGNAL(onOpen()), this, SLOT(setSideBarVertical()));
    QObject::connect(editor, SIGNAL(onClose()), this, SLOT(setSideBarHorizontal()));
    moveUpBtn = new QPushButton(QIcon("moveUp.png"), "", this);
    moveUpBtn->setFixedSize(30, 30);
    QObject::connect(moveUpBtn, SIGNAL(clicked()), this, SLOT(moveUp()));
    moveDownBtn = new QPushButton(QIcon("moveDown.png"), "", this);
    moveDownBtn->setFixedSize(30, 30);
    QObject::connect(moveDownBtn, SIGNAL(clicked()), this, SLOT(moveDown()));
    editBtn = new QPushButton(QIcon("editer.png"), "", this);
    editBtn->setFixedSize(30, 30);
    QObject::connect(editBtn, SIGNAL(clicked()), this, SLOT(edit()));
    supressBtn = new QPushButton(QIcon("supprimer.png"), "", this);
    supressBtn->setFixedSize(30, 30);
    QObject::connect(supressBtn, SIGNAL(clicked()), this, SLOT(supress()));
    addBtn = new QPushButton("Ajouter une note existante");
    QObject::connect(addBtn, SIGNAL(clicked()), this, SLOT(add()));
    createBtn = new QPushButton("Créer une note");
    QObject::connect(createBtn, SIGNAL(clicked()), this, SLOT(create()));

    subLayout = new QBoxLayout(QBoxLayout::LeftToRight);
    subLayout->addWidget(moveUpBtn);
    subLayout->addWidget(moveDownBtn);
    subLayout->addWidget(editBtn);
    subLayout->addWidget(supressBtn);

    QHBoxLayout* hLayout = new QHBoxLayout();
    hLayout->addWidget(editor);
    hLayout->addLayout(subLayout);

    QHBoxLayout* addLayout = new QHBoxLayout();
    addLayout->addWidget(addBtn);
    addLayout->addWidget(createBtn);

    layout = new QVBoxLayout();
    layout->addLayout(hLayout);
    layout->addLayout(addLayout);

    this->setLayout(layout);
}
    void ViewPoint::close()
    {
      if (m_initialised && m_model)
      {
        /// must close all the objects according to current viewpoint
        m_model->_close(this) ;

        /// call local close for viewpoint
        onClose() ;

      }

      if (m_model)
      {
        m_model->_unregister(this) ;
        m_model = NULL ;
        m_model_attached = false ;
        m_initialised = false ;
      }
    }
예제 #9
0
bool gMainWindow::doClose()
{
	if (_closing)
		return false;
	
	if (opened)
	{
		if (isModal() && !gApplication::hasLoop(this))
			return true;
		
		_closing = true;
		if (onClose) 
		{
			if (!onClose(this))
				opened = false;
		}
		else
			opened = false;
		_closing = false;
		
		if (!opened && isModal())
			gApplication::exitLoop(this);
  }
  
  if (!opened) // && !modal())
  {
		if (_active == this)
			setActiveWindow(NULL);
		
  	if (!isModal())
  	{
			if (persistent)
				hide();
			else
				destroy();
		}
		return false;
	}
	else
		return opened;
}
예제 #10
0
void PasscodeBox::init() {
	setBlueTitle(true);

	textstyleSet(&st::usernameTextStyle);
	_about.setRichText(st::normalFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about));
	_aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5);
	textstyleRestore();
	if (_turningOff) {
		_oldPasscode.show();
		_boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove);
		setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
	} else {
		bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
		if (has) {
			_oldPasscode.show();
			_boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change);
			setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
		} else {
			_oldPasscode.hide();
			_boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create);
			setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + (_cloudPwd ? st::contactSkip + _recoverEmail.height() + st::passcodeSkip : st::passcodePadding.bottom()) + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
		}
	}

	connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged()));
	connect(&_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
	connect(&_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
	connect(&_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged()));
	connect(&_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged()));

	connect(&_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));

	connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
}
예제 #11
0
DownloadPathBox::DownloadPathBox() :
	_path(cDownloadPath()),
	_defaultRadio(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty()),
	_tempRadio(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp")),
	_dirRadio(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp")),
	_dirInput(this, st::inpDownloadDir, QString(), (_path.isEmpty() || _path == qsl("tmp")) ? QString() : QDir::toNativeSeparators(_path)),
	_saveButton(this, lang(lng_connection_save), st::btnSelectDone),
	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel) {

	connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_defaultRadio, SIGNAL(changed()), this, SLOT(onChange()));
	connect(&_tempRadio, SIGNAL(changed()), this, SLOT(onChange()));
	connect(&_dirRadio, SIGNAL(changed()), this, SLOT(onChange()));

	connect(&_dirInput, SIGNAL(focused()), this, SLOT(onEditPath()));
	_dirInput.setCursorPosition(0);

	prepare();
}
예제 #12
0
void POP3Folder::close(const bool expunge)
{
	ref <POP3Store> store = m_store.acquire();

	if (!store)
		throw exceptions::illegal_state("Store disconnected");

	if (!isOpen())
		throw exceptions::illegal_state("Folder not open");

	if (!expunge)
	{
		store->sendRequest("RSET");
		POP3Response::readResponse(store->m_socket, store->m_timeoutHandler);
	}

	m_open = false;
	m_mode = -1;

	onClose();
}
예제 #13
0
int WebSocketImpl::connect_i(const std::string& ws_url)
{
    if(!uri_.parse(ws_url)) {
        return false;
    }
    tcp_socket_.setReadCallback([this] (int err) { onReceive(err); });
    tcp_socket_.setWriteCallback([this] (int err) { onSend(err); });
    tcp_socket_.setErrorCallback([this] (int err) { onClose(err); });
    setState(STATE_CONNECTING);
    std::string str_port = uri_.getPort();
    uint16_t port = 80;
    uint32_t flag = 0;
    if(is_equal("wss", uri_.getScheme())) {
        port = 443;
        flag = FLAG_HAS_SSL;
    }
    if(!str_port.empty()) {
        port = atoi(str_port.c_str());
    }
    return tcp_socket_.connect(uri_.getHost().c_str(), port, [this] (int err) { onConnect(err); }, flag);
}
예제 #14
0
Sunshine::Sunshine(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Sunshine)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Tool|Qt::FramelessWindowHint);
    QRect rect = QApplication::desktop()->availableGeometry();
        m_point.setX(rect.width() - width());
        m_point.setY(rect.height() - height());
        move(m_point.x(), m_point.y());

        m_pStayTimer = new QTimer(this);
        m_pCloseTimer = new QTimer(this);
        m_nDesktopHeight=rect.height();
        m_dTransparent=1.0;
        m_pShowTimer = new QTimer(this);
        connect(m_pShowTimer, SIGNAL(timeout()), this, SLOT(onMove()));
        connect(m_pStayTimer, SIGNAL(timeout()), this, SLOT(onStay()));
        connect(m_pCloseTimer, SIGNAL(timeout()), this, SLOT(onClose()));
        m_pShowTimer->start(1);
}
예제 #15
0
void NewGroupBox::keyPressEvent(QKeyEvent *e) {
	if (e->key() == Qt::Key_Escape) {
		onClose();
	} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
		_inner.chooseParticipant();
	} else if (_filter.hasFocus()) {
		if (e->key() == Qt::Key_Down) {
			_inner.selectSkip(1);
		} else if (e->key() == Qt::Key_Up) {
			_inner.selectSkip(-1);
		} else if (e->key() == Qt::Key_PageDown) {
			_inner.selectSkipPage(_scroll.height(), 1);
		} else if (e->key() == Qt::Key_PageUp) {
			_inner.selectSkipPage(_scroll.height(), -1);
		} else {
			e->ignore();
		}
	} else {
		e->ignore();
	}
}
예제 #16
0
QgsOSMExportDialog::QgsOSMExportDialog( QWidget *parent )
    : QDialog( parent )
    , mDatabase( new QgsOSMDatabase )
{
  setupUi( this );

  connect( btnBrowseDb, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
  connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) );
  connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) );
  connect( editDbFileName, SIGNAL( textChanged( QString ) ), this, SLOT( updateLayerName() ) );
  connect( radPoints, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) );
  connect( radPolylines, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) );
  connect( radPolygons, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) );
  connect( btnLoadTags, SIGNAL( clicked() ), this, SLOT( onLoadTags() ) );
  connect( btnSelectAll, SIGNAL( clicked() ), this, SLOT( onSelectAll() ) );
  connect( btnUnselectAll, SIGNAL( clicked() ), this, SLOT( onUnselectAll() ) );

  mTagsModel = new QStandardItemModel( this );
  mTagsModel->setHorizontalHeaderLabels( QStringList() << tr( "Tag" ) << tr( "Count" ) << tr( "Not null" ) );
  viewTags->setModel( mTagsModel );
}
예제 #17
0
void Panel::OnNcLButtonUp( UINT nHitTest, CPoint point )
{
	int lastBut = buttonDown_;
	buttonDown_ = 0;
	paintCaptionButtons( nHitTest );

	switch ( nHitTest )
	{
	case BUT_CLOSE:
		if ( lastBut != nHitTest ) break;
		if ( onClose() )
		{
			if ( tabCount() == 0 ) 
				Manager::instance().dock()->removePanel( this );
			return;
		}
		break;

	case BUT_ROLLUP:
		if ( lastBut != nHitTest ) break;
		setExpanded( !isExpanded_ );
		SetFocus();
		activate();
		break;

	case BUT_CLONE:
		if ( lastBut != nHitTest ) break;
		if ( activeTab_ )
		{
			CRect rect;
			GetWindowRect( &rect );
			// position is hand-hacked, but should work well in all cases
			cloneTab(
				activeTab_->getContent(),
				( rect.left + 10 ) % (GetSystemMetrics( SM_CXMAXIMIZED ) - 64),
				( rect.top ) % (GetSystemMetrics( SM_CYMAXIMIZED ) - 64) );
		}
		break;
	}
}
예제 #18
0
//
//	---------- the action message callback ----------
// Windows sends its (event) messages to this procedure
//
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
	case WM_COMMAND:	return doCommand(hDlg, LOWORD(wParam));
	case WM_CLOSE:		onClose(hDlg);		return TRUE;
	case WM_DESTROY:	PostQuitMessage(0);	return TRUE;
	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			HDC hDC = BeginPaint(hDlg, &ps);
			doPaint(hDC);
			EndPaint(hDlg, &ps);
		}
		return true;
	case WM_USER_SIMCONNECT:	fsxDispatch(hDlg);	return TRUE;
	// default: is not caught here so will be handled by DefWndProc
	}

	// indicate that message should (additionally) be processed by DefWndProc
	return FALSE;
}
예제 #19
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ui->stopServerAct->setEnabled(false);

    setWindowTitle(qApp->applicationName() + ' ' + qApp->applicationVersion());
    setContextMenuPolicy(Qt::NoContextMenu);
    createLPanel();

    cLog = new Log;
    connect(cLog, SIGNAL(appendLog(QString)), logWidget->edit, SLOT(append(QString)));
    connect(logWidget->button, SIGNAL(clicked()), logWidget->edit, SLOT(clear()));

    cFtp = new Ftp;
    connect(cFtp, SIGNAL(onError(QString)), this, SLOT(eventHandler(QString)));
    connect(cFtp, SIGNAL(onStarted(QString)), this, SLOT(eventHandler(QString)));
    connect(cFtp, SIGNAL(onClose(QString)), this, SLOT(eventHandler(QString)));
    connect(cFtp, SIGNAL(onEvent(QString)), this, SLOT(eventHandler(QString)));
}
예제 #20
0
void AddContactBox::initBox() {
	if (_peer) {
		if (_peer->chat) {
			_boxTitle = lang(lng_edit_group_title);
			setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height());
		} else {
			_boxTitle = lang(_peer == App::self() ? lng_edit_self_title : lng_edit_contact_title);
			setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 2 * _firstInput.height() + 1 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height());
		}
	} else {
		bool readyToAdd = !_phoneInput.text().isEmpty() && (!_firstInput.text().isEmpty() || !_lastInput.text().isEmpty());
		_boxTitle = lang(readyToAdd ? lng_confirm_contact_data : lng_enter_contact_data);
		setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height());
	}
	_retryButton.hide();

	connect(&_addButton, SIGNAL(clicked()), this, SLOT(onSend()));
	connect(&_retryButton, SIGNAL(clicked()), this, SLOT(onRetry()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));

	prepare();
}
예제 #21
0
void SDLWindow::handleKeyDownEvent() {
	const float increment = 0.50f;
    switch (m_sdlEvent.key.keysym.sym) {
        case SDLK_ESCAPE:
            onClose();
            break;
		case SDLK_UP:
			{
				Vec3 position;
				m_camera->getPosition(position);
				m_camera->setPosition(position + Vec3(0, 0, increment));
			}
			break;
		case SDLK_DOWN:
			{
				Vec3 position;
				m_camera->getPosition(position);
				m_camera->setPosition(position + Vec3(0, 0, -increment));
			}
			break;
		case SDLK_RIGHT:
			{
				Vec3 position;
				m_camera->getPosition(position);
				m_camera->setPosition(position + Vec3(increment, 0, 0));
			}
			break;
		case SDLK_LEFT:
			{
				Vec3 position;
				m_camera->getPosition(position);
				m_camera->setPosition(position + Vec3(-increment, 0, 0));
			}
			break;
        default:
            break;
    }
}
예제 #22
0
void POP3Folder::close(const bool expunge)
{
	ref <POP3Store> store = m_store.acquire();

	if (!store)
		throw exceptions::illegal_state("Store disconnected");

	if (!isOpen())
		throw exceptions::illegal_state("Folder not open");

	if (!expunge)
	{
		store->sendRequest("RSET");

		string response;
		store->readResponse(response, false);
	}

	m_open = false;
	m_mode = -1;

	onClose();
}
예제 #23
0
void MediaView::contextMenuEvent(QContextMenuEvent *e) {
	if (_photo && _photo->full->loaded() && (e->reason() != QContextMenuEvent::Mouse || QRect(_x, _y, _current.width() / cIntRetinaFactor(), _current.height() / cIntRetinaFactor()).contains(e->pos()))) {
		
		if (_menu) {
			_menu->deleteLater();
			_menu = 0;
		}
		_menu = new QMenu(this);
		_menu->addAction(lang(lng_context_save_image), this, SLOT(onSave()))->setEnabled(true);
		_menu->addAction(lang(lng_context_copy_image), this, SLOT(onCopy()))->setEnabled(true);
		_menu->addAction(lang(lng_context_close_image), this, SLOT(onClose()))->setEnabled(true);
		if (_msgid) {
			_menu->addAction(lang(lng_context_forward_image), this, SLOT(onForward()))->setEnabled(true);
			_menu->addAction(lang(lng_context_delete_image), this, SLOT(onDelete()))->setEnabled(true);
		} else if ((App::self() && App::self()->photoId == _photo->id) || (_photo->chat && _photo->chat->photoId == _photo->id)) {
			_menu->addAction(lang(lng_context_delete_image), this, SLOT(onDelete()))->setEnabled(true);
		}
		_menu->setAttribute(Qt::WA_DeleteOnClose);
		connect(_menu, SIGNAL(destroyed(QObject*)), this, SLOT(onMenuDestroy(QObject*)));
		_menu->popup(e->globalPos());
		e->accept();
	}
}
예제 #24
0
DownloadPathBox::DownloadPathBox() : AbstractBox()
, _path(cDownloadPath())
, _pathBookmark(cDownloadPathBookmark())
, _default(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty())
, _temp(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp"))
, _dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp"))
, _pathLink(this, QString(), st::defaultBoxLinkButton)
, _save(this, lang(lng_connection_save), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {

	connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_default, SIGNAL(changed()), this, SLOT(onChange()));
	connect(&_temp, SIGNAL(changed()), this, SLOT(onChange()));
	connect(&_dir, SIGNAL(changed()), this, SLOT(onChange()));

	connect(&_pathLink, SIGNAL(clicked()), this, SLOT(onEditPath()));
	if (!_path.isEmpty() && _path != qsl("tmp")) {
		setPathText(QDir::toNativeSeparators(_path));
	}
	prepare();
}
예제 #25
0
ConnectionBox::ConnectionBox() :
    _saveButton(this, lang(lng_connection_save), st::btnSelectDone),
    _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
    _hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host),
    _portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)),
    _userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user),
	_passwordInput(this, st::inpConnectionPassword, lang(lng_connection_password_ph), cConnectionProxy().password),
	_autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (cConnectionType() == dbictAuto)),
	_httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (cConnectionType() == dbictHttpProxy)),
	_tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)),
	_tryIPv6(this, lang(lng_connection_try_ipv6), cTryIPv6()) {

	connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_autoRadio, SIGNAL(changed()), this, SLOT(onChange()));
	connect(&_httpProxyRadio, SIGNAL(changed()), this, SLOT(onChange()));
	connect(&_tcpProxyRadio, SIGNAL(changed()), this, SLOT(onChange()));

	_passwordInput.setEchoMode(QLineEdit::Password);

	prepare();
}
예제 #26
0
void PhotoCropBox::onSend() {
	QImage from(_img);
	if (_img.width() < _thumb.width()) {
		from = _thumb.toImage();
	}
	float64 x = float64(_cropx) / _thumbw, y = float64(_cropy) / _thumbh, w = float64(_cropw) / _thumbw;
	int32 ix = int32(x * from.width()), iy = int32(y * from.height()), iw = int32(w * from.width());
	if (ix < 0) {
		ix = 0;
	}
	if (ix + iw > from.width()) {
		iw = from.width() - ix;
	}
	if (iy < 0) {
		iy = 0;
	}
	if (iy + iw > from.height()) {
		iw = from.height() - iy;
	}
	int32 offset = ix * from.depth() / 8 + iy * from.bytesPerLine();
	QImage cropped(from.constBits() + offset, iw, iw, from.bytesPerLine(), from.format()), tosend;
	if (from.format() == QImage::Format_Indexed8) {
		cropped.setColorCount(from.colorCount());
		cropped.setColorTable(from.colorTable());
	}
	if (cropped.width() > 1280) {
		tosend = cropped.scaled(1280, 1280, Qt::KeepAspectRatio, Qt::SmoothTransformation);
	} else if (cropped.width() < 320) {
		tosend = cropped.scaled(320, 320, Qt::KeepAspectRatio, Qt::SmoothTransformation);
	} else {
		tosend = cropped.copy();
	}

	emit ready(tosend);
	onClose();
}
예제 #27
0
QgsOSMDownloadDialog::QgsOSMDownloadDialog( QWidget* parent )
    : QDialog( parent ), mDownload( new QgsOSMDownload )
{
  setupUi( this );

  editXMin->setValidator( new QDoubleValidator( -180.0, 180.0, 6, this ) );
  editXMax->setValidator( new QDoubleValidator( -180.0, 180.0, 6, this ) );
  editYMin->setValidator( new QDoubleValidator( -90.0, 90.0, 6, this ) );
  editYMax->setValidator( new QDoubleValidator( -90.0, 90.0, 6, this ) );

  populateLayers();
  onExtentCanvas();

  connect( radExtentCanvas, SIGNAL( clicked() ), this, SLOT( onExtentCanvas() ) );
  connect( radExtentLayer, SIGNAL( clicked() ), this, SLOT( onExtentLayer() ) );
  connect( radExtentManual, SIGNAL( clicked() ), this, SLOT( onExtentManual() ) );
  connect( cboLayers, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onCurrentLayerChanged( int ) ) );
  connect( btnBrowse, SIGNAL( clicked() ), this, SLOT( onBrowseClicked() ) );
  connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) );
  connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) );

  connect( mDownload, SIGNAL( finished() ), this, SLOT( onFinished() ) );
  connect( mDownload, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( onDownloadProgress( qint64, qint64 ) ) );
}
예제 #28
0
ccPointPropertiesDlg::ccPointPropertiesDlg(QWidget* parent)
	: ccPointPickingGenericInterface(parent)
	, Ui::PointPropertiesDlg()
	, m_pickingMode(POINT_INFO)
{
	setupUi(this);

	connect(closeButton,				SIGNAL(clicked()), this, SLOT(onClose()));
	connect(pointPropertiesButton,		SIGNAL(clicked()), this, SLOT(activatePointPropertiesDisplay()));
	connect(pointPointDistanceButton,	SIGNAL(clicked()), this, SLOT(activateDistanceDisplay()));
	connect(pointsAngleButton,			SIGNAL(clicked()), this, SLOT(activateAngleDisplay()));
	connect(rectZoneToolButton,			SIGNAL(clicked()), this, SLOT(activate2DZonePicking()));
	connect(saveLabelButton,			SIGNAL(clicked()), this, SLOT(exportCurrentLabel()));
	connect(razButton,					SIGNAL(clicked()), this, SLOT(initializeState()));

	//for points picking
	m_label = new cc2DLabel();
	m_label->setSelected(true);

	//for 2D zone picking
	m_rect2DLabel = new cc2DViewportLabel();
	m_rect2DLabel->setVisible(false);	//=invalid
	m_rect2DLabel->setSelected(true);	//=closed
}
예제 #29
0
AutoLockBox::AutoLockBox() :
_done(this, lang(lng_about_done), st::langsCloseButton) {

	bool haveTestLang = (cLang() == languageTest);

	int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);

	resizeMaxHeight(st::langsWidth, st::boxTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + cnt * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height());

	int32 y = st::boxTitleHeight + st::langsPadding.top();
	_options.reserve(cnt);
	for (int32 i = 0; i < cnt; ++i) {
		int32 v = opts[i];
		_options.push_back(new FlatRadiobutton(this, qsl("autolock"), v, (v % 3600) ? lng_passcode_autolock_minutes(lt_count, v / 60) : lng_passcode_autolock_hours(lt_count, v / 3600), (cAutoLock() == v), st::langButton));
		_options.back()->move(st::langsPadding.left() + st::langPadding.left(), y + st::langPadding.top());
		y += st::langPadding.top() + _options.back()->height() + st::langPadding.bottom();
		connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange()));
	}

	connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));

	_done.move(0, height() - _done.height());
	prepare();
}
예제 #30
0
AutoLockBox::AutoLockBox() :
_close(this, lang(lng_box_ok), st::defaultBoxButton) {

	bool haveTestLang = (cLang() == languageTest);

	int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);

	resizeMaxHeight(st::langsWidth, st::boxTitleHeight + cnt * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom());

	int32 y = st::boxTitleHeight + st::boxOptionListPadding.top();
	_options.reserve(cnt);
	for (int32 i = 0; i < cnt; ++i) {
		int32 v = opts[i];
		_options.push_back(new Radiobutton(this, qsl("autolock"), v, (v % 3600) ? lng_passcode_autolock_minutes(lt_count, v / 60) : lng_passcode_autolock_hours(lt_count, v / 3600), (Global::AutoLock() == v), st::langsButton));
		_options.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y);
		y += _options.back()->height() + st::boxOptionListPadding.top();
		connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange()));
	}

	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));

	_close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height());
	prepare();
}