示例#1
0
void dmsBox::focusOutEvent( QFocusEvent *e ) {
	KLineEdit::focusOutEvent( e );
	
	if ( text().isEmpty() ) {
		setEmptyText();
	}
}
示例#2
0
void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
	for_const (auto &entity, textWithEntities.entities) {
		auto type = entity.type();
		if (type == EntityInTextUrl
			|| type == EntityInTextCustomUrl
			|| type == EntityInTextEmail) {
			_flags |= MTPDmessage_ClientFlag::f_has_text_links;
			break;
		}
	}

	if (_media && _media->consumeMessageText(textWithEntities)) {
		setEmptyText();
	} else {
		_text.setMarkedText(
			st::messageTextStyle,
			textWithEntities,
			Ui::ItemTextOptions(this));
		if (!textWithEntities.text.isEmpty() && _text.isEmpty()) {
			// If server has allowed some text that we've trim-ed entirely,
			// just replace it with something so that UI won't look buggy.
			_text.setMarkedText(
				st::messageTextStyle,
				{ QString::fromUtf8("\xF0\x9F\x98\x94"), EntitiesInText() },
				Ui::ItemTextOptions(this));
		}
		_textWidth = -1;
		_textHeight = 0;
	}
}
示例#3
0
void HistoryMessage::applyEditionToEmpty() {
	setReplyMarkup(nullptr);
	refreshMedia(nullptr);
	setEmptyText();
	setViewsCount(-1);

	finishEditionToEmpty();
}
示例#4
0
void WFormWidget::enableAjax()
{
  if (!emptyText_.empty() && toolTip() == emptyText_) {
    setToolTip("");
    setEmptyText(emptyText_);
  }
  
  WInteractWidget::enableAjax();
}
示例#5
0
void dmsBox::slotTextChanged( const QString &t ) {
    if ( ! hasFocus() ) {
        if ( EmptyFlag && ! t.isEmpty() ) {
            EmptyFlag = false;
        }

        if ( ! EmptyFlag && t.isEmpty() ) {
            setEmptyText();
        }
    }
}
示例#6
0
void dmsBox::setDegType( bool t ) {
    deg = t;

    QString sTip = ( t ? i18n( "Angle value in degrees." ) : i18n( "Angle value in hours." ) );
    QString sWhatsThis;

    if ( isReadOnly() ) {
        if( t ) {
            sWhatsThis = i18n( "This box displays an angle in degrees. "
                               "The three numbers displayed are the angle's "
                               "degrees, arcminutes, and arcseconds." );
        }
        else {
            sWhatsThis = i18n( "This box displays an angle in hours. "
                               "The three numbers displayed are the angle's "
                               "hours, minutes, and seconds." );
        }
    } else {
        if( t ) {
            sTip += i18n( "  You may enter a simple integer, or a floating-point value, "
                          "or space- or colon-delimited values specifying "
                          "degrees, arcminutes and arcseconds" );

            sWhatsThis = i18n( "Enter an angle value in degrees.  The angle can be expressed "
                               "as a simple integer (\"12\"), a floating-point value "
                               "(\"12.33\"), or as space- or colon-delimited "
                               "values specifying degrees, arcminutes and arcseconds (\"12:20\", \"12:20:00\", "
                               "\"12 20\", \"12 20 00.0\", etc.)." );
        }
        else {
            sTip += i18n( "  You may enter a simple integer, or a floating-point value, "
                          "or space- or colon-delimited values specifying "
                          "hours, minutes and seconds" );
            
            sWhatsThis = i18n( "Enter an angle value in hours.  The angle can be expressed "
                               "as a simple integer (\"12\"), a floating-point value "
                               "(\"12.33\"), or as space- or colon-delimited "
                               "values specifying hours, minutes and seconds (\"12:20\", \"12:20:00\", "
                               "\"12 20\", \"12 20 00.0\", etc.)." );
        }
    }

    setToolTip( sTip );
    setWhatsThis( sWhatsThis );

    clear();
    EmptyFlag = false;
    setEmptyText();
}
示例#7
0
void dmsBox::setDegType( bool t ) {
	deg = t;

	if ( deg ) {
		QToolTip::add( this, i18n( "Angle value in degrees. You may enter a simple integer \nor a floating-point value, or space- or colon-delimited values \nspecifying degrees, arcminutes and arcseconds." ) );
		QWhatsThis::add( this, i18n( "Enter an angle value in degrees.  The angle can be expressed as a simple integer (\"45\") or floating-point (\"45.333\") value, or as space- or colon-delimited values specifying degrees, arcminutes and arcseconds (\"45:20\", \"45:20:00\", \"45:20\", \"45 20.0\", etc.)." ) ); 
	} else {
		QToolTip::add( this, i18n( "Angle value in hours. You may enter a simple integer \nor floating-point value, or space- or colon-delimited values \nspecifying hours, minutes and seconds." ) );
		QWhatsThis::add( this, i18n( "Enter an angle value in hours.  The angle can be expressed as a simple integer (\"12\") or floating-point (\"12.333\") value, or as space- or colon-delimited values specifying hours, minutes and seconds (\"12:20\", \"12:20:00\", \"12:20\", \"12 20.0\", etc.)." ) );
	}

	clear();
	unsetPalette();
	EmptyFlag = false;
	setEmptyText();
}
示例#8
0
TagRenamerOptions::TagRenamerOptions(const CategoryID &category)
    : m_category(category.category)
{
    // Set some defaults

    bool disabled;
    unsigned categoryNum = category.categoryNumber;

    switch(category.category) {
    case Title:
    case Artist:
    case Genre:
    case Year:
    case Album:
    case Track:
        disabled = false;
        break;
    default:
        disabled = true;
    }

    // Make sure we don't use translated strings for the config file keys.

    QString typeKey = tagTypeText(category.category, false);
    KConfigGroup config(KGlobal::config(), "FileRenamer");

    if(categoryNum > 0)
        typeKey.append(QString::number(categoryNum));

    setSuffix(config.readEntry(QString("%1Suffix").arg(typeKey), QString()));
    setPrefix(config.readEntry(QString("%1Prefix").arg(typeKey), QString()));

    // Default the emptyAction to ignoring the empty tag.

    const QString emptyAction = config.readEntry(QString("%1EmptyAction").arg(typeKey), QString()).toLower();
    setEmptyAction(IgnoreEmptyTag);

    if(emptyAction == "forceemptyinclude")
        setEmptyAction(ForceEmptyInclude);
    else if(emptyAction == "usereplacementvalue")
        setEmptyAction(UseReplacementValue);

    setEmptyText(config.readEntry(QString("%1EmptyText").arg(typeKey), QString()));
    setTrackWidth(config.readEntry(QString("%1TrackWidth").arg(typeKey), 0));
    setDisabled(config.readEntry(QString("%1Disabled").arg(typeKey), disabled));
}
bool KStreamRipper::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: browseButtonClicked(); break;
    case 1: addStreamButtonClicked(); break;
    case 2: deleteStreamButtonClicked(); break;
    case 3: tuneInButtonClicked(); break;
    case 4: ripButtonClicked(); break;
    case 5: stopRipButtonClicked(); break;
    case 6: addStreamFinished((AddNewStreamImpl*)static_QUType_ptr.get(_o+1)); break;
    case 7: readStdout(); break;
    case 8: setEmptyText(); break;
    case 9: quitButtonClicked(); break;
    case 10: aboutButtonClicked(); break;
    default:
	return KStreamRipperBase::qt_invoke( _id, _o );
    }
    return TRUE;
}
示例#10
0
文件: wicon.cpp 项目: Sheridan/HAcc
void WIcon::init()
{
    m_connected = false;
    setEmptyText(tr("--"));
}
示例#11
0
NavigationBar::NavigationBar(System const &system, Parent *parent)
  : Widget(system, parent)
  , modeChangedSignal()
  , languageChangedSignal()
  , languageItem(nullptr)
  , modeItem(nullptr)
{
  // bar & menus
  auto bar = new Bar{this};
  auto searchEdit = new LineEdit;
  auto contentsMenu = new Menu;
  auto languageMenu = new Menu;
  auto modeMenu = new Menu;
  searchEdit->setEmptyText(tr("Search"));
  bar->setResponsive(true);
  bar->addSearch(searchEdit);
  bar->addMenu(contentsMenu);
  bar->addMenu(languageMenu);
  bar->addMenu(modeMenu);


  // items
  languageItem = new Item{""};
  modeItem = new Item{""};
  Link contentsLink(Link::InternalPath, "/index");
  contentsMenu->addItem("Index", new Text(tr("Index")))->setLink(contentsLink);
  contentsMenu->itemAt(0)->setSelectable(false);
  languageMenu->addItem(languageItem);
  modeMenu->addItem(modeItem);

  // popup menus
  auto languagePopup = new PopupMenu;
  auto modePopup = new PopupMenu;
  languageItem->setMenu(languagePopup);
  modeItem->setMenu(modePopup);

  // languages
  languageItem->setText(system.languageStr());
  auto count = system.languageCount();
  for (decltype(count) i = 0; i < count; ++i) {
    auto str = system.languageStr(i);
    auto tag = system.languageTag(i);
    auto item = new Item(str);
    languagePopup->addItem(item);
    item->clicked().connect(std::bind([this](String const &tag, String const &str) {
      languageChanged().emit(tag);
      languageItem->setText(str);
    }, tag, str));
  }

  // modes
  auto guestItem = new Item{""};
  auto adminItem = new Item{""};
  modeItem->setText(tr("Guest"));
  guestItem->setText(tr("Guest"));
  adminItem->setText(tr("Admin"));
  modePopup->addItem(guestItem);
  modePopup->addItem(adminItem);
  guestItem->clicked().connect(std::bind([this]{
    modeChanged().emit(String{"guest"});
    modeItem->setText(tr("Guest"));
  }));
  adminItem->clicked().connect(std::bind([this]{
    modeChanged().emit(String{"admin"});
    modeItem->setText(tr("Admin"));
  }));

  // search
  searchEdit->enterPressed().connect(std::bind([this, searchEdit]{
    auto str = searchEdit->text().toUTF8();
    if (str.empty())
      return;

    search().emit(str);
  }));
}