Skip to content

Commit

Permalink
NTP 1.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
Frantisek Vacek committed Jan 5, 2014
1 parent b768615 commit 6119894
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 67 deletions.
49 changes: 17 additions & 32 deletions assets/SettingsPage.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bb.cascades 1.0
import bb.system 1.0
//import bb.system 1.0

Page {
id: settingsPage
Expand All @@ -11,9 +11,7 @@ Page {
id: cancelAction
title: qsTr("Cancel")

//Connect titlebar dismiss action.
onTriggered: {
//systemToast.cancel();
done(false);
}
}
Expand All @@ -22,9 +20,7 @@ Page {
id: saveAction
title: qsTr("Save")

//Connect titlebar accet action
onTriggered: {
//systemToast.cancel();
saveSettings();
done(true);
}
Expand Down Expand Up @@ -94,6 +90,7 @@ Page {
leftPadding: 20
rightPadding: leftPadding
topPadding: 10

Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
Expand All @@ -117,21 +114,7 @@ Page {
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Label {
text: "Log debug info"
layoutProperties: StackLayoutProperties {
spaceQuota: 1.0
}
multiline: true
}
ToggleButton {
id: btLogDebugInfo
}
}
horizontalAlignment: HorizontalAlignment.Fill
Button {
//id: btSendDebugLog
text: "Send current log"
Expand All @@ -150,25 +133,27 @@ Page {
}
}

attachedObjects: [
SystemToast {
id: systemToast
}
]

function saveSettings()
{
attachedObjects: [
/*
* SystemToast {
* id: systemToast
* }
*/
]

function saveSettings() {
var settings = ApplicationUI.settings();
settings.setValue("settings/trackBar/playbackAnimation", btPlaybackAnimation.checked);
settings.setValue("settings/playBack/pausePlaybackOnPhoneCall", btPausePlaybackOnPhoneCall.checked);
settings.setValue("settings/trackMetaData/resolvingEnabled", btResolveTrackMetaData.checked);

var orig_log_info = settings.boolValue("settings/application/developerSettings/logDebugInfo");
settings.setValue("settings/application/developerSettings/logDebugInfo", btLogDebugInfo.checked);
/*
var orig_log_info = settings.boolValue("settings/application/developerSettings/logDebugInfo");
settings.setValue("settings/application/developerSettings/logDebugInfo", btLogDebugInfo.checked);
if(orig_log_info != btLogDebugInfo.checked) {
systemToast.body = qsTr("Application restart required.");
systemToast.exec();
}
*/
}

function loadSettings()
Expand All @@ -177,6 +162,6 @@ Page {
btPlaybackAnimation.checked = settings.boolValue("settings/trackBar/playbackAnimation", true);
btPausePlaybackOnPhoneCall.checked = settings.boolValue("settings/playBack/pausePlaybackOnPhoneCall", true);
btResolveTrackMetaData.checked = settings.boolValue("settings/trackMetaData/resolvingEnabled", true);
btLogDebugInfo.checked = settings.boolValue("settings/application/developerSettings/logDebugInfo", false);
//btLogDebugInfo.checked = settings.boolValue("settings/application/developerSettings/logDebugInfo", false);
}
}
4 changes: 2 additions & 2 deletions bar-descriptor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

<!-- Description, displayed in the BlackBerry 10 application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<description>Audio player using file system insteat of MP3 tags</description>
<description>The audio player using file system instead of MP3 tags</description>

<!-- Copyright information. Optional. -->
<!-- <copyright></copyright> -->
Expand All @@ -85,7 +85,7 @@
<image>icon-94.png</image>
<image>icon-114.png</image>
</icon>
<category>core.games</category>
<category>core.media</category>

<!-- The icon for the application, which should be 114x114. -->

Expand Down
6 changes: 6 additions & 0 deletions config.pri
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ device {
$$quote($$BASEDIR/src/cover.cpp) \
$$quote($$BASEDIR/src/findfile.cpp) \
$$quote($$BASEDIR/src/findfilethread.cpp) \
$$quote($$BASEDIR/src/logcollector.cpp) \
$$quote($$BASEDIR/src/main.cpp) \
$$quote($$BASEDIR/src/settings.cpp) \
$$quote($$BASEDIR/src/theapp.cpp) \
Expand All @@ -17,6 +18,7 @@ device {
$$quote($$BASEDIR/src/cover.h) \
$$quote($$BASEDIR/src/findfile.h) \
$$quote($$BASEDIR/src/findfilethread.h) \
$$quote($$BASEDIR/src/logcollector.h) \
$$quote($$BASEDIR/src/mymsghandler.h) \
$$quote($$BASEDIR/src/settings.h) \
$$quote($$BASEDIR/src/theapp.h) \
Expand All @@ -28,6 +30,7 @@ device {
$$quote($$BASEDIR/src/cover.cpp) \
$$quote($$BASEDIR/src/findfile.cpp) \
$$quote($$BASEDIR/src/findfilethread.cpp) \
$$quote($$BASEDIR/src/logcollector.cpp) \
$$quote($$BASEDIR/src/main.cpp) \
$$quote($$BASEDIR/src/settings.cpp) \
$$quote($$BASEDIR/src/theapp.cpp) \
Expand All @@ -38,6 +41,7 @@ device {
$$quote($$BASEDIR/src/cover.h) \
$$quote($$BASEDIR/src/findfile.h) \
$$quote($$BASEDIR/src/findfilethread.h) \
$$quote($$BASEDIR/src/logcollector.h) \
$$quote($$BASEDIR/src/mymsghandler.h) \
$$quote($$BASEDIR/src/settings.h) \
$$quote($$BASEDIR/src/theapp.h) \
Expand All @@ -51,6 +55,7 @@ simulator {
$$quote($$BASEDIR/src/cover.cpp) \
$$quote($$BASEDIR/src/findfile.cpp) \
$$quote($$BASEDIR/src/findfilethread.cpp) \
$$quote($$BASEDIR/src/logcollector.cpp) \
$$quote($$BASEDIR/src/main.cpp) \
$$quote($$BASEDIR/src/settings.cpp) \
$$quote($$BASEDIR/src/theapp.cpp) \
Expand All @@ -61,6 +66,7 @@ simulator {
$$quote($$BASEDIR/src/cover.h) \
$$quote($$BASEDIR/src/findfile.h) \
$$quote($$BASEDIR/src/findfilethread.h) \
$$quote($$BASEDIR/src/logcollector.h) \
$$quote($$BASEDIR/src/mymsghandler.h) \
$$quote($$BASEDIR/src/settings.h) \
$$quote($$BASEDIR/src/theapp.h) \
Expand Down
18 changes: 8 additions & 10 deletions src/applicationui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "cover.h"
#include "findfile.h"
#include "trackmetadataresolver.h"
#include "logcollector.h"

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
Expand Down Expand Up @@ -303,16 +304,13 @@ void ApplicationUI::onShareFileFinished()
void ApplicationUI::shareLogFile()
{
QString working_dir = QDir::currentPath();
QString log_file = working_dir + "/logs/log";
// make copy with txt extension
QString log_file2 = working_dir + "/tmp/log.txt";
if(QFile::copy(log_file, log_file2)) {
shareFile(log_file2, "text/plain");
//shareFile(log_file2, "text/plain", "bb.action.VIEW", "sys.wordtogo.previewer");
//ApplicationUI.shareFile(log_file_name, "text/plain", "bb.action.OPEN", "sys.dxtg.stg");
}
else {
// should never happen
QString log_file = working_dir + "/tmp/log.txt";
QFile f(log_file);
if(f.open(QFile::WriteOnly)) {
LogCollector lc;
QByteArray log = lc.collectLog();
f.write(log);
f.close();
shareFile(log_file, "text/plain");
}
}
Expand Down
41 changes: 41 additions & 0 deletions src/logcollector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* logcollector.cpp
*
* Created on: Jan 5, 2014
* Author: fvacek
*/

#include "logcollector.h"

#include <QByteArray>

LogCollector::LogCollector(QObject *parent)
: QProcess(parent)
{
// TODO Auto-generated constructor stub

}

LogCollector::~LogCollector()
{
// TODO Auto-generated destructor stub
}

QByteArray LogCollector::collectLog()
{
QByteArray ret;
do {
start("slog2info", QStringList());
if (!waitForStarted())
break;

//gzip.write("Qt rocks!");
//gzip.closeWriteChannel();

if (!waitForFinished())
break;

ret = readAll();
} while(false);
return ret;
}
25 changes: 25 additions & 0 deletions src/logcollector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* logcollector.h
*
* Created on: Jan 5, 2014
* Author: fvacek
*/

#ifndef LOGCOLLECTOR_H_
#define LOGCOLLECTOR_H_

#include <QProcess>

class QByteArray;

class LogCollector: public QProcess
{
Q_OBJECT
public:
LogCollector(QObject *parent = NULL);
virtual ~LogCollector();
public:
QByteArray collectLog();
};

#endif /* LOGCOLLECTOR_H_ */
17 changes: 4 additions & 13 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,24 @@

#include <Qt/qdeclarativedebug.h>

#include "mymsghandler.h"
//#include "mymsghandler.h"

//using namespace bb::cascades;

Q_DECL_EXPORT int main(int argc, char **argv)
{
/*
{
QString working_dir = QDir::currentPath();
QString log_file = working_dir + "/logs/log";
// make copy of recent log with txt extension
QString log_file2 = working_dir + "/tmp/log.txt";
QFile::remove(log_file2);
QFile::copy(log_file, log_file2);
}
*/
QCoreApplication::setOrganizationName("BlackBerry");
QCoreApplication::setOrganizationDomain("blackberry.com");
QCoreApplication::setApplicationName("NoTagPlayer");

Settings settings;
/*
if(settings.boolValue("settings/application/developerSettings/logDebugInfo", false)) {
qInstallMsgHandler(myMsgHandler);
}

*/
qDebug() << "==========================================================";
qWarning() << "AAAAAAAAAAAA" << QDateTime::currentDateTime().toString(Qt::ISODate);
qDebug() << "NO_TAG_PLAYER" << QDateTime::currentDateTime().toString(Qt::ISODate);
qDebug() << "==========================================================";

TheApp app(argc, argv, &settings);
Expand Down
15 changes: 5 additions & 10 deletions translations/notagplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,35 +480,30 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="23"/>
<location filename="../assets/SettingsPage.qml" line="21"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="44"/>
<location filename="../assets/SettingsPage.qml" line="40"/>
<source>Track bar settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="67"/>
<location filename="../assets/SettingsPage.qml" line="63"/>
<source>Playback settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="91"/>
<location filename="../assets/SettingsPage.qml" line="87"/>
<source>Track meta data settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="114"/>
<location filename="../assets/SettingsPage.qml" line="111"/>
<source>Developer settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="169"/>
<source>Application restart required.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TrackLabel</name>
Expand Down

0 comments on commit 6119894

Please sign in to comment.