[repo.or.cz] nomnom.git branch next updated: 0.1.4-28-gf941c92
Brought to you by:
legatvs
|
From: <nom...@li...> - 2011-10-18 15:30:28
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project nomnom.git.
The branch, next has been updated
via f941c926238e52a7b704187510769f8a7d91f11f (commit)
via a8910369788b3f3fd96a659e14d36f85ab3bd633 (commit)
via 1ad2eb96c188921c0fcced6eb8f108992e5d6cdb (commit)
from 4cd4e245b42ecb6544aef8fc04c2c50ff3cbdc30 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/nomnom.git/commit/f941c926238e52a7b704187510769f8a7d91f11f
commit f941c926238e52a7b704187510769f8a7d91f11f
Author: Toni Gundogdu <le...@gm...>
Date: Tue Oct 18 18:30:31 2011 +0300
Revise .desktop file
diff --git a/nomnom.desktop.in b/nomnom.desktop.in
index 99a9da5..7ad3d60 100644
--- a/nomnom.desktop.in
+++ b/nomnom.desktop.in
@@ -1,8 +1,9 @@
[Desktop Entry]
Name=NomNom
-Comment=Download media from Youtube, Dailymotion, etc.
+Comment=Download and stream media
Exec=@prefix@/bin/nomnom
Icon=nomnom.xpm
Type=Application
Terminal=false
-Categories=AudioVideo;
+Categories=Network;AudioVideo;
+Version=@VERSION@
http://repo.or.cz/w/nomnom.git/commit/a8910369788b3f3fd96a659e14d36f85ab3bd633
commit a8910369788b3f3fd96a659e14d36f85ab3bd633
Author: Toni Gundogdu <le...@gm...>
Date: Tue Oct 18 18:25:58 2011 +0300
Add email
diff --git a/src/DownloadDiag.cpp b/src/DownloadDiag.cpp
index 4453e66..eda7761 100644
--- a/src/DownloadDiag.cpp
+++ b/src/DownloadDiag.cpp
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/DownloadDiag.h b/src/DownloadDiag.h
index fa95328..c768aef 100644
--- a/src/DownloadDiag.h
+++ b/src/DownloadDiag.h
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/Media.cpp b/src/Media.cpp
index af9c269..2418ce0 100644
--- a/src/Media.cpp
+++ b/src/Media.cpp
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/Media.h b/src/Media.h
index 514debd..03e337c 100644
--- a/src/Media.h
+++ b/src/Media.h
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/ProcProgDiag.cpp b/src/ProcProgDiag.cpp
index f10c97b..21ab9d0 100644
--- a/src/ProcProgDiag.cpp
+++ b/src/ProcProgDiag.cpp
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/ProcProgDiag.h b/src/ProcProgDiag.h
index 78830a6..0cd1717 100644
--- a/src/ProcProgDiag.h
+++ b/src/ProcProgDiag.h
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/Recent.cpp b/src/Recent.cpp
index 48d8860..a4a775e 100644
--- a/src/Recent.cpp
+++ b/src/Recent.cpp
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010 Toni Gundogdu.
+ * Copyright (C) 2010 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/Recent.h b/src/Recent.h
index 8b172f5..37f971f 100644
--- a/src/Recent.h
+++ b/src/Recent.h
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010 Toni Gundogdu.
+ * Copyright (C) 2010 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/i/MainWindow.cpp b/src/i/MainWindow.cpp
index a2092b8..cc6104f 100644
--- a/src/i/MainWindow.cpp
+++ b/src/i/MainWindow.cpp
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/i/MainWindow.h b/src/i/MainWindow.h
index 4610935..7dbb135 100644
--- a/src/i/MainWindow.h
+++ b/src/i/MainWindow.h
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main.cpp b/src/main.cpp
index 062af18..d1c14e3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
/*
* NomNom
- * Copyright (C) 2010-2011 Toni Gundogdu.
+ * Copyright (C) 2010-2011 Toni Gundogdu <le...@gm...>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
http://repo.or.cz/w/nomnom.git/commit/1ad2eb96c188921c0fcced6eb8f108992e5d6cdb
commit 1ad2eb96c188921c0fcced6eb8f108992e5d6cdb
Author: Toni Gundogdu <le...@gm...>
Date: Tue Oct 18 18:04:28 2011 +0300
Add basic command line support
* Support for --config-path, --detect, --verbose, --help
* Add --enable-verbose to configure
"--config-path" prints the path to the local users's config file.
"--detect" prints the detected commands from $PATH.
"--verbose" turns on verbose program output (to stderr).
Program option "--verbose" is disabled by default and can be enabled at
compile time with "--enable-verbose". This allows us to exclude
otherwise unnecessary inclusions of QDebug header and calls to qDebug
and its friends.
diff --git a/configure.ac b/configure.ac
index 3930d77..343bb20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,13 @@ AC_FUNC_ERROR_AT_LINE
VN=`$srcdir/gen-ver.sh $srcdir`
AC_DEFINE_UNQUOTED([VN],["$VN"], [We have version number from gen-ver.sh])
+# --enable-verbose
+AC_ARG_ENABLE([verbose],
+ AS_HELP_STRING([--enable-verbose], [Enable --verbose program option]))
+
+AS_IF([test "x$enable_verbose" = "xyes"], [
+ AC_DEFINE([ENABLE_VERBOSE], [1], [Enable --verbose option])])
+
# --with-manual
AC_ARG_WITH([manual],
[AS_HELP_STRING([--with-manual],
@@ -117,6 +124,7 @@ AC_MSG_NOTICE([
options:
install prefix: ${prefix}
with manual: ${with_manual}
+ --verbose: ${enable_verbose}
qt:
lrelease: ${LRELEASE}
moc: ${MOC}
diff --git a/src/DownloadDiag.cpp b/src/DownloadDiag.cpp
index e1a4adf..4453e66 100644
--- a/src/DownloadDiag.cpp
+++ b/src/DownloadDiag.cpp
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef _0
+#include "config.h"
+
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -59,8 +61,8 @@ QString DownloadDialog::errmsg() const
void DownloadDialog::start(QStringList& args)
{
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << args;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "args=" << args;
#endif
_canceled = false;
@@ -82,8 +84,8 @@ void DownloadDialog::onCurlStarted()
void DownloadDialog::onCurlError(QProcess::ProcessError n)
{
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << n;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "code=" << n;
#endif
if (!_canceled)
{
@@ -105,9 +107,11 @@ static void update_label(QProgressDialog *d, const QString& ln)
QStringList lst = ln.split(" ");
if (lst.count() < 12)
return; // Full line updates only.
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << lst;
+
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "lst=" << lst;
#endif
+
enum {PERCENT=0, ETA=10, RATE=11};
QString rate = lst[RATE];
@@ -115,9 +119,11 @@ static void update_label(QProgressDialog *d, const QString& ln)
rate = QString("%1k").arg(rate.toLongLong()/1024.0,2,'f',1);
const QString s = QObject::tr("Copying %1/s, %2").arg(rate).arg(lst[ETA]);
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << s;
+
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "s=" << s;
#endif
+
d->setValue(lst[PERCENT].toInt());
d->setLabelText(s);
}
@@ -130,9 +136,11 @@ void DownloadDialog::onCurlReadyRead()
while (_proc.readLine(data, sizeof(data)))
{
const QString ln = QString::fromLocal8Bit(data).simplified();
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << ln;
+
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "ln=" << ln;
#endif
+
if (rx_err.indexIn(ln) != -1)
{
_errmsg = tr("Error while running command:<p>%1</p>"
diff --git a/src/Media.cpp b/src/Media.cpp
index ecdff55..af9c269 100644
--- a/src/Media.cpp
+++ b/src/Media.cpp
@@ -16,13 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QScriptValueIterator>
#include <QScriptEngine>
#include <QVariant>
#include <QString>
#include <QLabel>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -91,12 +93,12 @@ Media::fromJSON (const QString& data, QString& error)
_suffix = v.property ("file_suffix").toString ();
_link = v.property ("url").toString ();
-#ifdef _0
- qDebug ()
- << _length
- << _ctype
- << _suffix
- << _link;
+#ifdef ENABLE_VERBOSE
+ qDebug () << __PRETTY_FUNCTION__ << __LINE__ << "media="
+ << _length
+ << _ctype
+ << _suffix
+ << _link;
#endif
return true;
diff --git a/src/ProcProgDiag.cpp b/src/ProcProgDiag.cpp
index 5cbd7fe..f10c97b 100644
--- a/src/ProcProgDiag.cpp
+++ b/src/ProcProgDiag.cpp
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef _0
+#include "config.h"
+
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -68,8 +70,8 @@ QString ProcessProgressDialog::errmsg() const
void ProcessProgressDialog::start(QStringList& args)
{
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << args;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "args=" << args;
#endif
_canceled = false;
@@ -87,15 +89,15 @@ void ProcessProgressDialog::start(QStringList& args)
void ProcessProgressDialog::onProcStarted()
{
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__;
#endif
}
void ProcessProgressDialog::onProcError(QProcess::ProcessError n)
{
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << n;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "code=" << n;
#endif
if (!_canceled)
{
@@ -130,8 +132,8 @@ void ProcessProgressDialog::onProcReadyRead()
const QString ln = QString::fromLocal8Bit(data);
update_label(this, ln);
_buffer += ln;
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << ln;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "ln=" << ln;
#endif
}
}
@@ -156,8 +158,8 @@ void ProcessProgressDialog::onProcFinished(int ec, QProcess::ExitStatus es)
.arg(ec)
.arg(rx_error.cap(1).simplified());
}
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << _errmsg;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "errmsg=" << _errmsg;
#endif
emit error();
}
diff --git a/src/Recent.cpp b/src/Recent.cpp
index 3dcbe99..48d8860 100644
--- a/src/Recent.cpp
+++ b/src/Recent.cpp
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QSettings>
#include <QDebug>
diff --git a/src/about/naboutdialog.cpp b/src/about/naboutdialog.cpp
index 80ccdca..eac9e9d 100644
--- a/src/about/naboutdialog.cpp
+++ b/src/about/naboutdialog.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QDialogButtonBox>
#include <QPushButton>
#include <QGridLayout>
diff --git a/src/detect/ndetect.cpp b/src/detect/ndetect.cpp
index 162b823..28960fa 100644
--- a/src/detect/ndetect.cpp
+++ b/src/detect/ndetect.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QTextStream>
#include <QStringList>
#include <QProcess>
diff --git a/src/detect/ndetectdialog.cpp b/src/detect/ndetectdialog.cpp
index 35fd0d9..bab1ece 100644
--- a/src/detect/ndetectdialog.cpp
+++ b/src/detect/ndetectdialog.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QDialogButtonBox>
#include <QTextBrowser>
#include <QVBoxLayout>
diff --git a/src/feed/nfeed.cpp b/src/feed/nfeed.cpp
index 3738495..0bb7b0d 100644
--- a/src/feed/nfeed.cpp
+++ b/src/feed/nfeed.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QStringList>
#include <QFileInfo>
#include <QProcess>
diff --git a/src/feed/nfeeddialog.cpp b/src/feed/nfeeddialog.cpp
index bd530c2..b518657 100644
--- a/src/feed/nfeeddialog.cpp
+++ b/src/feed/nfeeddialog.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QCoreApplication>
#include <QDialogButtonBox>
#include <QMessageBox>
diff --git a/src/feed/nfeeddialog_items.cpp b/src/feed/nfeeddialog_items.cpp
index f01757a..4429d76 100644
--- a/src/feed/nfeeddialog_items.cpp
+++ b/src/feed/nfeeddialog_items.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QListWidgetItem>
#include <QListWidget>
#include <QVBoxLayout>
diff --git a/src/feed/nfeeddialog_properties.cpp b/src/feed/nfeeddialog_properties.cpp
index 3d0f024..589af6a 100644
--- a/src/feed/nfeeddialog_properties.cpp
+++ b/src/feed/nfeeddialog_properties.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QDialogButtonBox>
#include <QButtonGroup>
#include <QRadioButton>
diff --git a/src/feed/nfeedprogressdialog.cpp b/src/feed/nfeedprogressdialog.cpp
index 8971363..eca7269 100644
--- a/src/feed/nfeedprogressdialog.cpp
+++ b/src/feed/nfeedprogressdialog.cpp
@@ -15,10 +15,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QScriptValueIterator>
#include <QScriptEngine>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -49,18 +51,23 @@ NFeedProgressDialog::NFeedProgressDialog(QWidget *parent/*=NULL*/)
bool NFeedProgressDialog::open(QStringList& args)
{
setLabelText(tr("Working..."));
+
_cancelled = false;
+ _args = args;
+
_buffer.clear();
_errmsg.clear();
+
setMaximum(0);
setMinimum(0);
- _args = args;
+
show();
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << args;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "args=" << args;
#endif
_proc->start(args.takeFirst(), args);
exec();
+
return _errmsg.isEmpty();
}
diff --git a/src/i/MainWindow.cpp b/src/i/MainWindow.cpp
index a244588..a2092b8 100644
--- a/src/i/MainWindow.cpp
+++ b/src/i/MainWindow.cpp
@@ -26,7 +26,7 @@
#include <QSettings>
#include <QRegExp>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -192,8 +192,8 @@ void MainWindow::handleURL(const QString& url)
QStringList q_args = nn::to_cmd_args(s);
const QString q = q_args.first();
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << q;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "quvi_path=" << q;
#endif
if (q.isEmpty())
@@ -234,9 +234,9 @@ void MainWindow::handleURL(const QString& url)
// Query formats to an URL.
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__
- << "have_quvi_feature_query_formats:"
+ << "have_quvi_feature_query_formats="
<< have_quvi_feature_query_formats;
#endif
@@ -270,8 +270,9 @@ void MainWindow::handleURL(const QString& url)
q_args.replaceInStrings("%u", url);
q_args << "-f" << fmt;
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << q_args;
+
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "q_args=" << q_args;
#endif
proc->setLabelText(tr("Checking ..."));
@@ -306,8 +307,8 @@ bool MainWindow::queryFormats(QStringList& formats,
args.replaceInStrings("%u", url);
args << "-F";
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << args;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "args=" << args;
#endif
json.clear();
@@ -320,8 +321,8 @@ bool MainWindow::queryFormats(QStringList& formats,
if (failed)
return false;
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << failed;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "failed=" << failed;
#endif
QStringList lns = json.split("n");
@@ -336,9 +337,11 @@ bool MainWindow::queryFormats(QStringList& formats,
<< "default"
<< "best"
<< rx.cap(1).simplified().split("|");
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << formats;
+
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "formats=" << formats;
#endif
+
return true;
}
}
@@ -478,8 +481,8 @@ void MainWindow::downloadMedia()
const bool playWhenDone =
settings.value(nn::PlayWhenDoneDownloading).toBool();
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "file="
<< QFileInfo(fpath).size()
<< expected_bytes
<< completeFile
@@ -575,12 +578,12 @@ static void check_window_flags(QWidget *w)
static bool check_language(QWidget *w, const QString& lang)
{
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__
- << "lang="
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "lang="
<< lang
<< settings.value(nn::Language).toString();
#endif
+
if (lang != settings.value(nn::Language).toString())
{
if (nn::ask(w, QObject::tr("Language will be changed after "
@@ -733,9 +736,10 @@ static void update_show_state(QWidget *w)
void MainWindow::closeEvent(QCloseEvent *e)
{
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__;
#endif
+
if (settings.value(nn::TerminateInstead).toBool()
|| !systray->isVisible())
{
@@ -761,7 +765,7 @@ void MainWindow::onTerminate()
{
// When systray icon is visible: the default behaviour is to ignore
// calls to 'close' mainwindow unless "terminate instead" is true.
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__;
#endif
// Although the line below uses "settings" value "TerminateInstead",
diff --git a/src/lang/nlang.cpp b/src/lang/nlang.cpp
index 1b6038d..0281789 100644
--- a/src/lang/nlang.cpp
+++ b/src/lang/nlang.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <cstdlib>
#include <QCoreApplication>
@@ -28,7 +30,7 @@
#include <QRegExp>
#include <QDir>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -164,7 +166,7 @@ static bool load(const QString& qmFilePath)
QTranslator *t = new QTranslator;
if (t->load(qmFilePath))
{
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__ << qmFilePath;
#endif
qApp->installTranslator(t);
@@ -246,7 +248,8 @@ bool choose_dialog(QWidget *parent, QString& lang)
bool choose(const QString initial/*=""*/)
{
const QLocale l = QLocale::system();
-#ifdef _0
+
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__
<< l.language()
<< l.name()
@@ -254,16 +257,18 @@ bool choose(const QString initial/*=""*/)
<< QLocale::countryToString(l.country())
<< QLocale::languageToString(l.language());
#endif
+
foreach(const NResultPair p, qm_files())
{
if (initial.isEmpty())
{
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__
<< p.first
<< p.second
<< QLocale::languageToString(l.language());
#endif
+
if (p.first == QLocale::languageToString(l.language()))
return load(p.second);
}
diff --git a/src/main.cpp b/src/main.cpp
index d09dc2f..062af18 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,12 +18,14 @@
#include "config.h"
+#include <iostream>
+
#include <QApplication>
#include <QLibraryInfo>
#include <QTranslator>
#include <QSettings>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -67,8 +69,123 @@ static void first_run(QSettings& s)
settings.write();
}
+static bool config_path(const QSettings& s)
+{
+ std::clog << qPrintable(s.fileName()) << std::endl;
+ return true;
+}
+
+static void print_nresult(const nn::detect::NResult& r)
+{
+ std::clog << " " << qPrintable(r.first)
+ << " (v" << qPrintable(r.second.second) << ")"
+ << std::endl;
+}
+
+static void dump_nresults(const nn::DetectType n, const QString& s)
+{
+ nn::detect::NResultList l;
+ nn::detect::find(n, l);
+ std::clog << qPrintable(s) << std::endl;
+ foreach (const nn::detect::NResult r, l)
+ {
+ print_nresult(r);
+ }
+}
+
+static bool detect_cmds()
+{
+ std::clog << "Detect commands from $PATH..." << std::endl;
+ dump_nresults(MediaParser, "Media parsers:");
+ dump_nresults(MediaPlayer, "Media players:");
+ dump_nresults(FeedParser, "Feed parsers:");
+ dump_nresults(Downloader, "Downloaders:");
+}
+
+static bool version()
+{
+ std::clog << PACKAGE_VERSION << std::endl;
+}
+
+static bool help()
+{
+ const QString arg0 = QCoreApplication::arguments()[0];
+ std::clog
+ << "Usage: " << qPrintable(arg0) << " [options]n"
+ << "Options:n"
+ << " --config-path Print path to a local user config file and exitn"
+ << " --detect Print detected commands from $PATH and exitn"
+#ifdef ENABLE_VERBOSE
+ << " --verbose Turn on verbose outputn"
+#endif
+ << " --version Print version and exitn"
+ << " --help Print help and exit"
+ << std::endl;
+}
+
+#ifdef ENABLE_VERBOSE
+static bool verbose = false;
+#endif
+
+static bool parse_args(const QSettings& qs)
+{
+ QStringList args = QCoreApplication::arguments();
+ args.takeFirst();
+ foreach (const QString s, args)
+ {
+ if (s == "--config-path")
+ return config_path(qs);
+ else if (s == "--detect")
+ return detect_cmds();
+#ifdef ENABLE_VERBOSE
+ else if (s == "--verbose")
+ verbose = true;
+#endif
+ else if (s == "--version")
+ return version();
+ else if (s == "--help")
+ return help();
+ else
+ {
+ std::clog << "error: invalid option: " << qPrintable(s) << std::endl;
+ return true;
+ }
+ }
+ return false;
+}
+
+#ifdef ENABLE_VERBOSE
+static void new_msg_handler(QtMsgType t, const char *m)
+{
+ if (!verbose)
+ return;
+
+ switch (t)
+ {
+ case QtDebugMsg:
+ default:
+ std::clog << m << std::endl;
+ break;
+ case QtWarningMsg:
+ std::clog << "(w): " << m << std::endl;
+ break;
+ case QtCriticalMsg:
+ std::clog << "(c): " << m << std::endl;
+ break;
+ case QtFatalMsg:
+ std::clog << "(f): " << m << std::endl;
+ abort();
+ break;
+ }
+}
+#endif
+
int main(int argc, char *argv[])
{
+#ifdef ENABLE_VERBOSE
+ qInstallMsgHandler(new_msg_handler);
+#endif
+
QApplication app(argc, argv);
#define APPNAME "NomNom"
#define APPDOMAIN "nomnom.sourceforge.net"
@@ -81,23 +198,32 @@ int main(int argc, char *argv[])
settings.read();
+// Command line args.
+
+ QSettings s;
+
+ if (parse_args(s))
+ return 0;
+
// Qt translation.
QTranslator qtTranslator;
-#ifdef _0
+
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__
<< "qt_" + QLocale::system().name()
<< QLibraryInfo::location(QLibraryInfo::TranslationsPath);
#endif
+
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+
app.installTranslator(&qtTranslator);
// Application translation.
bool r = false;
- QSettings s;
s.beginGroup("Settings"); // settings/nsettingsmutator.cpp
if (s.contains("Language"))
r = lang::choose(s.value("Language").toString());
diff --git a/src/settings/nsettings.cpp b/src/settings/nsettings.cpp
index 7cf482b..99da9e8 100644
--- a/src/settings/nsettings.cpp
+++ b/src/settings/nsettings.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QStringList>
#include <NSettings>
@@ -83,12 +85,12 @@ static bool apply_regexp(const QString& regexp,
const QString p = cap.at(1);
const bool g = cap.at(2).contains("g");
-#ifdef _0
+#ifdef _1
const bool i = cap.at(2).contains("i");
#endif
QRegExp rx(p);
-#ifdef _0
+#ifdef _1
rx.setCaseSensitivity(i ? Qt::CaseInsensitive : Qt::CaseSensitive);
#endif
diff --git a/src/settings/nsettingsdialog.cpp b/src/settings/nsettingsdialog.cpp
index 35a6b92..10ab3a4 100644
--- a/src/settings/nsettingsdialog.cpp
+++ b/src/settings/nsettingsdialog.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QCoreApplication>
#include <QDialogButtonBox>
#include <QMessageBox>
diff --git a/src/settings/nsettingsdialog_commands.cpp b/src/settings/nsettingsdialog_commands.cpp
index d721ee8..0a4006f 100644
--- a/src/settings/nsettingsdialog_commands.cpp
+++ b/src/settings/nsettingsdialog_commands.cpp
@@ -15,13 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QLineEdit>
#include <QLabel>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -42,8 +44,8 @@ static void detect_type(const DetectType t, QComboBox *c)
foreach (const NDetectResult p, r)
{
c->addItem(p.first, p.second.first);
-#ifdef _0
- qDebug() << p;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << p;
#endif
}
}
@@ -257,9 +259,11 @@ static void _read(SettingKey comboKey,
const int n = combo->findText(a[0]);
if (n != -1)
{
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__
- << n << a[0] << a[1];
+ << n
+ << a[0]
+ << a[1];
#endif
combo->setItemData(n, a[1]);
combo->setCurrentIndex(n);
diff --git a/src/settings/nsettingsdialog_download.cpp b/src/settings/nsettingsdialog_download.cpp
index 18cee74..5548b70 100644
--- a/src/settings/nsettingsdialog_download.cpp
+++ b/src/settings/nsettingsdialog_download.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QFileDialog>
#include <QGridLayout>
#include <QVBoxLayout>
diff --git a/src/settings/nsettingsdialog_options.cpp b/src/settings/nsettingsdialog_options.cpp
index 326c7fd..24bc01b 100644
--- a/src/settings/nsettingsdialog_options.cpp
+++ b/src/settings/nsettingsdialog_options.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QVBoxLayout>
#include <QTabWidget>
diff --git a/src/settings/nsettingsdialog_options_appearance.cpp b/src/settings/nsettingsdialog_options_appearance.cpp
index c641b01..a1a5dda 100644
--- a/src/settings/nsettingsdialog_options_appearance.cpp
+++ b/src/settings/nsettingsdialog_options_appearance.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QImageReader>
#include <QVBoxLayout>
#include <QHBoxLayout>
diff --git a/src/settings/nsettingsdialog_options_behaviour.cpp b/src/settings/nsettingsdialog_options_behaviour.cpp
index 9379819..3cfd88d 100644
--- a/src/settings/nsettingsdialog_options_behaviour.cpp
+++ b/src/settings/nsettingsdialog_options_behaviour.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QVBoxLayout>
#include <QCheckBox>
diff --git a/src/settings/nsettingsdialog_options_systray.cpp b/src/settings/nsettingsdialog_options_systray.cpp
index 40f5663..6b36196 100644
--- a/src/settings/nsettingsdialog_options_systray.cpp
+++ b/src/settings/nsettingsdialog_options_systray.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QVBoxLayout>
#include <QCheckBox>
#include <QGroupBox>
diff --git a/src/settings/nsettingsdialog_proxy.cpp b/src/settings/nsettingsdialog_proxy.cpp
index 1381afd..043a9b9 100644
--- a/src/settings/nsettingsdialog_proxy.cpp
+++ b/src/settings/nsettingsdialog_proxy.cpp
@@ -25,10 +25,6 @@
#include <QSpinBox>
#include <QLabel>
-#ifdef _0
-#include <QDebug>
-#endif
-
#include <NSettingsMutator>
#include <NSettingsDialog>
diff --git a/src/settings/nsettingsmutator.cpp b/src/settings/nsettingsmutator.cpp
index 311f424..8d78b56 100644
--- a/src/settings/nsettingsmutator.cpp
+++ b/src/settings/nsettingsmutator.cpp
@@ -15,10 +15,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QStringList>
#include <QSettings>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -82,9 +84,9 @@ void NSettingsMutator::read()
SettingKey k = toKey(key);
if (k != (int)-1)
values[k] = s.value(key);
-#ifdef _0
+#ifdef ENABLE_VERBOSE
else
- qWarning() << __PRETTY_FUNCTION__ << __LINE__ << "Ignored" << key;
+ qWarning() << __PRETTY_FUNCTION__ << __LINE__ << "ignored" << key;
#endif
}
s.endGroup();
diff --git a/src/systray/nsystray.cpp b/src/systray/nsystray.cpp
index 04a5159..8180a1b 100644
--- a/src/systray/nsystray.cpp
+++ b/src/systray/nsystray.cpp
@@ -15,9 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QMenu>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -110,12 +112,11 @@ QAction *NSysTray::findTrayMenuAction(const QString& text)
if (action->text() == text)
return action;
}
-#ifdef _0
- qWarning() << __PRETTY_FUNCTION__
- << __LINE__
- << "Action"
+#ifdef ENABLE_VERBOSE
+ qWarning() << __PRETTY_FUNCTION__ << __LINE__
+ << "Action ""
<< text
- << "not found in tray menu";
+ << "" not found in tray menu";
#endif
return NULL;
}
diff --git a/src/util/nutil.cpp b/src/util/nutil.cpp
index a9b845c..4b0b1b7 100644
--- a/src/util/nutil.cpp
+++ b/src/util/nutil.cpp
@@ -21,7 +21,7 @@
#include <QMessageBox>
#include <QProcess>
-#ifdef _0
+#ifdef ENABLE_VERBOSE
#include <QDebug>
#endif
@@ -92,7 +92,8 @@ bool check_for_cmd_feature(SettingKey a,
QStringList args = QStringList()
<< to_cmd_args(q).takeFirst()
<< feature;
-#ifdef _0
+
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "args=" << args;
#endif
@@ -102,7 +103,7 @@ bool check_for_cmd_feature(SettingKey a,
if (!p->waitForFinished())
return false;
-#ifdef _0
+#ifdef ENABLE_VERBOSE
qDebug() << __PRETTY_FUNCTION__ << __LINE__
<< "exit_status=" << p->exitStatus()
<< "exit_code="<< p->exitCode();
@@ -127,8 +128,8 @@ bool check_for_cmd_feature(SettingKey a,
*/
QStringList to_cmd_args(const QString& s)
{
-#ifdef _0
- qDebug() << __PRETTY_FUNCTION__ << __LINE__ << s;
+#ifdef ENABLE_VERBOSE
+ qDebug() << __PRETTY_FUNCTION__ << __LINE__ << "parse=" << s;
#endif
// $cmd_path:$cmd_args
diff --git a/src/widgets/ntripwireedit.cpp b/src/widgets/ntripwireedit.cpp
index 980c526..0231cc2 100644
--- a/src/widgets/ntripwireedit.cpp
+++ b/src/widgets/ntripwireedit.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <QMouseEvent>
#include <QKeyEvent>
#include <QDebug>
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 8 ++
nomnom.desktop.in | 5 +-
src/DownloadDiag.cpp | 32 +++--
src/DownloadDiag.h | 2 +-
src/Media.cpp | 18 ++--
src/Media.h | 2 +-
src/ProcProgDiag.cpp | 24 ++--
src/ProcProgDiag.h | 2 +-
src/Recent.cpp | 4 +-
src/Recent.h | 2 +-
src/about/naboutdialog.cpp | 2 +
src/detect/ndetect.cpp | 2 +
src/detect/ndetectdialog.cpp | 2 +
src/feed/nfeed.cpp | 2 +
src/feed/nfeeddialog.cpp | 2 +
src/feed/nfeeddialog_items.cpp | 2 +
src/feed/nfeeddialog_properties.cpp | 2 +
src/feed/nfeedprogressdialog.cpp | 15 ++-
src/i/MainWindow.cpp | 46 ++++---
src/i/MainWindow.h | 2 +-
src/lang/nlang.cpp | 13 ++-
src/main.cpp | 134 +++++++++++++++++++-
src/settings/nsettings.cpp | 6 +-
src/settings/nsettingsdialog.cpp | 2 +
src/settings/nsettingsdialog_commands.cpp | 14 ++-
src/settings/nsettingsdialog_download.cpp | 2 +
src/settings/nsettingsdialog_options.cpp | 2 +
.../nsettingsdialog_options_appearance.cpp | 2 +
src/settings/nsettingsdialog_options_behaviour.cpp | 2 +
src/settings/nsettingsdialog_options_systray.cpp | 2 +
src/settings/nsettingsdialog_proxy.cpp | 4 -
src/settings/nsettingsmutator.cpp | 8 +-
src/systray/nsystray.cpp | 13 +-
src/util/nutil.cpp | 11 +-
src/widgets/ntripwireedit.cpp | 2 +
35 files changed, 296 insertions(+), 97 deletions(-)
repo.or.cz automatic notification. Contact project admin le...@gm...
if you want to unsubscribe, or site admin ad...@re... if you receive
no reply.
--
nomnom.git ("The graphical media download tool")
|