------------------------------------------------------------------------
+r447 | philipp | 2007-03-09 23:42:31 +0100 (Fri, 09 Mar 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/qteleschorsch.pro
+ M /teleschorsch/trunk/qteleschorsch_de.ts
+ M /teleschorsch/trunk/qteleschorsch_fr.ts
+
+Implemented --help.
+
+------------------------------------------------------------------------
+r446 | philipp | 2007-03-09 21:53:29 +0100 (Fri, 09 Mar 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+Make first row selected after starup (only a small change)
+
+------------------------------------------------------------------------
+r445 | philipp | 2007-03-09 19:42:32 +0100 (Fri, 09 Mar 2007) | 7 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/qteleschorsch_de.ts
+ M /teleschorsch/trunk/qteleschorsch_fr.ts
+ M /teleschorsch/trunk/teleschorsch.png
+ A /teleschorsch/trunk/teleschorsch.svg
+ M /teleschorsch/trunk/teleschorsch.xcf
+
+- Changed the icon. The background was created with inkscape, the fine-tuning was done with gimp.
+ The original image of Georg was dscf1950.jpg for the wedding 2006-10-07. :-)
+- Used QProcess::startDetached instead of QProcess::start so that qteleschorsch responds during playing (among other advantages)
+- Used QDir::homePath() to get the home directory instead of system variables
+- Used int row = lwChannels->row(selectedChannel); to play the selected channel (as it was before)
+ but fixed the previous error (now it is "if (row >= 0)" instead of "if (row > 0)").
+
+------------------------------------------------------------------------
+r444 | gregoa | 2007-03-09 12:15:46 +0100 (Fri, 09 Mar 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+gmplayer need -cache and not --cache
+------------------------------------------------------------------------
+r443 | gregoa | 2007-03-09 11:57:52 +0100 (Fri, 09 Mar 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+play only selected channel (selectedItems instead of currentRow) and play also the first
+------------------------------------------------------------------------
r442 | gregoa | 2007-03-09 00:35:45 +0100 (Fri, 09 Mar 2007) | 1 line
Changed paths:
M /teleschorsch/trunk/teleschorschrc
+teleschorsch (0.1.5-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregor+debian@comodo.priv.at> Sat, 10 Mar 2007 02:26:38 +0100
+
teleschorsch (0.1.4-1) unstable; urgency=low
* New upstream release.
#include <QMessageBox>
#include <QDateTime>
#include <QLocale>
+#include <QDir>
#include <QTranslator>
+
+#include <iostream> // for help output
+#include <string> // for help output
+
#include "main.h"
#include "options.h"
+
// Functions
// =========
void initConfigInfo(ConfigInfo& configInfo) {
- QStringList environment = QProcess::systemEnvironment().filter(QRegExp("^HOME=")); // ("HOME=/home/gregoa")
- if (environment.size() == 1) {
- configInfo.home = environment.at(0).mid(5);
- configInfo.userConfigFile = configInfo.home + + "/.teleschorschrc";
- }
+ configInfo.userConfigFile = QDir::homePath() + "/.teleschorschrc";
configInfo.systemConfigFile = "/etc/teleschorschrc";
// User config file
}
-void appendPlayerOffsetOption(const QString& player, QTime offset, QStringList& arguments) {
+void appendPlayerOptions(const QString& player, QTime offset, QStringList& arguments) {
QTime zero = QTime(0, 0, 0, 0);
int offsetSec = zero.secsTo(offset);
- if (player.indexOf("vlc") != -1) arguments.append("--start-time");
- if (player.indexOf("gmplayer") != -1) {
- arguments << "-cache" << "512"; // -cache 512 does not belong to this function but for now...
+ if (player.contains("vlc")) arguments.append("--start-time");
+ if (player.contains("gmplayer")) {
+ arguments << "-cache" << "512";
+ arguments << "-prefer-ipv4"; // -"- avoids IPV6 error message
arguments << "-ss";
}
arguments << QString::number(offsetSec);
}
+void showHelp() {
+ // Isn't there a way to output QStrings directly?
+ std::cout << QObject::tr("Usage: qteleschorsch [options]").toStdString() << std::endl
+ << QObject::tr("Options: --help: Shows this message at the command line and exits qteleschorsch").toStdString() << std::endl
+ << QObject::tr("More help: man qteleschorsch").toStdString() << std::endl;
+}
+
+
// MainDialog
// ==========
void MainDialog::updateLwChannels() {
+ int row = lwChannels->currentRow(); // remember selected row
lwChannels->clear();
for (int i = 0; i != channelVec.size(); ++i) lwChannels->addItem(channelVec[i].fullName);
+ if (row > lwChannels->count()) row = lwChannels->count()-1; // set to last row. if count==0, row gets -1.
+ if (row == -1 && lwChannels->count() > 0) row = 0; // set to first if nothing was selected previously.
+ if (row != -1) lwChannels->setCurrentRow(row);
}
bool MainDialog::startAction() {
- QListWidgetItem* selectedChannel = lwChannels->selectedItems().at(0);
- int row = lwChannels->row(selectedChannel);
- if (row > -1) {
+ int row = lwChannels->currentRow();
+ if (row >= 0) {
Channel channel = channelVec[row];
QDate date = calDate->selectedDate();
QString substUrl;
}
QStringList arguments;
arguments.append(substUrl);
- appendPlayerOffsetOption(channel.player, teOffset->time(), arguments);
+ appendPlayerOptions(channel.player, teOffset->time(), arguments);
QProcess player(this);
qDebug() << channel.player << arguments;
- player.start(channel.player, arguments);
- player.waitForFinished(-1);
+ player.startDetached(channel.player, arguments);
return true;
}
return false;
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
+
+ // Initialize translation
QString locale = QLocale::system().name();
QTranslator translator;
translator.load(QString(":/qteleschorsch_") + locale);
app.installTranslator(&translator);
+
+ // Parse command line options
+ if (app.arguments().size() > 1) {
+ showHelp();
+ return 0;
+ }
+
MainDialog *mainDialog = new MainDialog();
mainDialog->show();
return app.exec();
TEMPLATE = app
-# TARGET =
-# DEPENDPATH += .
-# INCLUDEPATH += .
# Input
FORMS += maindialog.ui options.ui
SOURCES += main.cpp options.cpp
TRANSLATIONS = qteleschorsch_de.ts qteleschorsch_fr.ts
RESOURCES = qteleschorsch.qrc
+CONFIG += stl
PRE_TARGETDEPS = compiler_translation_make_all
translation.output = ${QMAKE_FILE_BASE}.qm
<context>
<name>MainDialog</name>
<message>
- <location filename="main.cpp" line="262"/>
+ <location filename="main.cpp" line="273"/>
<source>Problem when reading the configuration file</source>
<translation>Die Konfigurationsdatei konnte nicht gelesen werden</translation>
</message>
<message>
- <location filename="main.cpp" line="283"/>
+ <location filename="main.cpp" line="298"/>
<source>Problem when substituting URL</source>
<translation>Problem beim Ersetzen der Parameter in der URL</translation>
</message>
<translation>TeleSchorsch</translation>
</message>
<message>
- <location filename="maindialog.ui" line="41"/>
+ <location filename="maindialog.ui" line="44"/>
<source>Channel</source>
<translation>Programm/Kanal</translation>
</message>
<message>
- <location filename="maindialog.ui" line="74"/>
+ <location filename="maindialog.ui" line="77"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
- <location filename="maindialog.ui" line="96"/>
+ <location filename="maindialog.ui" line="99"/>
<source>Offset</source>
<translation>Offset</translation>
</message>
<message>
- <location filename="maindialog.ui" line="135"/>
+ <location filename="maindialog.ui" line="138"/>
<source>Options</source>
<translation>Optionen</translation>
</message>
<message>
- <location filename="maindialog.ui" line="155"/>
+ <location filename="maindialog.ui" line="158"/>
<source>Start</source>
<translation>Start</translation>
</message>
<message>
- <location filename="maindialog.ui" line="165"/>
+ <location filename="maindialog.ui" line="168"/>
<source>Quit</source>
<translation>Beenden</translation>
</message>
<translation>TeleSchorsch Programm/Kanal-Konfiguration</translation>
</message>
<message>
- <location filename="options.ui" line="72"/>
+ <location filename="options.ui" line="75"/>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
- <location filename="options.ui" line="82"/>
+ <location filename="options.ui" line="85"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<message>
- <location filename="options.ui" line="41"/>
+ <location filename="options.ui" line="44"/>
<source>You may use the following special characters:</source>
<translation>Folgende Variablen sind erlaubt:</translation>
</message>
<context>
<name>QObject</name>
<message>
- <location filename="main.cpp" line="62"/>
+ <location filename="main.cpp" line="64"/>
<source>Could not open file %1</source>
<translation>Konnte Datei %1 nicht öffnen</translation>
</message>
<message>
- <location filename="main.cpp" line="84"/>
+ <location filename="main.cpp" line="86"/>
<source>Property %1 is only allowed in a [section].</source>
<translation>Bezeichner %1 darf nur in einer [sektion] verwendet werden.</translation>
</message>
<message>
- <location filename="main.cpp" line="89"/>
+ <location filename="main.cpp" line="91"/>
<source>Unknown key in ini file: %1</source>
<translation>Unbekannter Bezeichner in ini-Datei: %1</translation>
</message>
<message>
- <location filename="main.cpp" line="92"/>
+ <location filename="main.cpp" line="94"/>
<source>Line %1 is not valid.</source>
<translation>Zeile %1 hat eine ungültige Syntax.</translation>
</message>
<message>
- <location filename="main.cpp" line="100"/>
+ <location filename="main.cpp" line="102"/>
<source>Neither %1 nor %2 found.</source>
<translation>Weder %1 noch %2 gefunden.</translation>
</message>
<message>
- <location filename="main.cpp" line="129"/>
+ <location filename="main.cpp" line="131"/>
<source>No match for variable %1</source>
<translation>Die Variable %1 existiert nicht</translation>
</message>
<message>
- <location filename="main.cpp" line="160"/>
+ <location filename="main.cpp" line="162"/>
<source>${ not closed with }.</source>
<translation>${ wurde nicht mit } abgeschlossen.</translation>
</message>
<message>
- <location filename="main.cpp" line="187"/>
+ <location filename="main.cpp" line="189"/>
<source>Shell command executed when substituting URL (%1) timed out.</source>
<translation>Der Befehl zur Ersetzung der URL (%1) hat zu lange gebraucht (time out).</translation>
</message>
+ <message>
+ <location filename="main.cpp" line="235"/>
+ <source>Usage: qteleschorsch [options]</source>
+ <translation>Aufruf: qteleschorsch [Optionen]</translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="236"/>
+ <source>Options: --help: Shows this message at the command line and exits qteleschorsch</source>
+ <translation>Optionen: --help: Zeigt diese Meldung in der Eingabeaufforderung und beendet qteleschorsch</translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="237"/>
+ <source>More help: man qteleschorsch</source>
+ <translation>Mehr Hilfe: man qteleschorsch</translation>
+ </message>
</context>
</TS>
<context>
<name>MainDialog</name>
<message>
- <location filename="main.cpp" line="262"/>
+ <location filename="main.cpp" line="273"/>
<source>Problem when reading the configuration file</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="283"/>
+ <location filename="main.cpp" line="298"/>
<source>Problem when substituting URL</source>
<translation type="unfinished"></translation>
</message>
<translation>TeleSchorsch</translation>
</message>
<message>
- <location filename="maindialog.ui" line="41"/>
+ <location filename="maindialog.ui" line="44"/>
<source>Channel</source>
- <translation>Chaîne</translation>
+ <translation>Cha�e</translation>
</message>
<message>
- <location filename="maindialog.ui" line="74"/>
+ <location filename="maindialog.ui" line="77"/>
<source>Date</source>
<translation>Date</translation>
</message>
<message>
- <location filename="maindialog.ui" line="96"/>
+ <location filename="maindialog.ui" line="99"/>
<source>Offset</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="maindialog.ui" line="135"/>
+ <location filename="maindialog.ui" line="138"/>
<source>Options</source>
<translation>Options</translation>
</message>
<message>
- <location filename="maindialog.ui" line="155"/>
+ <location filename="maindialog.ui" line="158"/>
<source>Start</source>
<translation>Démarrer</translation>
</message>
<message>
- <location filename="maindialog.ui" line="165"/>
+ <location filename="maindialog.ui" line="168"/>
<source>Quit</source>
<translation>Terminer</translation>
</message>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="options.ui" line="72"/>
+ <location filename="options.ui" line="75"/>
<source>Save</source>
<translation>Sauvegarder</translation>
</message>
<message>
- <location filename="options.ui" line="82"/>
+ <location filename="options.ui" line="85"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
- <location filename="options.ui" line="41"/>
+ <location filename="options.ui" line="44"/>
<source>You may use the following special characters:</source>
<translation type="unfinished"></translation>
</message>
<context>
<name>QObject</name>
<message>
- <location filename="main.cpp" line="62"/>
+ <location filename="main.cpp" line="64"/>
<source>Could not open file %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="84"/>
+ <location filename="main.cpp" line="86"/>
<source>Property %1 is only allowed in a [section].</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="89"/>
+ <location filename="main.cpp" line="91"/>
<source>Unknown key in ini file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="92"/>
+ <location filename="main.cpp" line="94"/>
<source>Line %1 is not valid.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="100"/>
+ <location filename="main.cpp" line="102"/>
<source>Neither %1 nor %2 found.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="129"/>
+ <location filename="main.cpp" line="131"/>
<source>No match for variable %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="160"/>
+ <location filename="main.cpp" line="162"/>
<source>${ not closed with }.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="187"/>
+ <location filename="main.cpp" line="189"/>
<source>Shell command executed when substituting URL (%1) timed out.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <location filename="main.cpp" line="235"/>
+ <source>Usage: qteleschorsch [options]</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="236"/>
+ <source>Options: --help: Shows this message at the command line and exits qteleschorsch</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="237"/>
+ <source>More help: man qteleschorsch</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>