Пример #1
0
ProxyWidget::ProxyWidget(QWidget *parent) :
    QWidget(parent), ui( new Ui::ProxyWidget)
{
    ui->setupUi( this );

    unicorn::AppSettings appSettings;

    QStringList proxyTypes;
    proxyTypes << tr( "Auto-detect" ) << tr( "No-proxy" ) << tr("HTTP") << tr("SOCKS5");
    ui->proxyType->addItems( proxyTypes );
    ui->proxyType->setCurrentIndex( appSettings.value( "proxyType", 0 ).toInt() );
    ui->proxyHost->setText( appSettings.value( "proxyHost", "" ).toString() );
    ui->proxyPort->setText( appSettings.value( "proxyPort", "" ).toString() );
    ui->proxyUsername->setText( appSettings.value( "proxyUsername", "" ).toString() );
    ui->proxyPassword->setText( appSettings.value( "proxyPassword", "" ).toString() );

    connect( ui->proxyType, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()));
    connect( ui->proxyHost, SIGNAL(textChanged(QString)), SIGNAL(changed()));
    connect( ui->proxyPort, SIGNAL(textChanged(QString)), SIGNAL(changed()));
    connect( ui->proxyUsername, SIGNAL(textChanged(QString)), SIGNAL(changed()));
    connect( ui->proxyPassword, SIGNAL(textChanged(QString)), SIGNAL(changed()));

    connect( this, SIGNAL(changed()), SLOT(onChanged()) );

    onChanged();
}
Пример #2
0
	void BorderFProperty::InitializeControls()
	{
		mLeftProperty = GetChildByType<FloatProperty>("layout/properties/left");
		mLeftProperty->SetValuePath("left");
		mLeftProperty->onChanged = [&](IPropertyField* field) { onChanged(field); };
		mLeftProperty->onChangeCompleted = [&](const String& path, const Vector<DataNode>& before, const Vector<DataNode>& after)
		{
			onChangeCompleted(mValuesPath + "/" + path, before, after);
		};

		mBottomProperty = GetChildByType<FloatProperty>("layout/properties/bottom");
		mBottomProperty->SetValuePath("bottom");
		mBottomProperty->onChanged = [&](IPropertyField* field) { onChanged(field); };
		mBottomProperty->onChangeCompleted = [&](const String& path, const Vector<DataNode>& before, const Vector<DataNode>& after)
		{
			onChangeCompleted(mValuesPath + "/" + path, before, after);
		};

		mRightProperty = GetChildByType<FloatProperty>("layout/properties/right");
		mRightProperty->SetValuePath("right");
		mRightProperty->onChanged = [&](IPropertyField* field) { onChanged(field); };
		mRightProperty->onChangeCompleted = [&](const String& path, const Vector<DataNode>& before, const Vector<DataNode>& after)
		{
			onChangeCompleted(mValuesPath + "/" + path, before, after);
		};

		mTopProperty = GetChildByType<FloatProperty>("layout/properties/top");
		mTopProperty->SetValuePath("top");
		mTopProperty->onChanged = [&](IPropertyField* field) { onChanged(field); };
		mTopProperty->onChangeCompleted = [&](const String& path, const Vector<DataNode>& before, const Vector<DataNode>& after)
		{
			onChangeCompleted(mValuesPath + "/" + path, before, after);
		};
	}
Пример #3
0
BOOL DlgOption::SubOutput::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_WINDOWPOSCHANGED:
		{
			RECT rClient, rWnd;

			GetClientRect(getHWnd(), &rClient);

			// options tree
			rWnd = utils::getWindowRect(getHWnd(), m_Options);
			rWnd.right = rClient.right;
			rWnd.bottom = rClient.bottom;
			utils::moveWindow(m_Options, rWnd);
		}
		break;

	case WM_NOTIFY:
		NMHDR* p = reinterpret_cast<NMHDR*>(lParam);

		if (p->idFrom == IDC_OPTIONS) {
			if (p->code == OptionsCtrl::OCN_MODIFIED) {
				OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);

				onChanged(pNM->hItem);
				return TRUE;
			}
		}
		break;
	}

	return FALSE;
}
Пример #4
0
void Select::handle(MenuAction action) {
	if (empty()) {
		return;
	}
	if (action == MenuAction::AlternatePrev) {
		if (index > 0u) {
			--index;
		} else {
			return;
		}
	} else if (action == MenuAction::AlternateNext) {
		if (index < size() - 1) {
			++index;
		} else {
			return;
		}
	}
	onChanged();
	if (action == MenuAction::Activate) {
		if (activate != nullptr) {
			activate();
		}
	} else if (action == MenuAction::AlternatePrev || action == MenuAction::AlternateNext) {
		if (change != nullptr) {
			change();
		}
	}
}
Пример #5
0
void StrList::setUpdateState(bool isUpdating)
{
	if (isUpdating)
		onChanging();
	else
		onChanged();
}
Пример #6
0
	void SceneNode::doComputeMatrix()
	{
		if ( m_mtxChanged )
		{
			m_derivedMtxChanged = true;
			matrix::setTransform( m_transform, m_position, m_scale, m_orientation );
			m_mtxChanged = false;
		}

		if ( m_derivedMtxChanged )
		{
			SceneNodeSPtr parent = getParent();

			if ( parent )
			{
				m_derivedTransform = parent->getDerivedTransformationMatrix() * m_transform;
			}
			else
			{
				m_derivedTransform = m_transform;
			}

			m_derivedMtxChanged = false;
			onChanged( *this );
		}
	}
Пример #7
0
Clipboard::Clipboard(QObject *parent)
    : QObject(parent)
    , m_text(qApp->clipboard()->text())
{
    connect(qApp->clipboard(), SIGNAL(changed(QClipboard::Mode)),
            this, SLOT(onChanged(QClipboard::Mode)));
}
InviteContactDialog::InviteContactDialog(const Tp::AccountManagerPtr &accountManager, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent) :
    KDialog(parent),
    m_account(account),
    m_channel(channel),
    m_contactsModel(new KTp::ContactsListModel(this))
{
    resize(500,450);

    m_contactsModel->setAccountManager(accountManager);

    m_contactGridWidget = new KTp::ContactGridWidget(m_contactsModel, this);
    m_contactGridWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts..."));
    m_contactGridWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected);
    m_contactGridWidget->filter()->setAccountFilter(account);
    setMainWidget(m_contactGridWidget);
    setWindowTitle(i18n("Select Contacts to Invite to Group Chat"));

    connect(m_contactGridWidget,
            SIGNAL(selectionChanged(Tp::AccountPtr,Tp::ContactPtr)),
            SLOT(onChanged()));

    button(KDialog::Ok)->setDisabled(true);

    connect(this, SIGNAL(okClicked()), SLOT(onOkClicked()));
    connect(this, SIGNAL(rejected()), SLOT(close()));
}
Пример #9
0
Radiobutton::Radiobutton(QWidget *parent, const QString &group, int32 value, const QString &text, bool checked, const style::Radiobutton &st) : Button(parent),
_st(st),
a_over(0), a_checked(checked ? 1 : 0),
_a_over(animFunc(this, &Radiobutton::animStep_over)), _a_checked(animFunc(this, &Radiobutton::animStep_checked)),
_text(text), _fullText(text), _textWidth(st.font->width(text)),
_checked(checked), _group(radiobuttons.reg(group)), _value(value) {
	if (_st.width <= 0) {
		resize(_textWidth - _st.width, _st.height);
	} else {
		if (_st.width < _st.textPosition.x() + _textWidth + (_st.textPosition.x() - _st.diameter)) {
			_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1.));
			_textWidth = _st.font->width(_text);
		}
		resize(_st.width, _st.height);
	}
	_checkRect = myrtlrect(0, 0, _st.diameter, _st.diameter);

	connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));

	setCursor(style::cur_pointer);

	setAttribute(Qt::WA_OpaquePaintEvent);

	reinterpret_cast<RadiobuttonGroup*>(_group)->insert(this, true);
	if (_checked) onChanged();
}
Пример #10
0
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
_save(this, lang(lng_settings_save), st::defaultBoxButton),
_cancel(this, lang(lng_cancel), st::cancelBoxButton),
_username(this, st::defaultInputField, qsl("@username"), App::self()->username, false),
_link(this, QString(), st::defaultBoxLinkButton),
_saveRequestId(0), _checkRequestId(0),
_about(st::boxWidth - st::usernamePadding.left()) {
	setBlueTitle(true);

	_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);

	textstyleSet(&st::usernameTextStyle);
	_about.setRichText(st::boxTextFont, lang(lng_username_about));
	resizeMaxHeight(st::boxWidth, st::boxTitleHeight + st::usernamePadding.top() + _username.height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom());
	textstyleRestore();

	connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_username, SIGNAL(changed()), this, SLOT(onChanged()));
	connect(&_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));

	connect(&_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));

	_checkTimer.setSingleShot(true);
	connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));

	prepare();
}
Пример #11
0
Data&
Data::setFreshnessPeriod(const time::milliseconds& freshnessPeriod)
{
  onChanged();
  m_metaInfo.setFreshnessPeriod(freshnessPeriod);

  return *this;
}
Пример #12
0
Data&
Data::setFinalBlockId(const name::Component& finalBlockId)
{
  onChanged();
  m_metaInfo.setFinalBlockId(finalBlockId);

  return *this;
}
Пример #13
0
Data&
Data::setName(const Name& name)
{
  onChanged();
  m_name = name;

  return *this;
}
Пример #14
0
Data&
Data::setContentType(uint32_t type)
{
  onChanged();
  m_metaInfo.setType(type);

  return *this;
}
Пример #15
0
Data&
Data::setMetaInfo(const MetaInfo& metaInfo)
{
  onChanged();
  m_metaInfo = metaInfo;

  return *this;
}
Пример #16
0
Data&
Data::setSignature(const Signature& signature)
{
  onChanged();
  m_signature = signature;

  return *this;
}
Пример #17
0
Data&
Data::setSignatureValue(const Block& value)
{
  onChanged();
  m_signature.setValue(value);

  return *this;
}
Пример #18
0
Data&
Data::setContent(const ConstBufferPtr& contentValue)
{
  onChanged();

  m_content = Block(tlv::Content, contentValue); // not a real wire encoding yet

  return *this;
}
Пример #19
0
Data&
Data::setContent(const uint8_t* content, size_t contentLength)
{
  onChanged();

  m_content = makeBinaryBlock(tlv::Content, content, contentLength);

  return *this;
}
Пример #20
0
void StrList::sort(StringListCompareProc compareProc)
{
	if (!isSorted_ && count_ > 1)
	{
		onChanging();
		quickSort(0, count_ - 1, compareProc);
		onChanged();
	}
}
//==========================================================================================================
ColorPicker::ColorPicker(QWidget *parent, CPStyles style):
    QFrame(parent){

    fbframe = new FBFrame(this, style);
    cframe = new CFrame(this, style);
    int r = 1;
    int c = 0;
    if ((style == maxvertical)||(style == vertical)||(style == minvertical)){
            r = 0;
            c = 1;
    }

    layout = new QGridLayout(this);
    layout->setSpacing(0);
    layout->setObjectName(QStringLiteral("verticalLayout"));
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(cframe, 0, 0, 1, 1);
    layout->addWidget(fbframe, c, r, 1, 1);
    connect(cframe->buttons, SIGNAL(buttonReleased(QAbstractButton*)),
            this, SLOT(onColorSelected(QAbstractButton*)));
    connect(fbframe->foregroundButton, SIGNAL(changed()),
            this, SLOT(onChanged()));
    switch(style){
        case maxvertical:{
            cframe->setInitPal(MAX_INIT_PALLETTE);
            this->setFixedSize(MAX_VERTICAL_SIZE);
            break;
        }
        case vertical:{
            cframe->setInitPal(STD_INIT_PALLETTE);
            this->setFixedSize(VERTICAL_SIZE);
            break;
        }
        case maxhorizontal:{
            cframe->setInitPal(MAX_INIT_PALLETTE);
            this->setFixedSize(MAX_HORIZONTAL_SIZE);
            break;
        }
        case horizontal:{
            cframe->setInitPal(STD_INIT_PALLETTE);
            this->setFixedSize(HORIZONTAL_SIZE);
            break;
        }
        case minvertical:{
            cframe->setInitPal(MIN_INIT_PALLETTE);
            this->setFixedSize(MIN_VERTICAL_SIZE);
            break;
        }
        case minhorizontal:{
            cframe->setInitPal(MIN_INIT_PALLETTE);
            this->setFixedSize(MIN_HORIZONTAL_SIZE);
            break;
        }
    };


}
Пример #22
0
void DataSettingsWidget::onItemChanged(const DataItem &item)
{
    delete m_form;
    m_form = AbstractDataForm::get(item);
    if (m_form) {
        connect(m_form, SIGNAL(changed()), SLOT(onChanged()));
        m_layout->addWidget(m_form);
    }
}
Пример #23
0
void StrList::setData(int index, POINTER data)
{
	if (index < 0 || index >= count_)
		error(SEM_LIST_INDEX_ERROR, index);

	onChanging();
	list_[index].data = data;
	onChanged();
}
Пример #24
0
SocialWidget::SocialWidget( QWidget* parent )
    : QWidget( parent ) // this is on purpose!
    , ui( new Ui::SocialWidget )
    , m_parent( parent )
    , m_parentRect( parent->rect() )
{
    ui->setupUi( this );
    setWindowFlags( Qt::FramelessWindowHint );
    setWindowFlags( Qt::Popup );
    ui->verticalLayout->setSpacing( 8 );
    ui->verticalLayout->setMargin( 12 );


    setAttribute( Qt::WA_TranslucentBackground, true );

    setContentsMargins( contentsMargins().left() + 2, contentsMargins().top() + 2,
                        contentsMargins().right() + 2, contentsMargins().bottom() + 2 + ARROW_HEIGHT );

    m_timer.setSingleShot( true );
    connect( &m_timer, SIGNAL( timeout() ), this, SLOT( hide() ) );

    ui->charsLeftLabel->setForegroundRole( QPalette::Text );
    ui->charsLeftLabel->setStyleSheet( "text: black" );
    ui->buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Tweet" ) );
    ui->buttonBox->button( QDialogButtonBox::Ok )->setIcon( QIcon( RESPATH "images/ok.png" ) );
    ui->buttonBox->button( QDialogButtonBox::Cancel )->setIcon( QIcon( RESPATH "images/cancel.png" ) );

    ui->textEdit->setStyleSheet( "border: 1px solid #8c8c8c;" );
    
    m_parent->installEventFilter( this );

    connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( accept() ) );
    connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( close() ) );
    connect( ui->textEdit, SIGNAL( textChanged() ), SLOT( onChanged() ) );
    connect( ui->facebookButton, SIGNAL( clicked( bool ) ), SLOT( onChanged() ) );
    connect( ui->twitterButton, SIGNAL( clicked( bool ) ), SLOT( onChanged() ) );
    connect( GlobalActionManager::instance(), SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ), SLOT( onShortLinkReady( QUrl, QUrl, QVariant ) ) );

    onChanged();

    ui->twitterButton->setChecked( true );
    ui->twitterButton->setVisible( false );
    ui->facebookButton->setVisible( false );
}
Пример #25
0
StelAction::StelAction(const QString& actionId,
		       const QString& groupId,
		       const QString& text,
		       const QString& primaryKey,
		       const QString& altKey,
		       bool global):
	QObject(StelApp::getInstance().getStelActionManager()),
	group(groupId),
	text(text),
	global(global),
	keySequence(primaryKey),
	altKeySequence(altKey),
	defaultKeySequence(primaryKey),
	defaultAltKeySequence(altKey),
	target(NULL),
	boolProperty(NULL)
      #ifndef USE_QUICKVIEW
      ,qAction(NULL)
      #endif
{
	setObjectName(actionId);
	// Check the global conf for custom shortcuts.
	QSettings* conf = StelApp::getInstance().getSettings();
	QString confShortcut = conf->value("shortcuts/" + actionId).toString();
	if (!confShortcut.isEmpty())
	{
		QStringList shortcuts = confShortcut.split(" ");
		if (shortcuts.size() > 2)
			qWarning() << actionId << ": does not support more than two shortcuts per action";
		setShortcut(shortcuts[0]);
		if (shortcuts.size() > 1)
			setAltShortcut(shortcuts[1]);
	}
#ifndef USE_QUICKVIEW
	QWidget* mainView = &StelMainView::getInstance();
	qAction = new QAction(this);
	onChanged();
	mainView->addAction(qAction);
	connect(qAction, SIGNAL(triggered()), this, SLOT(trigger()));
	connect(this, SIGNAL(changed()), this, SLOT(onChanged()));
#endif
}
Пример #26
0
void ObjectWidget::changeObject(QASAbstractObject* obj, bool fullObject) {
  if (m_object)
    disconnect(m_object, SIGNAL(changed()), this, SLOT(onChanged()));
  if (m_irtObject)
    disconnect(m_irtObject, SIGNAL(changed()),
               this, SLOT(updateContextLabel()));
  m_irtObject = NULL;

  m_object = qobject_cast<QASObject*>(obj);
  if (!obj)
    return;
  m_short = !fullObject;

  connect(m_object, SIGNAL(changed()), this, SLOT(onChanged()));

  m_objectWidget->changeObject(obj);
  m_shortObjectWidget->changeObject(obj);

  m_contextLabel->setVisible(false);
  m_contextButton->setVisible(false);
  if (m_object->type() == "comment" && m_object->inReplyTo()) {
    m_irtObject = m_object->inReplyTo();
    connect(m_irtObject, SIGNAL(changed()), this, SLOT(updateContextLabel()));

    if (!m_irtObject->url().isEmpty())
      updateContextLabel();
  }

  if (m_short) {
    m_contextLabel->setVisible(false);
    m_contextButton->setVisible(false);
    m_objectWidget->setVisible(false);
    m_shortObjectWidget->setVisible(true);
  } else {
    m_shortObjectWidget->setVisible(false);
    m_objectWidget->setVisible(true);
  }

  QASActor* author = m_object->author();
  if (author && author->url().isEmpty())
    refreshObject(m_object);
}
Пример #27
0
void StrList::exchange(int index1, int index2)
{
	if (index1 < 0 || index1 >= count_)
		error(SEM_LIST_INDEX_ERROR, index1);
	if (index2 < 0 || index2 >= count_)
		error(SEM_LIST_INDEX_ERROR, index2);

	onChanging();
	exchangeItems(index1, index2);
	onChanged();
}
Пример #28
0
QStyleItem::QStyleItem(QQuickPaintedItem *parent)
    : QQuickPaintedItem(parent),
    m_styleoption(0),
    m_itemType(Undefined),
    m_sunken(false),
    m_raised(false),
    m_active(true),
    m_selected(false),
    m_focus(false),
    m_hover(false),
    m_on(false),
    m_horizontal(true),
    m_sharedWidget(false),
    m_minimum(0),
    m_maximum(100),
    m_value(0),
    m_step(0),
    m_paintMargins(0),
    m_contentWidth(0),
    m_contentHeight(0)

{
    if (!qApp->style()) {
        qWarning("\nError: No widget style available. \n\nQt Desktop Components "
               "currently depend on the widget module to function. \n"
               "Use QApplication when creating standalone executables.\n\n");
        exit(-1);
    }
    m_font = qApp->font();
    setFlag(QQuickItem::ItemHasContents, true);
    setSmooth(false);

    connect(this, SIGNAL(enabledChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(infoChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(onChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(selectedChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(activeChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(textChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(activeChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(raisedChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(sunkenChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(hoverChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(maximumChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(minimumChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(valueChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(horizontalChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(activeControlChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(hasFocusChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(activeControlChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(elementTypeChanged()), this, SLOT(updateItem()));
    connect(this, SIGNAL(textChanged()), this, SLOT(updateSizeHint()));
    connect(this, SIGNAL(contentWidthChanged(int)), this, SLOT(updateSizeHint()));
    connect(this, SIGNAL(contentHeightChanged(int)), this, SLOT(updateSizeHint()));
}
Пример #29
0
void StrList::setString(int index, const char* value)
{
	if (isSorted_)
		error(SEM_SORTED_LIST_ERROR, 0);
	if (index < 0 || index >= count_)
		error(SEM_LIST_INDEX_ERROR, index);

	onChanging();
	stringObjectNeeded(index) = value;
	onChanged();
}
Пример #30
0
PasscodeWidget::PasscodeWidget(QWidget *parent) : TWidget(parent)
, _passcode(this, st::passcodeInput, lang(lng_passcode_ph))
, _submit(this, lang(lng_passcode_submit), st::passcodeSubmit)
, _logout(this, lang(lng_passcode_logout)) {
	connect(_passcode, SIGNAL(changed()), this, SLOT(onChanged()));
	connect(_passcode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));

	_submit->setClickedCallback([this] { onSubmit(); });
	_logout->setClickedCallback([] { App::wnd()->onLogout(); });

	show();
}