void SchemaDumper::dumpSchemaToFile (const QString &filename) { QString dump=dumpSchema (); QFile file (filename); try { file.open (QFile::WriteOnly); QString generatedDate=QDateTime::currentDateTime ().toUTC ().toString (Qt::ISODate); file.write (qnotr ("# This file has been autogenerated by SchemaDumper on %1 UTC.\n").arg (generatedDate).toUtf8 ()); file.write ( notr ("# It should not be modified as any changes will be overwritten.\n")); file.write ( notr ("#\n")); file.write ( notr ("# This file should be checked into version control. See the developer\n")); file.write ( notr ("# documentation (doc/internal/database.txt) for further information.\n")); file.write (dump.toUtf8 ()); file.write (notr ("\n")); file.close (); } catch (...) { file.close (); throw; } }
void GMStreamSource::configure(GMColumnList& list){ list.no(4); list[0]=GMColumn(notr("No"),HEADER_TRACK,GMStreamTrackItem::ascendingTrack,GMStreamTrackItem::descendingTrack,60,true,true,0); list[1]=GMColumn(notr("Station"),HEADER_TITLE,GMStreamTrackItem::ascendingTitle,GMStreamTrackItem::descendingTitle,200,true,true,1); list[2]=GMColumn(notr("Bit Rate"),HEADER_BITRATE,GMStreamTrackItem::ascendingTime,GMStreamTrackItem::descendingTime,80,true,true,2); list[3]=GMColumn(notr("Genre"),HEADER_TAG,GMStreamTrackItem::ascendingTrack,GMStreamTrackItem::descendingTrack,150,true,true,3); }
QString Query::colorizedString () const { QString result; AnsiColors c; result += c.blue (); QStringList words=toString ().split (notr (" "), QString::SkipEmptyParts); bool first=true; foreach (const QString &word, words) { if (!first) result+=notr (" "); first=false; if (word.toUpper ()==word) result += c.bold ().cyan(); else result += c.noBold ().blue(); result+=word; } // return qnotr ("%1%2%3") // .arg (c.bold().blue()) // .arg (toString ()) // .arg (c.reset ()) ; result += c.reset (); return result; }
Query Query::count (const QString &table, const Query &condition) { if (condition.isEmpty ()) return Query (notr ("SELECT COUNT(*) FROM %1")).arg (table); else return Query (notr ("SELECT COUNT(*) FROM %1 WHERE ")).arg (table)+condition; }
/** * Creates a longitude by parsing a string * * Supported formats: * - dd mm ss or dd° mm' ss" * - +|- dd mm ss or +|- dd° mm' ss" * - dd mm ss E|W or dd° mm' ss" E|W * * If parsing fails, an invalid Longitude is returned. * * @param string the string to parse. Leading and trailing whitespace is * ignored. * @return the parse longitude, or an invalid longitude if the parsing failed */ Longitude Longitude::parse (const QString &string) { static const Longitude invalid; QString s=string.trimmed (); if (s.isEmpty ()) return invalid; QRegExp re; // dd mm ss // dd° mm' ss" re=QRegExp (qnotrUtf8 ("^(\\d+)°?\\s+(\\d+)'?\\s+(\\d+)\"?$")); if (s.contains (re)) return parse (re, 1, 2, 3, true); // +|- d m s // +|- d° m' s" re=QRegExp (qnotrUtf8 ("^([+-])\\s*(\\d+)°?\\s+(\\d+)'?\\s+(\\d+)\"?$")); if (s.contains (re)) return parse (re, 2, 3, 4, re.cap (1)!=notr ("-")); // dd mm ss E|W // dd° mm' ss" E|W re=QRegExp (qnotrUtf8 ("^(\\d+)°?\\s+(\\d+)'?\\s+(\\d+)\"?\\s*([EW])$"), Qt::CaseInsensitive); if (s.contains (re)) return parse (re, 1, 2, 3, re.cap (4)!=notr ("W") && re.cap (4)!=notr ("w")); return invalid; }
MigratorWorker::~MigratorWorker () { thread.quit (); std::cout << notr ("Waiting for migrator worker thread to terminate...") << std::flush; if (thread.wait (1000)) std::cout << notr ("OK") << std::endl; else std::cout << notr ("Timeout") << std::endl; }
void DatabaseInfo::load (QSettings &settings) { server =settings.value (notr ("server") , notr ("localhost") ).toString (); defaultPort=settings.value (notr ("defaultPort"), true ).toBool (); port =settings.value (notr ("port") , 3306 ).toInt (); username =settings.value (notr ("username") , notr ("startkladde")).toString (); password =settings.value (notr ("password") , notr ("sk") ).toString (); database =settings.value (notr ("database") , notr ("startkladde")).toString (); }
void SchemaDumper::dumpTables (QStringList &output) { output << notr ("tables:"); QSharedPointer<Result> result=interface.executeQueryResult (notr ("SHOW TABLES")); while (result->next ()) dumpTable (output, result->value (0).toString ()); }
QString SchemaDumper::dumpSchema () { QStringList output; output << notr ("---"); dumpTables (output); dumpVersions (output); return output.join (notr ("\n")); }
// name : libellé du flag en question, le path représente le nom de fichier flag_scheme::flag_scheme(QObject *i_oParent, QString i_sPath, QString i_sName) : QObject(i_oParent) { m_oRenderer = NULL; m_sId = i_sPath; m_sName = i_sName; if (m_sName.length()>0) m_sIconPath = QString(SEMANTIK_DIR)+"/flags/"+i_sPath+notr(".svg"); else m_sIconPath = QString(SEMANTIK_DIR)+"/images/"+i_sPath+notr(".svg"); }
Query Query::valueInListCondition (const QString &column, const QList<QVariant> &values) { Query query (notr ("%1 IN (%2)")); query.arg (column); query.arg (repeatString (notr ("?"), values.size (), notr (","))); foreach (const QVariant &value, values) query.bind (value); return query; }
QString LanguageConfiguration::toString () const { switch (type) { case manualSelection: return qnotr ("manual selection: %1").arg (localeName); break; case systemLanguage : return notr ("system language"); break; case noTranslation : return notr ("no translation"); break; // No default } // Should not happen, all types should be handled above return ""; }
void LanguageConfiguration::load (QSettings &settings) { QString typeString=settings.value (notr ("type"), notr ("systemLanguage")).toString (); if (typeString==notr ("manualSelection")) { type=manualSelection; localeName=settings.value (notr ("localeName")).toString (); } else if (typeString==notr ("systemLanguage")) { type=systemLanguage; localeName=""; } else if (typeString==notr ("noTranslation")) { type=noTranslation; localeName=""; } else { std::cerr << notr ("Invalid language configuration type ") << typeString << notr (" in configuration") << std::endl; type=systemLanguage; localeName=""; } }
PersonEditorPane::PersonEditorPane (ObjectEditorWindowBase::Mode mode, Cache &cache, QWidget *parent, PersonEditorPaneData *paneData): ObjectEditorPane<Person> (mode, cache, parent), paneData (paneData) { ui.setupUi (this); ui.medicalCheckDisabledLabel->setVisible (false); setupText (); loadData (); ui.clubInput->setEditText (""); ui.checkMedicalInput->setCurrentItemByItemData (false); ui.lastNameInput->setFocus (); if (paneData) { setMedicalValidityDisplayed (paneData->displayMedicalData); } else { // Set it to false because we don't want to open a loophole, but we can // accept that we have to click the button, or even not be able to view // the medical data if the window has been opened in a specific way. setMedicalValidityDisplayed (false); std::cerr << notr ("No pane data in person editor pane") << std::endl; } }
void SimpleOperationMonitor::setProgress (int progress, int maxProgress) { if (maxProgress>=0) std::cout << (qnotr ("Progress: %1/%2 (%3%)").arg (progress).arg (maxProgress).arg (100*progress/(float)maxProgress)) << std::endl; else std::cout << notr ("Progress: ") << progress << std::endl; }
QString PlaneLog::Entry::landingTimeText () const { if (landingTime.isValid ()) return landingTime.toUTC ().toString (tr ("hh:mm 'UTC'")); else return notr ("-"); }
QVariant PlaneLog::Entry::numLandingsText () const { if (numLandings>0) return numLandings; else return notr ("-"); }
QString PlaneLog::Entry::operationTimeText () const { // Operation times >24h may be valid, so use isNull rather than isValid if (!operationTime.isNull ()) return operationTime.toString (tr ("h:mm")); else return notr ("-"); }
void SchemaDumper::dumpColumns (QStringList &output, const QString &table) { output << notr (" columns:"); Query query=Query (notr ("SHOW FULL COLUMNS FROM %1")).arg (table); QSharedPointer<Result> result=interface.executeQueryResult (query); QSqlRecord record=result->record (); // TODO: handle index not found. Also, this is backend specific and should be in Interface int nameIndex =record.indexOf (notr ("Field")); int typeIndex =record.indexOf (notr ("Type" )); int nullIndex =record.indexOf (notr ("Null" )); int keyIndex =record.indexOf (notr ("Key" )); int extraIndex=record.indexOf (notr ("Extra")); while (result->next ()) { QString name=result->value (nameIndex).toString (); QString type=result->value (typeIndex).toString (); QString null=result->value (nullIndex).toString (); QString key=result->value (keyIndex).toString (); QString extra=result->value (extraIndex).toString (); dumpColumn (output, name, type, null, key, extra); } }
Query Query::updateColumnValue (const QString &table, const QString &column, const QVariant &newValue, const QList<QVariant> &oldValues) { return Query (notr ("UPDATE %1 SET %2 = ? WHERE ")) .arg (table) .arg (column) .bind (newValue) +valueInListCondition (column, oldValues); }
void SunsetPluginSettingsPane::updateSourceLabel () { if (!fileOk) ui.sourceLabel->setText (notr ("-")); else if (source.isEmpty ()) ui.sourceLabel->setText (tr ("unknown")); else ui.sourceLabel->setText (source); }
QString PlaneLog::Entry::numPassengersString () const { if (minPassengers==maxPassengers) return QString::number (minPassengers); else if (minPassengers==1 && maxPassengers==2) return notr ("1/2"); else // Should not happen: entries for non-gliders cannot be merged return qnotr ("%1-%2").arg (minPassengers).arg (maxPassengers); }
Query &Query::condition (const Query &condition) { if (!condition.isEmpty ()) { queryString+=notr (" WHERE "); (*this)+=condition; } return *this; }
void SunsetPluginSettingsPane::on_findFileButton_clicked () { QString filename=Plugin::browse (ui.filenameInput->text (), notr (".txt"), getEffectivePluginPaths (), this); if (!filename.isEmpty ()) { ui.filenameInput->setText (filename); on_filenameInput_editingFinished (); } }
bool AcpiWidget::valid () { if(check_acpi_support() == NOT_SUPPORTED){ qDebug () << notr ("No acpi support for your system?") << endl; return false; } if (init_acpi_batt(&global_acpi) != SUCCESS && init_acpi_acadapt(&global_acpi) != SUCCESS) return false; return true; }
void SchemaDumper::dumpColumn (QStringList &output, const QString &name, const QString &type, const QString &null, const QString &key, const QString &extra) { output << qnotr (" - name: \"%1\"").arg (name); output << qnotr (" type: \"%1\"").arg (type); output << qnotr (" nullok: \"%1\"").arg (null); if (key==notr ("PRI")) output << qnotr (" primary_key: true"); if (!isBlank (extra)) output << qnotr (" extra: \"%1\"").arg (extra); }
void SunsetPluginSettingsPane::updateReferenceLongitudeLabel () { if (!fileOk) ui.referenceLongitudeLabel->setText (notr ("-")); else if (!referenceLongitudeFound) ui.referenceLongitudeLabel->setText (tr ("unknown")); else if (!referenceLongitude.isValid ()) ui.referenceLongitudeLabel->setText (tr ("invalid")); else ui.referenceLongitudeLabel->setText (referenceLongitude.format ()); }
void SchemaDumper::dumpIndexes (QStringList &output, const QString &table) { QList<IndexSpec> indexes=interface.showIndexes (table); // Don't output anything if there are no indexes if (indexes.isEmpty ()) return; output << notr (" indexes:"); foreach (const IndexSpec &index, indexes) dumpIndex (output, index); }
Query Query::selectDistinctColumns (const QStringList &tables, const QStringList &columns, bool excludeEmpty) { QStringList parts; // TODO join queries (with potential bind values) instead of strings foreach (const QString &table, tables) foreach (const QString &column, columns) parts << selectDistinctColumns (table, column, excludeEmpty).queryString; return Query (parts.join (notr (" UNION "))); }
LanguageConfiguration::LanguageConfiguration (const QVariant &value) { if ((QMetaType::Type)value.type ()==QMetaType::QString) { this->type=manualSelection; this->localeName=value.toString (); } else if ((QMetaType::Type)value.type ()==QMetaType::Int) { int type=value.toInt (); switch (type) { case systemLanguage: this->type=systemLanguage; break; case noTranslation: this->type=noTranslation; break; default: std::cerr << notr ("Invalid language choice ") << value.toString () << notr (" in LanguageConfiguration::LanguageConfiguration") << std::endl; this->type=systemLanguage; break; } } }