예제 #1
0
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;
	}
}
예제 #2
0
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);
  }
예제 #3
0
파일: Query.cpp 프로젝트: fb/startkladde
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;
}
예제 #4
0
파일: Query.cpp 프로젝트: fb/startkladde
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;
}
예제 #5
0
/**
 * 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;
}
예제 #6
0
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;
}
예제 #7
0
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 ();
}
예제 #8
0
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 ());
}
예제 #9
0
QString SchemaDumper::dumpSchema ()
{
	QStringList output;

	output << notr ("---");

	dumpTables (output);
	dumpVersions (output);

	return output.join (notr ("\n"));
}
예제 #10
0
// 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");
}
예제 #11
0
파일: Query.cpp 프로젝트: fb/startkladde
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;
}
예제 #12
0
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 "";
}
예제 #13
0
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="";
	}
}
예제 #14
0
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;
	}
}
예제 #15
0
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;
}
예제 #16
0
QString PlaneLog::Entry::landingTimeText () const
{
	if (landingTime.isValid ())
		return landingTime.toUTC ().toString (tr ("hh:mm 'UTC'"));
	else
		return notr ("-");
}
예제 #17
0
QVariant PlaneLog::Entry::numLandingsText () const
{
	if (numLandings>0)
		return numLandings;
	else
		return notr ("-");
}
예제 #18
0
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 ("-");
}
예제 #19
0
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);
	}
}
예제 #20
0
파일: Query.cpp 프로젝트: fb/startkladde
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);
}
예제 #21
0
void SunsetPluginSettingsPane::updateSourceLabel ()
{
	if (!fileOk)
		ui.sourceLabel->setText (notr ("-"));
	else if (source.isEmpty ())
		ui.sourceLabel->setText (tr ("unknown"));
	else
		ui.sourceLabel->setText (source);
}
예제 #22
0
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);
}
예제 #23
0
파일: Query.cpp 프로젝트: fb/startkladde
Query &Query::condition (const Query &condition)
{
	if (!condition.isEmpty ())
	{
		queryString+=notr (" WHERE ");
		(*this)+=condition;
	}

	return *this;
}
예제 #24
0
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 ();
	}
}
예제 #25
0
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;
}
예제 #26
0
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);
}
예제 #27
0
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 ());
}
예제 #28
0
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);
}
예제 #29
0
파일: Query.cpp 프로젝트: fb/startkladde
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 ")));
}
예제 #30
0
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;
		}
	}
}