Пример #1
0
void GameDescriptor::updateDesc(const char *extra) {
    const bool hasCustomLanguage = (language() != Common::UNK_LANG);
    const bool hasCustomPlatform = (platform() != Common::kPlatformUnknown);
    const bool hasExtraDesc = (extra && extra[0]);

    // Adapt the description string if custom platform/language is set.
    if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) {
        Common::String descr = description();

        descr += " (";
        if (hasExtraDesc)
            descr += extra;
        if (hasCustomPlatform) {
            if (hasExtraDesc)
                descr += "/";
            descr += Common::getPlatformDescription(platform());
        }
        if (hasCustomLanguage) {
            if (hasExtraDesc || hasCustomPlatform)
                descr += "/";
            descr += Common::getLanguageDescription(language());
        }
        descr += ")";
        setVal("description", descr);
    }
}
Пример #2
0
bool PhraseBook::save(const QString &fileName)
{
    QFile f(fileName);
    if (!f.open(QIODevice::WriteOnly))
        return false;

    m_fileName = fileName;

    QTextStream t(&f);
    t.setCodec( QTextCodec::codecForName("UTF-8") );

    t << "<!DOCTYPE QPH>\n<QPH";
    if (sourceLanguage() != QLocale::C)
        t << " sourcelanguage=\""
          << Translator::makeLanguageCode(sourceLanguage(), sourceCountry()) << '"';
    if (language() != QLocale::C)
        t << " language=\"" << Translator::makeLanguageCode(language(), country()) << '"';
    t << ">\n";
    foreach (Phrase *p, m_phrases) {
        t << "<phrase>\n";
        t << "    <source>" << protect( p->source() ) << "</source>\n";
        t << "    <target>" << protect( p->target() ) << "</target>\n";
        if (!p->definition().isEmpty())
            t << "    <definition>" << protect( p->definition() )
              << "</definition>\n";
        t << "</phrase>\n";
    }
static int
fprintRevisions(FILE *f, int modLen, SmiRevision *smiRevision,
		SmiModule *smiModule, int size)
{
    int n = 0;
    
    if (smiRevision) {
	n = fprintRevisions(f, modLen,
			    smiGetNextRevision(smiRevision), smiModule, -1);
	fprintf(f, "%-*s %7s  ", modLen, smiModule->name,
		(size >= 0) ? language(smiModule->language) : "-");
 	if (size >= 0) {
	    fprintf(f, "%4d", size);
	} else {
	    fprintf(f, "   -");
	}
	fprintf(f, "   %3d    %s\n", n, getDateString(smiRevision->date));
	n++;
    }

    if (!smiRevision && size >= 0) {
	fprintf(f, "%-*s %7s  ", modLen, smiModule->name,
		language(smiModule->language));
	fprintf(f, "%4d", size);
	fprintf(f, "     -    ----------\n");
    }
    
    return n;
}
Пример #4
0
void GameDescriptor::updateDesc(const char *extra) {
	// TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone.
	// We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or
	// the seperator (instead of '/' use ', ' or ' ').
	const bool hasCustomLanguage = (language() != Common::UNK_LANG);
	const bool hasCustomPlatform = (platform() != Common::kPlatformUnknown);
	const bool hasExtraDesc = (extra && extra[0]);

	// Adapt the description string if custom platform/language is set.
	if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) {
		Common::String descr = description();

		descr += " (";
		if (hasExtraDesc)
			descr += extra;
		if (hasCustomPlatform) {
			if (hasExtraDesc)
				descr += "/";
			descr += Common::getPlatformDescription(platform());
		}
		if (hasCustomLanguage) {
			if (hasExtraDesc || hasCustomPlatform)
				descr += "/";
			descr += Common::getLanguageDescription(language());
		}
		descr += ")";
		setVal("description", descr);
	}
}
Пример #5
0
/// Writes the changes from this font to orgfont in .lyx format in file
void Font::lyxWriteChanges(Font const & orgfont,
			      ostream & os) const
{
	os << "\n";
	if (orgfont.fontInfo().family() != bits_.family())
		os << "\\family " << LyXFamilyNames[bits_.family()] << "\n";
	if (orgfont.fontInfo().series() != bits_.series())
		os << "\\series " << LyXSeriesNames[bits_.series()] << "\n";
	if (orgfont.fontInfo().shape() != bits_.shape())
		os << "\\shape " << LyXShapeNames[bits_.shape()] << "\n";
	if (orgfont.fontInfo().size() != bits_.size())
		os << "\\size " << LyXSizeNames[bits_.size()] << "\n";
	if (orgfont.fontInfo().emph() != bits_.emph())
		os << "\\emph " << LyXMiscNames[bits_.emph()] << "\n";
	if (orgfont.fontInfo().number() != bits_.number())
		os << "\\numeric " << LyXMiscNames[bits_.number()] << "\n";
	if (orgfont.fontInfo().underbar() != bits_.underbar()) {
		// This is only for backwards compatibility
		switch (bits_.underbar()) {
		case FONT_OFF:	os << "\\bar no\n"; break;
		case FONT_ON:        os << "\\bar under\n"; break;
		case FONT_TOGGLE:	lyxerr << "Font::lyxWriteFontChanges: "
					"FONT_TOGGLE should not appear here!"
				       << endl;
		break;
		case FONT_INHERIT:   os << "\\bar default\n"; break;
		case FONT_IGNORE:    lyxerr << "Font::lyxWriteFontChanges: "
					"IGNORE should not appear here!"
				       << endl;
		break;
		}
	}
	if (orgfont.fontInfo().strikeout() != bits_.strikeout()) {
		os << "\\strikeout " << LyXMiscNames[bits_.strikeout()] << "\n";
	}
	if (orgfont.fontInfo().uuline() != bits_.uuline()) {
		os << "\\uuline " << LyXMiscNames[bits_.uuline()] << "\n";
	}
	if (orgfont.fontInfo().uwave() != bits_.uwave()) {
		os << "\\uwave " << LyXMiscNames[bits_.uwave()] << "\n";
	}
	if (orgfont.fontInfo().noun() != bits_.noun()) {
		os << "\\noun " << LyXMiscNames[bits_.noun()] << "\n";
	}
	if (orgfont.fontInfo().color() != bits_.color())
		os << "\\color " << lcolor.getLyXName(bits_.color()) << '\n';
	// FIXME: uncomment this when we support background.
	//if (orgfont.fontInfo().background() != bits_.background())
	//	os << "\\color " << lcolor.getLyXName(bits_.background()) << '\n';
	if (orgfont.language() != language() &&
	    language() != latex_language) {
		if (language())
			os << "\\lang " << language()->lang() << "\n";
		else
			os << "\\lang unknown\n";
	}
}
Пример #6
0
docstring const Font::stateText(BufferParams * params) const
{
	odocstringstream os;
	os << lyx::stateText(bits_);
	if (!params || (language() != params->language))
		os << bformat(_("Language: %1$s, "),
			      _(language()->display()));
	if (bits_.number() != FONT_OFF)
		os << "  " << bformat(_("Number %1$s"),
			      _(GUIMiscNames[bits_.number()]));
	return rtrim(os.str(), ", ");
}
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::DeepFactoryResetL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::DeepFactoryResetL()
{
    RDEBUG("CTerminalControlServer::DeepFactoryResetL");
    //
    // This code is originally copied from CRfsHandler::ActivateRfsL
    // Any changes there might also be required here.
    //
    // In case of deep level RFS, set the default language code
    // here, before RFS reboot.
    TInt language( 0 );

    // If default language is not found, we reset anyway
    if ( SysLangUtil::GetDefaultLanguage( language ) == KErrNone )
    {
        HAL::Set( HALData::ELanguageIndex, language );
    }

    // Send NVD_SET_DEFAULT_REQ here, before reboot


    RStarterSession starter;
    User::LeaveIfError( starter.Connect() );
    starter.Reset( RStarterSession::EDeepRFSReset ); // Initiates reset.
    // Actual RFS operation is initiated by Starter server while booting up.
    starter.Close();

}
Пример #8
0
    void receive() {
        if (this->verbose & 0x10) {
            LOG(LOG_INFO, "+++++++++++> ACL receive <++++++++++++++++");
        }
        try {
            this->acl_serial.incoming();

            if (!this->ini.get<cfg::context::module>().compare("RDP") ||
                !this->ini.get<cfg::context::module>().compare("VNC")) {
                this->session_type = this->ini.get<cfg::context::module>().c_str();
            }

            this->remote_answer = true;
        } catch (...) {
            // acl connection lost
            this->ini.set_acl<cfg::context::authenticated>(false);

            if (this->ini.get<cfg::context::manager_disconnect_reason>().empty()) {
                this->ini.set_acl<cfg::context::rejected>(
                    TR("manager_close_cnx", language(this->ini)));
            }
            else {
                this->ini.set_acl<cfg::context::rejected>(
                    this->ini.get<cfg::context::manager_disconnect_reason>().c_str());
                this->ini.get_ref<cfg::context::manager_disconnect_reason>().clear();
            }
        }
    }
Пример #9
0
PassRefPtr<PlatformTextTrack> TextTrack::platformTextTrack()
{
    if (m_platformTextTrack)
        return m_platformTextTrack;

    PlatformTextTrack::TrackKind platformKind = PlatformTextTrack::Caption;
    if (kind() == subtitlesKeyword())
        platformKind = PlatformTextTrack::Subtitle;
    else if (kind() == captionsKeyword())
        platformKind = PlatformTextTrack::Caption;
    else if (kind() == descriptionsKeyword())
        platformKind = PlatformTextTrack::Description;
    else if (kind() == chaptersKeyword())
        platformKind = PlatformTextTrack::Chapter;
    else if (kind() == metadataKeyword())
        platformKind = PlatformTextTrack::MetaData;
    else if (kind() == forcedKeyword())
        platformKind = PlatformTextTrack::Forced;

    PlatformTextTrack::TrackType type = PlatformTextTrack::OutOfBand;
    if (m_trackType == TrackElement)
        type = PlatformTextTrack::OutOfBand;
    else if (m_trackType == AddTrack)
        type = PlatformTextTrack::Script;
    else if (m_trackType == InBand)
        type = PlatformTextTrack::InBand;

    m_platformTextTrack = PlatformTextTrack::create(this, label(), language(), platformKind, type, uniqueId());

    return m_platformTextTrack;
}
Пример #10
0
FlatWaitMod::FlatWaitMod(
    FlatWaitModVariables vars, FrontAPI & front, uint16_t width, uint16_t height,
    Rect const widget_rect, const char * caption, const char * message, time_t now,
    ClientExecute & client_execute, bool showform, uint32_t flag
)
    : LocallyIntegrableMod(front, width, height, vars.get<cfg::font>(), client_execute, vars.get<cfg::theme>())
    , language_button(vars.get<cfg::client::keyboard_layout_proposals>().c_str(), this->wait_widget, front, front, this->font(), this->theme())
    , wait_widget(front, widget_rect.x, widget_rect.y, widget_rect.cx, widget_rect.cy, this->screen, this, caption, message, 0,
                    &this->language_button,
                    vars.get<cfg::font>(),
                    vars.get<cfg::theme>(),
                    language(vars),
                    showform, flag, vars.get<cfg::context::duration_max>()
                    )
    , vars(vars)
    , timeout(now, 600)
    , copy_paste(vars.get<cfg::debug::mod_internal>() != 0)
{
    this->screen.add_widget(&this->wait_widget);
    if (this->wait_widget.hasform) {
        this->wait_widget.set_widget_focus(&this->wait_widget.form, Widget::focus_reason_tabkey);
    }
    else {
        this->wait_widget.set_widget_focus(&this->wait_widget.goselector, Widget::focus_reason_tabkey);
    }
    this->screen.set_widget_focus(&this->wait_widget, Widget::focus_reason_tabkey);
    this->screen.rdp_input_invalidate(this->screen.get_rect());
}
Пример #11
0
    FlatWabCloseMod(FlatWabCloseModVariables vars,
                    FrontAPI & front, uint16_t width, uint16_t height, Rect const & widget_rect, time_t now,
                    bool showtimer = false, bool back_selector = false)
        : InternalMod(front, width, height, vars.get<cfg::font>(), vars.get<cfg::theme>())
        , close_widget(
            front, widget_rect.x, widget_rect.y, widget_rect.cx + 1, widget_rect.cy + 1,
            this->screen, this,
            vars.get<cfg::context::auth_error_message>().c_str(),
            (vars.is_asked<cfg::globals::auth_user>()
            || vars.is_asked<cfg::globals::target_device>()) ?
            nullptr : vars.get<cfg::globals::auth_user>().c_str(),
            (vars.is_asked<cfg::globals::auth_user>()
            || vars.is_asked<cfg::globals::target_device>()) ?
            nullptr : temporary_text(vars).text,
            showtimer,
            vars.get<cfg::font>(),
            vars.get<cfg::theme>(),
            language(vars),
            back_selector)
        , timeout(now, vars.get<cfg::globals::close_timeout>().count())
        , vars(vars)
        , showtimer(showtimer)
    {
        if (vars.get<cfg::globals::close_timeout>().count()) {
            LOG(LOG_INFO, "WabCloseMod: Ending session in %u seconds",
                static_cast<unsigned>(vars.get<cfg::globals::close_timeout>().count()));
        }
        this->front.set_palette(BGRPalette::classic_332());

        this->screen.add_widget(&this->close_widget);
        this->close_widget.set_widget_focus(&this->close_widget.cancel, Widget2::focus_reason_tabkey);
        this->screen.set_widget_focus(&this->close_widget, Widget2::focus_reason_tabkey);

        this->screen.refresh(this->screen.rect);
    }
Пример #12
0
void Initializator::createTypesNodes()
{
    spCreatorNode simple       (new CreatorNode());
    spCreatorNode account      (new TypeAccount());
    spCreatorNode language     (new TypeLanguage());
    spCreatorNode partOfSpeech (new TypePartOfSpeech());
    spCreatorNode dct          (new TypeDct());
    spCreatorNode llForDctLK   (new TypeLLForDctLK());
    spCreatorNode word         (new TypeWord());

    idtnRoot_           = base_->registerTypeNode(simple);
    idtnAccounts_       = base_->registerTypeNode(simple);
    idtnLanguages_      = base_->registerTypeNode(simple);
    idtnParts_OfSpeech_ = base_->registerTypeNode(simple);
    idtnRefLK_          = base_->registerTypeNode(simple);
    idtnRefLL_          = base_->registerTypeNode(simple);
    idtnRefPS_          = base_->registerTypeNode(simple);

    idtnAccount_        = base_->registerTypeNode(account);
    idtnLanguage_       = base_->registerTypeNode(language);
    idtnPart_OfSpeech_  = base_->registerTypeNode(partOfSpeech);
    idtnDct_            = base_->registerTypeNode(dct);
    idtnLLForDctLK_     = base_->registerTypeNode(llForDctLK);
    idtnWord_           = base_->registerTypeNode(word);
}
Пример #13
0
QVariant Channel::data(int role) const
{
    switch (role)
    {
    case DisplayRole:
        return display();
    case DecorationRole:
        return decoration();
    case NameRole:
        return name();
    case NumberRole:
        return number();
    case TypeRole:
        return type();
    case LanguageRole:
        return language();
    case UrlRole:
        return url();
    case XmltvIdRole:
        return xmltvId();
    case CategoriesRole:
        return categories();
    case LogoRole:
        return logo();
    case ProtectedRole:
        return passwordProtected();
    default:
        return QVariant();
    }
}
Element* AccessibilitySVGElement::childElementWithMatchingLanguage(ChildrenType& children) const
{
    String languageCode = language();
    if (languageCode.isEmpty())
        languageCode = defaultLanguage();

    // The best match for a group of child SVG2 'title' or 'desc' elements may be the one
    // which lacks a 'lang' attribute value. However, indexOfBestMatchingLanguageInList()
    // currently bases its decision on non-empty strings. Furthermore, we cannot count on
    // that child element having a given position. So we'll look for such an element while
    // building the language list and save it as our fallback.

    Element* fallback = nullptr;
    Vector<String> childLanguageCodes;
    Vector<Element*> elements;
    for (auto& child : children) {
        auto& lang = child.attributeWithoutSynchronization(SVGNames::langAttr);
        childLanguageCodes.append(lang);
        elements.append(&child);

        // The current draft of the SVG2 spec states if there are multiple equally-valid
        // matches, the first match should be used.
        if (lang.isEmpty() && !fallback)
            fallback = &child;
    }

    bool exactMatch;
    size_t index = indexOfBestMatchingLanguageInList(languageCode, childLanguageCodes, exactMatch);
    if (index < childLanguageCodes.size())
        return elements[index];

    return fallback;
}
Пример #15
0
    FlatSelector2Mod(FlatSelector2ModVariables vars, FrontAPI & front, uint16_t width, uint16_t height)
        : InternalMod(front, width, height, vars.get<cfg::font>(), vars.get<cfg::theme>())
        , selector(*this, temporary_login(vars).buffer, width, height, this->screen, this,
                    vars.is_asked<cfg::context::selector_current_page>()
                        ? "" : configs::make_c_str_buf(vars.get<cfg::context::selector_current_page>()).get(),
                    vars.is_asked<cfg::context::selector_number_of_pages>()
                        ? "" : configs::make_c_str_buf(vars.get<cfg::context::selector_number_of_pages>()).get(),
                   vars.get<cfg::context::selector_group_filter>().c_str(),
                   vars.get<cfg::context::selector_device_filter>().c_str(),
                   vars.get<cfg::context::selector_proto_filter>().c_str(),
                   vars.get<cfg::font>(),
                   vars.get<cfg::theme>(),
                   language(vars))
        , current_page(atoi(this->selector.current_page.get_text()))
        , number_page(atoi(this->selector.number_page.get_text()+1))
        , vars(vars)
    {
        this->selector.set_widget_focus(&this->selector.selector_lines, Widget2::focus_reason_tabkey);
        this->screen.add_widget(&this->selector);
        this->screen.set_widget_focus(&this->selector, Widget2::focus_reason_tabkey);

        uint16_t available_height = (this->selector.first_page.dy() - 10) - this->selector.selector_lines.dy();
        int w, h = 0;
        this->text_metrics(this->vars.get<cfg::font>(), "Édp", w, h);
        uint16_t line_height = h + 2 * (this->selector.selector_lines.border + this->selector.selector_lines.y_padding_label);

        this->vars.set_acl<cfg::context::selector_lines_per_page>(available_height / line_height);
        this->ask_page();
        this->selector.refresh(this->selector.rect);
    }
Пример #16
0
void PreferencesDialog::initFontOverrides() {
    QValueList<QString> lang( prefs->getStudyLanguages() );
    int i = 0;
    for( QValueList<QString>::ConstIterator it = lang.begin(); it != lang.end(); it++, i++ ) {
        QString language( *it );
        QHBox* fontOverrideBox = new QHBox( fontOverridesBox );
        fontOverrideBox->setSpacing( 2 );
        fontOverrideBox->setMargin( 2 );
        QLabel* fontOverrideLabel = new QLabel( QObject::tr( language ), fontOverrideBox );
        QComboBox* fontOverrideFamilyComboBox = new QComboBox( fontOverrideBox );
        initFontFamilyValues( fontOverrideFamilyComboBox, true );
        if( prefs->isFontOverrideFamilyDefined( language ) ) 
            selectFontFamily( fontOverrideFamilyComboBox, prefs->getFontOverrideFamily( language ) );
        QComboBox* fontOverrideSizeComboBox = new QComboBox( fontOverrideBox );
        initFontSizeValues( fontOverrideSizeComboBox, true );
        if( prefs->isFontOverrideSizeDefined( language ) ) 
            selectFontSize( fontOverrideSizeComboBox, prefs->getFontOverrideSize( language ), true );
        fontOverrideBox->setStretchFactor( fontOverrideLabel, 1 );

        fontOverrideBoxes.append( fontOverrideBox );
        fontOverrideLabels.append( fontOverrideLabel );
        fontOverrideFamilyComboBoxes.append( fontOverrideFamilyComboBox );
        fontOverrideSizeComboBoxes.append( fontOverrideSizeComboBox );

        fontOverridesBoxLayout->addWidget( fontOverrideBox, 0 );
    }
    fontOverridesBoxFiller = new QWidget( fontOverridesBox );
    fontOverridesBoxLayout->addWidget( fontOverridesBoxFiller, 1 );
}
Пример #17
0
/// Updates font settings according to request
void Font::update(Font const & newfont,
		     Language const * document_language,
		     bool toggleall)
{
	bits_.update(newfont.fontInfo(), toggleall);

	if (newfont.language() == language() && toggleall)
		if (language() == document_language)
			setLanguage(default_language);
		else
			setLanguage(document_language);
	else if (newfont.language() == reset_language)
		setLanguage(document_language);
	else if (newfont.language() != ignore_language)
		setLanguage(newfont.language());
}
Пример #18
0
bool PathAndLanguage::operator <(const PathAndLanguage &other) const
{
    if (path() < other.path())
        return true;
    if (path() > other.path())
        return false;
    if (language() == other.language())
        return false;
    bool i1 = other.language().companionLanguages().contains(language());
    bool i2 = language().companionLanguages().contains(other.language());
    if (i1 && !i2)
        return true;
    if (i2 && !i1)
        return false;
    return language() < other.language();
}
// Copy constructor with all the parameter and copy constructor for constructor with request and mimetype as parameter.
void tst_QMediaResource::copyConstructor()
{
    // Initialise all the parameters.
    const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
    const QString mimeType(QLatin1String("video/mp4"));
    const QString amrCodec(QLatin1String("amr"));
    const QString h264Codec(QLatin1String("h264"));

    const qint64 dataSize(23600);
    int audioBitRate = 1, sampleRate = 2, channelCount = 3, videoBitRate = 4;
    QSize resolution(QSize(640, 480));
    QString language("eng");

    // Create the instance with url and mimetype.
    QMediaResource original(url, mimeType);

    // Set all the parameters.
    original.setAudioCodec(amrCodec);
    original.setLanguage(QString("eng"));
    original.setVideoCodec(h264Codec);
    original.setDataSize(dataSize);
    original.setAudioBitRate(audioBitRate);
    original.setSampleRate(sampleRate);
    original.setChannelCount(channelCount);
    original.setVideoBitRate(videoBitRate);
    original.setResolution(resolution);

    // Copy the instance to new object.
    QMediaResource copy(original);

    // Verify all the parameters of the copied object.
    QCOMPARE(copy.url(), url);
    QCOMPARE(copy.mimeType(), mimeType);
    QCOMPARE(copy.audioCodec(), amrCodec);
    QCOMPARE(copy.language(), language );
    QCOMPARE(copy.videoCodec(), h264Codec);
    QCOMPARE(copy.dataSize(), dataSize);
    QCOMPARE(copy.audioBitRate(), audioBitRate);
    QCOMPARE(copy.sampleRate(), sampleRate);
    QCOMPARE(copy.channelCount(), channelCount);
    QCOMPARE(copy.videoBitRate(), videoBitRate);
    QCOMPARE(copy.resolution(), resolution);

    // Compare both the objects are equal.
    QCOMPARE(original == copy, true);
    QCOMPARE(original != copy, false);

    // Initialise the request parameter.
    QNetworkRequest request1(QUrl(QString::fromLatin1("http://test.com/test.mp4")));

    // Constructor with rerquest and mimetype.
    QMediaResource original1(request1, mimeType);

    // Copy the object and verify if both are eqaul or not.
    QMediaResource copy1(original1);
    QCOMPARE(copy1.url(), url);
    QCOMPARE(copy1.mimeType(), mimeType);
    QCOMPARE(copy1.request(), request1);
    QCOMPARE(original1 == copy1, true);
}
void Settings::applyLanguageChanged(void)
{
  QTranslator translator;
  translator.load(QString(":i18n/ngrt4n_%1").arg(language()));
  qApp->installTranslator(&translator);
  QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
}
Пример #21
0
void
Handshake::start()
{
  #ifdef WIN32
    static const char *PLATFORM = "win32";
  #elif defined Q_WS_X11
    static const char *PLATFORM = "linux";
  #elif defined Q_WS_MAC
    static const char *PLATFORM = "mac";
  #else
    static const char *PLATFORM = "unknown";
  #endif

    QString path = "/radio/handshake.php"
            "?version=" + m_version +
            "&platform=" + PLATFORM +
            "&platformversion=" + QString( QUrl::toPercentEncoding( UnicornUtils::getOSVersion() ) ) +
            "&username="******"&passwordmd5=" + m_password +
            "&language=" + language() +
            "&api_key=9d1bbaef3b443eb97973d44181d04e4b";

  #ifdef WIN32
    // this, requested by RJ
    QString player = UnicornUtils::findDefaultPlayer();
    if (player.isEmpty())
        player = "unknown";
    player.remove( ".exe", Qt::CaseInsensitive );

    path += "&player=" + QUrl::toPercentEncoding( player.replace( ' ', '_' ) );
  #endif

    get( path );
}
Пример #22
0
language
text_language (string s) {
  if (language::instances -> contains (s)) return language (s);
  if (s == "american")   return make_text_language (s, "us");
  if (s == "british")    return make_text_language (s, "ukenglish");
  if (s == "bulgarian")  return make_ucs_text_language (s, "bulgarian");
  if (s == "chinese")    return make_oriental_language (s);
  if (s == "croatian")   return make_text_language (s, "croatian");
  if (s == "czech")      return make_text_language (s, "czech");
  if (s == "danish")     return make_text_language (s, "danish");
  if (s == "dutch")      return make_text_language (s, "dutch");
  if (s == "english")    return make_text_language (s, "us");
  if (s == "finnish")    return make_text_language (s, "finnish");
  if (s == "french")     return make_text_language (s, "french");
  if (s == "german")     return make_text_language (s, "german");
  if (s == "hungarian")  return make_text_language (s, "hungarian");
  if (s == "italian")    return make_text_language (s, "italian");
  if (s == "japanese")   return make_oriental_language (s);
  if (s == "korean")     return make_oriental_language (s);
  if (s == "polish")     return make_text_language (s, "polish");
  if (s == "portuguese") return make_text_language (s, "portuguese");
  if (s == "romanian")   return make_text_language (s, "romanian");
  if (s == "russian")    return make_ucs_text_language (s, "russian");
  if (s == "slovene")    return make_text_language (s, "slovene");
  if (s == "spanish")    return make_text_language (s, "spanish");
  if (s == "swedish")    return make_text_language (s, "swedish");
  if (s == "taiwanese")  return make_oriental_language (s);
  if (s == "ukrainian")  return make_ucs_text_language (s, "ukrainian");
  if (s == "verbatim")   return tm_new<verb_language_rep> ("verbatim");
  failed_error << "The language was " << s << "\n";
  FAILED ("unknown language");
  return tm_new<verb_language_rep> ("verbatim");
}
Пример #23
0
language
ad_hoc_language (language base, tree hyphs) {
  static hashmap<tree,int> abbrevs;
  if (!abbrevs->contains (hyphs))
    abbrevs (hyphs)= N (abbrevs);
  string name= base->res_name * "-" * as_string (abbrevs [hyphs]);
  if (language::instances -> contains (name)) return language (name);
  return tm_new<ad_hoc_language_rep> (name, base, hyphs);
}
Пример #24
0
int MainWindow::languageId(const QString &languageName)
{
  Language *lang = language(languageName);

  if (lang)
    return lang->m_id;

  return 0;
}
Пример #25
0
void MisliDesktopGui::setLanguage(QString newLanguage)
{
    if(newLanguage!=language()){
        settings->setValue("language",newLanguage);
        settings->sync();

        emit languageChanged(newLanguage);
    }
}
Пример #26
0
/** Builds a resource path to an html file associated with the given help
 * topic. If the help topic needs an achor, the anchor will be formatted and
 * appended. */
QString
HelpBrowser::getResourcePath(const QDomElement &topicElement)
{
  QString link = language() + "/" + topicElement.attribute(ATTRIBUTE_TOPIC_HTML);
  if (topicElement.hasAttribute(ATTRIBUTE_TOPIC_SECTION)) {
    link += "#" + topicElement.attribute(ATTRIBUTE_TOPIC_SECTION);
  }
  return link;
}
Пример #27
0
QString Feed::debugInfo() const
{
    QString info;
    
    info += QLatin1String("# Feed begin ######################\n");

    QString dtitle = title();
    if (!dtitle.isNull())
        info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
    
    QString dlink = link();
    if (!dlink.isNull())
        info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
    
    QString ddescription = description();
    if (!ddescription.isNull())
        info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
    
    QString dcopyright = copyright();
    if (!dcopyright.isNull())
        info += QLatin1String("copyright: #") + dcopyright + QLatin1String("#\n");

    QString dlanguage = language();
    if (!dlanguage.isNull())
        info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n");
    
    QList<PersonPtr> dauthors = authors();
    QList<PersonPtr>::ConstIterator itp = dauthors.constBegin();
    QList<PersonPtr>::ConstIterator endp = dauthors.constEnd();
    
    for ( ; itp != endp; ++itp)
        info += (*itp)->debugInfo();
                
    QList<CategoryPtr> dcategories = categories();
    QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin();
    QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd();
    
    for ( ; itc != endc; ++itc)
        info += (*itc)->debugInfo();

    ImagePtr dimage = image();
     
    if (!dimage->isNull())
        info += dimage->debugInfo();
    
    QList<ItemPtr> ditems = items();
    QList<ItemPtr>::ConstIterator it = ditems.constBegin();
    QList<ItemPtr>::ConstIterator end = ditems.constEnd();
    
    for ( ; it != end; ++it)
        info += (*it)->debugInfo();

    info += QLatin1String("# Feed end ########################\n");

    return info;
}
Пример #28
0
/*
 * Check users Date of Birth, if it is ok, we calculate his age.
 */
int Test_DOB(char *DOB)
{
    int	    tyear, year, month, day;
    char    temp[40], temp1[40];

    /*
     * If Ask Date of Birth is off, assume users age is
     * zero, and this check is ok.
     */
    if (!CFG.iDOB) {
        UserAge = 0;
        return TRUE;
    }

    /*
     *  First check length of string 
     */
    if (strlen(DOB) != 10) {
	Syslog('!', "Date format length %d characters", strlen(DOB));
	/* Please enter the correct date format */
	language(YELLOW, BLACK, 83);
	return FALSE;
    }
	
    /*
     * Split the date into pieces
     */
    strcpy(temp1, DOB);
    strcpy(temp, strtok(temp1, "-"));
    day = atoi(temp);
    strcpy(temp, strtok(NULL, "-"));
    month = atoi(temp);
    strcpy(temp, strtok(NULL, ""));
    year = atoi(temp);
    tyear = l_date->tm_year + 1900;

    if (((tyear - year) < 10) || ((tyear - year) > 95)) {
	Syslog('!', "DOB: Year error: %d", tyear - year);
	return FALSE;
    }
    if ((month < 1) || (month > 12)) {
	Syslog('!', "DOB: Month error: %d", month);
	return FALSE;
    }
    if ((day < 1) || (day > 31)) {
	Syslog('!', "DOB: Day error: %d", day);
	return FALSE;
    }

    UserAge = tyear - year;
    if ((l_date->tm_mon + 1) < month)
	UserAge--;
    if (((l_date->tm_mon + 1) == month) && (l_date->tm_mday < day))
	UserAge--; 
    return TRUE;
}
Пример #29
0
void
LanguageTest::TestLanguage()
{
	BLanguage language("fr_FR");
	BString name;
	language.GetName(name);
	CPPUNIT_ASSERT_EQUAL(BString("français (France)"), name);
	CPPUNIT_ASSERT_EQUAL(BString("fr"), language.Code());
	CPPUNIT_ASSERT(language.Direction() == B_LEFT_TO_RIGHT);
}
Пример #30
0
QString MainWindowModel::textSwitchLanguage() const
{
    switch (language())
    {
        case EN_Language: return "EN";
        case RU_Language: return "RU";
        default:
            return QString("?");
    }
}