Skip to content

Commit ec5cbc5

Browse files
committed
Uninstall now should delete the registry key if portable mode isnt active
Adding home button and reload library buttons to web home page Adding media loading status to settings modal
1 parent 694ca61 commit ec5cbc5

File tree

11 files changed

+105
-31
lines changed

11 files changed

+105
-31
lines changed

src/lib/handler/medialibraryhandler.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ bool MediaLibraryHandler::updateToolTip(LibraryListItem27 &localData)
12711271
if (localData.type != LibraryListItemType::PlaylistInternal && !scriptExists && !zipScripExists)
12721272
{
12731273
localData.metadata.toolTip = localData.nameNoExtension + "\nMedia:";
1274-
localData.metadata.toolTip = localData.path + "\nNo script file of the same name found.\nRight click and Play with chosen funscript.";
1274+
localData.metadata.toolTip = localData.path + "\nNo script file of the same name found.";
12751275
itemChanged = true;
12761276
}
12771277
else if (localData.type != LibraryListItemType::PlaylistInternal)
@@ -1581,12 +1581,14 @@ void MediaLibraryHandler::stopAllSubProcesses()
15811581
stopThumbCleanupProcess();
15821582
}
15831583

1584-
QString MediaLibraryHandler::getScreenType(QString mediaPath)
1584+
QString MediaLibraryHandler::getStereoMode(QString mediaPath)
15851585
{
15861586
if(mediaPath.contains("360", Qt::CaseSensitivity::CaseInsensitive))
15871587
return "360";
15881588
if(mediaPath.contains("180", Qt::CaseSensitivity::CaseInsensitive))
15891589
return "180";
1590+
if(mediaPath.contains("fisheye190", Qt::CaseSensitivity::CaseInsensitive))
1591+
return "fisheye190";
15901592
if(mediaPath.contains("fisheye", Qt::CaseSensitivity::CaseInsensitive))
15911593
return "fisheye";
15921594
if(mediaPath.contains("mkx200", Qt::CaseSensitivity::CaseInsensitive))
@@ -1596,7 +1598,7 @@ QString MediaLibraryHandler::getScreenType(QString mediaPath)
15961598
return "flat";
15971599
}
15981600

1599-
QString MediaLibraryHandler::getStereoMode(QString mediaPath)
1601+
QString MediaLibraryHandler::getScreenType(QString mediaPath)
16001602
{
16011603
if(mediaPath.contains(" tb", Qt::CaseSensitivity::CaseInsensitive) ||
16021604
mediaPath.contains("_tb", Qt::CaseSensitivity::CaseInsensitive) ||
@@ -1632,7 +1634,7 @@ QString MediaLibraryHandler::getStereoMode(QString mediaPath)
16321634
}
16331635

16341636
bool MediaLibraryHandler::isStereo(QString mediaPath) {
1635-
return getStereoMode(mediaPath) != "off";
1637+
return getScreenType(mediaPath) != "off" || getStereoMode(mediaPath) != "flat";
16361638
}
16371639
/***
16381640
* Searches library for the ID

src/lib/handler/settingshandler.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,14 @@ void SettingsHandler::Load(QSettings* settingsToLoadFrom)
396396
if(!settingsToLoadFrom)
397397
{
398398
QFile settingsini(_applicationDirPath + "/settings.ini");
399-
if(settingsini.exists())
399+
m_isPortable = settingsini.exists();
400+
if(m_isPortable)
400401
{
401-
settings = new QSettings("settings.ini", QSettings::Format::IniFormat);
402+
settings = new QSettings(_applicationDirPath + "/settings.ini", QSettings::Format::IniFormat);
402403
}
403404
else
404405
{
405-
settings = new QSettings("cUrbSide prOd", "XTEngine");
406+
settings = new QSettings(ORGANIZATION_NAME, APPLICATION_NAME);
406407
}
407408
settingsToLoadFrom = settings;
408409
}
@@ -975,6 +976,14 @@ void SettingsHandler::Clear()
975976
QMutexLocker locker(&mutex);
976977
_saveOnExit = false;
977978
settings->clear();
979+
settings->sync();
980+
if(!m_isPortable) {
981+
#if defined(Q_OS_WIN)
982+
QSettings("HKEY_CURRENT_USER\\SOFTWARE\\" ORGANIZATION_NAME, QSettings::NativeFormat).remove("");
983+
#elif defined(Q_OS_LINUX) || defined(Q_OS_MAC)
984+
QFile::remove(settings->fileName());
985+
#endif
986+
}
978987
settingsChangedEvent(true);
979988
}
980989

@@ -983,7 +992,7 @@ void SettingsHandler::Quit(bool restart)
983992
QStringList arguments = qApp->arguments().mid(1);
984993
QCoreApplication::quit();
985994
if(restart)
986-
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
995+
Restart();
987996
}
988997

989998
void SettingsHandler::Restart()
@@ -994,16 +1003,15 @@ void SettingsHandler::Restart()
9941003
QStringList arguments = qApp->arguments().mid(1);
9951004
QCoreApplication::quit();
9961005
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
997-
QString(qgetenv("APPIMAGE"));
9981006
#elif defined(Q_OS_LINUX)
9991007
//QString appPath = QProcessEnvironment::systemEnvironment().value(QStringLiteral("APPIMAGE"));
10001008
QString appPath = QString(qgetenv("APPIMAGE"));
10011009
if(appPath.isEmpty())
10021010
{
1003-
emit instance()->messageSend("AppPath is empty: "+appPath, XLogLevel::Information);
1011+
//emit instance()->messageSend("AppPath is empty: "+appPath, XLogLevel::Information);
10041012
appPath = qApp->arguments().first();
10051013
}
1006-
emit instance()->messageSend("Restarting: "+appPath, XLogLevel::Information);
1014+
//emit instance()->messageSend("Restarting: "+appPath, XLogLevel::Information);
10071015
QStringList arguments = qApp->arguments().mid(1);
10081016
QCoreApplication::quit();
10091017
QProcess::startDetached(appPath, arguments);
@@ -3137,6 +3145,7 @@ void SettingsHandler::setForceMetaDataFullProcessComplete()
31373145
}
31383146

31393147
QSettings* SettingsHandler::settings;
3148+
bool SettingsHandler::m_isPortable = false;
31403149
QMap<QString, QVariant> SettingsHandler::m_changedSettings;
31413150
QString SettingsHandler::_applicationDirPath;
31423151
SettingsHandler* SettingsHandler::m_instance = 0;

src/lib/handler/settingshandler.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#include "../lookup/xtags.h"
3434
#include "../struct/NetworkDeviceInfo.h"
3535

36+
#define ORGANIZATION_NAME "cUrbSide prOd"
37+
#define APPLICATION_NAME "XTEngine"
38+
3639
class XTENGINE_EXPORT SettingsHandler: public QObject
3740
{
3841
Q_OBJECT
@@ -420,6 +423,7 @@ public slots:
420423
private:
421424
SettingsHandler();
422425
~SettingsHandler();
426+
static bool m_isPortable;
423427
static QMap<QString, QVariant> m_changedSettings;
424428
static QString _applicationDirPath;
425429
static SettingsHandler* m_instance;

src/www/index-min.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/www/index-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/www/index.html

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
onclick="tcodeDeviceConnectRetry()">
2929
<img name="connectionStatusIconImage" class="buttonImage" src="://images/icons/reload.svg" />
3030
</button>
31-
<button title="TCode device pause toggle" name="devicePauseStatusButton" class="icon-button icon-button--group" onclick="togglePauseAllDeviceActions()">
31+
<button title="TCode device pause toggle" name="devicePauseStatusButton" class="icon-button icon-button--group video-control--device-state" onclick="togglePauseAllDeviceActions()">
3232
<img name="devicePauseStatusIconImage" class="buttonImage" src="://images/icons/pause.svg" />
3333
</button>
34-
<!-- <button title="Send TCode home" name="deviceHomeButton" class="icon-button icon-button--group" onclick="sendDeviceHome()">
34+
<button title="Send TCode home" name="deviceHomeButton" class="icon-button icon-button--group" onclick="sendDeviceHome()">
3535
<img name="deviceHomeButtonImage" class="buttonImage" src="://images/icons/home.svg" />
36-
</button> -->
36+
</button>
3737

3838
</div>
3939
</div>
@@ -43,8 +43,11 @@
4343
<div class="headerSection headerActionSection toolBar">
4444
<div class="toolBarGroup toolBarGroupStart">
4545
<button id="scriptStatusModalButton" title="Script status" class="script-status-button icon-button icon-button--group" onclick="toggleScriptStatusModal()">
46-
<img class="buttonImage" src="://images/icons/equalizer.svg"/ >
46+
<img class="buttonImage" src="://images/icons/equalizer.svg" />
4747
</button>
48+
<button name="refreshXTPLibraryButton" title="This will start the library loading process" class="script-status-button icon-button icon-button--group" onclick="refreshXTPLibrary()">
49+
<img class="buttonImage" src="://images/icons/reload.svg" />
50+
</button>
4851
<button title="Settings" id="settingsButton" class="icon-button icon-button--group" onclick="openSettings()">
4952
<image class="buttonImage" src="://images/icons/settings-black.png" />
5053
</button>
@@ -109,7 +112,7 @@
109112
<button data-title="Skip to moneyshot (c)" class="video-control video-control-other video-control--money-shot" id="money-shot">
110113
<img class="player-button-icon" src="://images/icons/skipToMoneyShot.svg"></img>
111114
</button>
112-
<button data-title="TCode device pause toggle" name="devicePauseStatusButton" class="video-control video-control-other video-control--device-state" onclick="togglePauseAllDeviceActions()">
115+
<button data-title="TCode device pause toggle" name="devicePauseStatusButton" class="video-control video-control-other video-control--device-state" onclick="togglePauseAllDeviceActions()">
113116
<img class="player-button-icon" name="devicePauseStatusIconImage" src="://images/icons/pause.svg" />
114117
</button>
115118
</div>
@@ -193,10 +196,10 @@
193196
<img class="buttonImage" src="://images/icons/tag.svg"/>
194197
</button>
195198
<button id="shuffleButton" title="Shuffle media play" class="shuffle-media-button icon-button" onclick="toggleShufflePlay()">
196-
<img class="buttonImage" src="://images/icons/shuffle.svg"/ >
199+
<img class="buttonImage" src="://images/icons/shuffle.svg" />
197200
</button>
198201
<button id="randomizeButton" title="Randomize media playlist" class="hidden random-media-button icon-button" onclick="sortChange('random')">
199-
<img class="buttonImage" src="://images/icons/reload.svg"/ >
202+
<img class="buttonImage" src="://images/icons/reload.svg" />
200203
</button>
201204
<input id="filterInput" class="media-filter-input hidden" placeholder="Filter" oninput="debounceFilter(this.value)" />
202205
<!-- <select id="tagFilterSelect" class="media-tag-filter-input hidden" multiple oninput="filterByTag(this.value)"></select> -->
@@ -773,13 +776,15 @@ <h4>TCode</h4>
773776
onclick="tcodeDeviceConnectRetry()">
774777
<img name="connectionStatusIconImage" class="buttonImage" src="://images/icons/reload.svg" />
775778
</button>
776-
<button title="TCode device pause\n(Click to toggle device actions)" name="devicePauseStatusButton" class="icon-button icon-button--group" onclick="togglePauseAllDeviceActions()">
779+
<button title="TCode device pause\n(Click to toggle device actions)" name="devicePauseStatusButton" class="icon-button icon-button--group video-control--device-state" onclick="togglePauseAllDeviceActions()">
777780
<img name="devicePauseStatusIconImage" class="buttonImage" src="://images/icons/pause.svg" />
778781
</button>
779782
<button title="Send TCode home" name="deviceHomeButton" class="icon-button icon-button--group" onclick="sendDeviceHome()">
780783
<img name="deviceHomeButtonImage" class="buttonImage" src="://images/icons/home.svg" />
781784
</button>
782785
<a id="tcodeDeviceSettingsLink" hidden="true" target="_blank">TCode device settings</a>
786+
<span name="mediaLoadingIcon" class="loading-spinner loading-spinner--button-icon hidden"></span>
787+
<span name="mediaLoadingStatus" class="loading-spinner--button-icon-label hidden">Loading...</span>
783788
</div>
784789
<div class="modal-footer-content">
785790
<span id="mediaReloadRequired" class="hidden">Full metadata process required AFTER save</span>
@@ -792,7 +797,7 @@ <h4>TCode</h4>
792797
<button id="restartXTPButton" title="This will restart XTP" onclick="restartXTP()">
793798
Restart XTP
794799
</button>
795-
<button id="restartXTPButton" title="This will start the library loading process" onclick="refreshXTPLibrary()">
800+
<button name="refreshXTPLibraryButton" title="This will start the library loading process" onclick="refreshXTPLibrary()">
796801
Refresh library
797802
</button>
798803
<button id="saveToXTPButton" disabled="true"

src/www/index.js

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,7 @@ function wsCallBackFunction(evt) {
457457
setInputConnectionStatus(deviceName, status["status"], status["message"]);
458458
break;
459459
case "mediaLoaded":
460-
var mediaLoadingElement = document.getElementById("mediaLoading");
461-
mediaLoadingElement.style.display = "none"
462-
mediaLoading = false;
463-
getServerLibrary();
460+
onMediaLoaded();
464461
break;
465462
case "mediaLoading":
466463
setMediaLoading();
@@ -584,12 +581,56 @@ function setMediaLoading() {
584581
var mediaLoadingElement = document.getElementById("mediaLoading");
585582
mediaLoadingElement.style.display = "flex"
586583
var noMediaElement = document.getElementById("noMedia");
584+
var mediaLoadingElements = document.getElementsByName("mediaLoadingIcon");
585+
for (let index = 0; index < mediaLoadingElements.length; index++) {
586+
const element = mediaLoadingElements[index];
587+
element.classList.remove("hidden");
588+
}
587589
noMediaElement.hidden = true;
590+
var refreshMediaLibraryButtons = document.getElementsByName("refreshXTPLibraryButton");
591+
for (let index = 0; index < refreshMediaLibraryButtons.length; index++) {
592+
const element = refreshMediaLibraryButtons[index];
593+
element.disabled = true;
594+
}
595+
var mediaLoadingStatusElementa = document.getElementsByName("mediaLoadingStatus");
596+
for (let index = 0; index < mediaLoadingStatusElementa.length; index++) {
597+
const element = mediaLoadingStatusElementa[index];
598+
element.innerText = "";
599+
element.classList.remove("hidden");
600+
}
601+
}
602+
603+
function onMediaLoaded() {
604+
var mediaLoadingElement = document.getElementById("mediaLoading");
605+
mediaLoadingElement.style.display = "none"
606+
mediaLoading = false;
607+
var mediaLoadingElements = document.getElementsByName("mediaLoadingIcon");
608+
for (let index = 0; index < mediaLoadingElements.length; index++) {
609+
const element = mediaLoadingElements[index];
610+
element.classList.add("hidden");
611+
}
612+
var refreshMediaLibraryButtons = document.getElementsByName("refreshXTPLibraryButton");
613+
for (let index = 0; index < refreshMediaLibraryButtons.length; index++) {
614+
const element = refreshMediaLibraryButtons[index];
615+
element.disabled = false;
616+
}
617+
var mediaLoadingStatusElementa = document.getElementsByName("mediaLoadingStatus");
618+
for (let index = 0; index < mediaLoadingStatusElementa.length; index++) {
619+
const element = mediaLoadingStatusElementa[index];
620+
element.innerText = "";
621+
element.classList.add("hidden");
622+
}
623+
getServerLibrary();
588624
}
589625

590626
function setMediaLoadingStatus(status) {
591627
var mediaLoadingElement = document.getElementById("loadingStatus");
592628
mediaLoadingElement.innerText = status;
629+
var mediaLoadingStatusElementa = document.getElementsByName("mediaLoadingStatus");
630+
for (let index = 0; index < mediaLoadingStatusElementa.length; index++) {
631+
const element = mediaLoadingStatusElementa[index];
632+
element.innerText = status;
633+
}
593634
}
594635

595636
function onResizeVideo() {
@@ -1174,15 +1215,17 @@ function setDevicePauseStatus(isPaused)
11741215
for (var i = 0; i < devicePauseStatusIconButtonNodes.length; i++) {
11751216
var devicePauseStatusIconButtonNode = devicePauseStatusIconButtonNodes[i];
11761217
var devicePauseStatusIconButtonImageNode = devicePauseStatusIconButtonImageNodes[i];
1218+
devicePauseStatusIconButtonNode.title = "TCode device pause toggle.\nDevice status: ";
11771219

1178-
devicePauseStatusIconButtonNode.title = "Device status: " + isPaused ? "paused" : "not paused";
11791220
if(isPaused)
11801221
{
1222+
devicePauseStatusIconButtonNode.title += "paused";
11811223
devicePauseStatusIconButtonNode.classList.add("video-control--device-state-paused");
11821224
devicePauseStatusIconButtonImageNode.setAttribute("src", "://images/icons/play.svg");
11831225
}
11841226
else
11851227
{
1228+
devicePauseStatusIconButtonNode.title += "not paused";
11861229
devicePauseStatusIconButtonNode.classList.remove("video-control--device-state-paused");
11871230
devicePauseStatusIconButtonImageNode.setAttribute("src", "://images/icons/pause.svg");
11881231
}

0 commit comments

Comments
 (0)