minor changes

- fixed name of desktop entry for renaming utility
- allow compilation without web view
- fixed window titles
- always return in eventFilter()
This commit is contained in:
Martchus 2016-03-28 20:28:59 +02:00
parent f1342ca929
commit b2a14b8260
8 changed files with 21 additions and 15 deletions

View File

@ -227,6 +227,9 @@ else()
set(WEBVIEW_PROVIDER Qt5::WebEngineWidgets) set(WEBVIEW_PROVIDER Qt5::WebEngineWidgets)
set(WEBVIEW_DEFINITION -DTAGEDITOR_USE_WEBENGINE) set(WEBVIEW_DEFINITION -DTAGEDITOR_USE_WEBENGINE)
message(STATUS "Using Qt WebEngine as webview provider.") message(STATUS "Using Qt WebEngine as webview provider.")
elseif(${WEBVIEW_PROVIDER} STREQUAL "none")
set(WEBVIEW_DEFINITION -DTAGEDITOR_NO_WEBVIEW)
message(STATUS "Webview has been disabled.")
else() else()
message(FATAL_ERROR "The specified webview provider '${WEBVIEW_PROVIDER}' is unknown.") message(FATAL_ERROR "The specified webview provider '${WEBVIEW_PROVIDER}' is unknown.")
endif() endif()

View File

@ -194,7 +194,7 @@ int main(int argc, char *argv[])
cout << "Application has not been build with Qt widgets GUI support." << endl; cout << "Application has not been build with Qt widgets GUI support." << endl;
#endif #endif
} }
} catch(Failure &ex) { } catch(const Failure &ex) {
CMD_UTILS_START_CONSOLE; CMD_UTILS_START_CONSOLE;
cout << "Unable to parse arguments. " << ex.what() << "\nSee --help for available commands." << endl; cout << "Unable to parse arguments. " << ex.what() << "\nSee --help for available commands." << endl;
} }

View File

@ -217,13 +217,13 @@ QString &mainWindowCurrentFileBrowserDirectory()
// db query // db query
bool &dbQueryWidgetShown() bool &dbQueryWidgetShown()
{ {
static bool v; static bool v = false;
return v; return v;
} }
bool &dbQueryOverride() bool &dbQueryOverride()
{ {
static bool v; static bool v = false;
return v; return v;
} }

View File

@ -40,7 +40,7 @@ QueryResultsModel::QueryResultsModel(QObject *parent) :
void QueryResultsModel::setResultsAvailable(bool resultsAvailable) void QueryResultsModel::setResultsAvailable(bool resultsAvailable)
{ {
if(m_resultsAvailable = resultsAvailable) { if((m_resultsAvailable = resultsAvailable)) {
emit this->resultsAvailable(); emit this->resultsAvailable();
} }
} }

View File

@ -324,12 +324,10 @@ void DbQueryWidget::showCoverFromIndex(const QModelIndex &index)
bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event) bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event)
{ {
if(obj = m_ui->searchGroupBox) { if(obj == m_ui->searchGroupBox) {
switch(event->type()) { switch(event->type()) {
case QEvent::KeyRelease: { case QEvent::KeyRelease:
auto *keyEvent = static_cast<QKeyEvent *>(event); switch(static_cast<QKeyEvent *>(event)->key()) {
int key = keyEvent->key();
switch(key) {
case Qt::Key_Return: case Qt::Key_Return:
startSearch(); startSearch();
break; break;
@ -337,11 +335,11 @@ bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event)
; ;
} }
break; break;
} default: default:
; ;
} }
return QWidget::eventFilter(obj, event);
} }
return QWidget::eventFilter(obj, event);
} }
} }

View File

@ -100,7 +100,7 @@
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set> <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>File sele&amp;ction</string> <string>File selection</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
@ -150,7 +150,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>&amp;MusicBrains search (beta)</string> <string>MusicBrains search (beta)</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>

View File

@ -40,7 +40,6 @@
#include <QCheckBox> #include <QCheckBox>
#include <QtConcurrent> #include <QtConcurrent>
#if defined(TAGEDITOR_NO_WEBVIEW) #if defined(TAGEDITOR_NO_WEBVIEW)
# error "not supported (yet)."
#elif defined(TAGEDITOR_USE_WEBENGINE) #elif defined(TAGEDITOR_USE_WEBENGINE)
# include <QWebEngineView> # include <QWebEngineView>
#else #else
@ -88,11 +87,13 @@ TagEditorWidget::TagEditorWidget(QWidget *parent) :
m_ui->setupUi(this); m_ui->setupUi(this);
makeHeading(m_ui->fileNameLabel); makeHeading(m_ui->fileNameLabel);
// setup web view // setup web view
#ifndef TAGEDITOR_NO_WEBVIEW
m_infoWebView = new WEB_VIEW_PROVIDER(m_ui->tagSplitter); m_infoWebView = new WEB_VIEW_PROVIDER(m_ui->tagSplitter);
m_infoWebView->setAcceptDrops(false); m_infoWebView->setAcceptDrops(false);
m_infoWebView->setContextMenuPolicy(Qt::CustomContextMenu); m_infoWebView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_infoWebView, &QWidget::customContextMenuRequested, this, &TagEditorWidget::showInfoWebViewContextMenu); connect(m_infoWebView, &QWidget::customContextMenuRequested, this, &TagEditorWidget::showInfoWebViewContextMenu);
m_ui->tagSplitter->addWidget(m_infoWebView); m_ui->tagSplitter->addWidget(m_infoWebView);
#endif
// setup file watcher // setup file watcher
m_fileWatcher = new QFileSystemWatcher(this); m_fileWatcher = new QFileSystemWatcher(this);
m_fileChangedOnDisk = false; m_fileChangedOnDisk = false;
@ -444,7 +445,9 @@ void TagEditorWidget::updateFileStatusStatus()
// visibility of m_ui->tagSelectionComboBox is set within updateTagEdits // visibility of m_ui->tagSelectionComboBox is set within updateTagEdits
m_ui->stackedWidget->setEnabled(hasTag); m_ui->stackedWidget->setEnabled(hasTag);
// webview // webview
#ifndef TAGEDITOR_NO_WEBVIEW
m_infoWebView->setEnabled(opened); m_infoWebView->setEnabled(opened);
#endif
// inform the main window about the file status change as well // inform the main window about the file status change as well
emit fileStatusChange(opened, hasTag); emit fileStatusChange(opened, hasTag);
} }
@ -545,12 +548,14 @@ void TagEditorWidget::insertTitleFromFilename()
*/ */
void TagEditorWidget::updateInfoWebView() void TagEditorWidget::updateInfoWebView()
{ {
#ifndef TAGEDITOR_NO_WEBVIEW
if(m_fileInfo.isOpen()) { if(m_fileInfo.isOpen()) {
m_fileInfoHtml = HtmlInfo::generateInfo(m_fileInfo, m_originalNotifications); m_fileInfoHtml = HtmlInfo::generateInfo(m_fileInfo, m_originalNotifications);
m_infoWebView->setContent(m_fileInfoHtml, QStringLiteral("application/xhtml+xml")); m_infoWebView->setContent(m_fileInfoHtml, QStringLiteral("application/xhtml+xml"));
} else { } else {
m_infoWebView->setUrl(QStringLiteral("about:blank")); m_infoWebView->setUrl(QStringLiteral("about:blank"));
} }
#endif
} }
/*! /*!

View File

@ -1,5 +1,5 @@
[Desktop Entry] [Desktop Entry]
Name=Tag Editor Name=Renaming utility (Tag Editor)
GenericName=Renaming utility (Tag Editor) GenericName=Renaming utility (Tag Editor)
Comment=Tool to rename files using tag information. Comment=Tool to rename files using tag information.
Exec=tageditor qt-gui --renaming-utility Exec=tageditor qt-gui --renaming-utility