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_DEFINITION -DTAGEDITOR_USE_WEBENGINE)
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()
message(FATAL_ERROR "The specified webview provider '${WEBVIEW_PROVIDER}' is unknown.")
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;
#endif
}
} catch(Failure &ex) {
} catch(const Failure &ex) {
CMD_UTILS_START_CONSOLE;
cout << "Unable to parse arguments. " << ex.what() << "\nSee --help for available commands." << endl;
}

View File

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

View File

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

View File

@ -324,12 +324,10 @@ void DbQueryWidget::showCoverFromIndex(const QModelIndex &index)
bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event)
{
if(obj = m_ui->searchGroupBox) {
if(obj == m_ui->searchGroupBox) {
switch(event->type()) {
case QEvent::KeyRelease: {
auto *keyEvent = static_cast<QKeyEvent *>(event);
int key = keyEvent->key();
switch(key) {
case QEvent::KeyRelease:
switch(static_cast<QKeyEvent *>(event)->key()) {
case Qt::Key_Return:
startSearch();
break;
@ -337,11 +335,11 @@ bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event)
;
}
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>
</property>
<property name="windowTitle">
<string>File sele&amp;ction</string>
<string>File selection</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
@ -150,7 +150,7 @@
<bool>false</bool>
</property>
<property name="windowTitle">
<string>&amp;MusicBrains search (beta)</string>
<string>MusicBrains search (beta)</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>

View File

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

View File

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