summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configurationdialog.cpp28
-rw-r--r--configurationdialog.h3
-rw-r--r--helper.h2
-rw-r--r--hoverwindow.cpp138
-rw-r--r--hoverwindow.h38
-rw-r--r--shemov.pro2
-rw-r--r--smglobals.cpp14
7 files changed, 1 insertions, 224 deletions
diff --git a/configurationdialog.cpp b/configurationdialog.cpp
index ce957bc..0fabe2f 100644
--- a/configurationdialog.cpp
+++ b/configurationdialog.cpp
@@ -92,27 +92,6 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : S
QVBoxLayout *miscLayout = new QVBoxLayout;
miscLayout->setAlignment(Qt::AlignTop);
- //misc - hover
- QGroupBox *hoverBox = new QGroupBox(tr("Hover options"));
- QVBoxLayout *hoverLayout = new QVBoxLayout;
- mHoverPics = new QCheckBox(tr("Show picture when hovering"));
- hoverLayout->addWidget(mHoverPics);
- mHoverOpacity = new QSpinBox;
- mHoverOpacity->setMinimum(1);
- mHoverOpacity->setMaximum(10);
- QGridLayout *miscInputGrid = new QGridLayout;
- QLabel *miscl6 = new QLabel(tr("Opacity of hover window"));
- miscInputGrid->addWidget(miscl6, 0, 0);
- miscInputGrid->addWidget(mHoverOpacity, 0, 1);
- QLabel *miscl8 = new QLabel(tr("Y cursor offset (hover)"));
- mCursorOffset = new QSpinBox;
- mCursorOffset->setMinimum(-100);
- mCursorOffset->setMaximum(100);
- miscInputGrid->addWidget(miscl8, 2, 0);
- miscInputGrid->addWidget(mCursorOffset, 2, 1);
- hoverLayout->addLayout(miscInputGrid);
- hoverBox->setLayout(hoverLayout);
-
//misc - archiving movies
QGroupBox *archiveBox = new QGroupBox(tr("Archiving options"));
QVBoxLayout *archiveLayout = new QVBoxLayout;
@@ -148,7 +127,6 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : S
clearWizardBox->setLayout(clearWizardLayout);
//misc - assemble
- miscLayout->addWidget(hoverBox);
miscLayout->addWidget(archiveBox);
miscLayout->addWidget(autoRefreshBox);
miscLayout->addWidget(clearWizardBox);
@@ -450,11 +428,8 @@ void ConfigurationDialog::readSettings(){
mIconForMeta->setCurrentIndex(pos);
// read misc
- mHoverPics->setChecked(s.value("ui/hoverpics", false).toBool());
- mHoverOpacity->setValue(s.value("ui/hoveropacity", 10).toInt());
mAutoAddCovers->setChecked(s.value("ui/autoaddcovers", false).toBool());
mIconizeCovers->setChecked(s.value("ui/iconizecovers", false).toBool());
- mCursorOffset->setValue(s.value("ui/cursoroffset", SmGlobals::instance()->cursorSize().height()).toInt());
mAutoRefresh->setChecked(s.value("ui/autorefresh", false).toBool());
mAutoRefreshValue->setValue(s.value("ui/autorefreshvalue", 5).toInt());
mClearNewMovieWizard->setChecked(s.value("ui/clearnewmoviewizard", false).toBool());
@@ -542,11 +517,8 @@ void ConfigurationDialog::writeSettings(){
s.setValue("ui/metaicon", mIconForMeta->currentText());
//write misc
- s.setValue("ui/hoverpics", (mHoverPics->checkState() == Qt::Checked));
- s.setValue("ui/hoveropacity", mHoverOpacity->value());
s.setValue("ui/autoaddcovers", (mAutoAddCovers->checkState() == Qt::Checked));
s.setValue("ui/iconizecovers", (mIconizeCovers->checkState() == Qt::Checked));
- s.setValue("ui/cursoroffset", mCursorOffset->value());
s.setValue("ui/autorefresh", (mAutoRefresh->checkState() == Qt::Checked));
s.setValue("ui/autorefreshvalue", mAutoRefreshValue->value());
s.setValue("ui/clearnewmoviewizard", (mClearNewMovieWizard->checkState() == Qt::Checked));
diff --git a/configurationdialog.h b/configurationdialog.h
index d3f5463..8a76051 100644
--- a/configurationdialog.h
+++ b/configurationdialog.h
@@ -72,14 +72,11 @@ class ConfigurationDialog : public SmDialog {
QComboBox *mInfoBox;
QComboBox *mMapBox;
QComboBox *mReasonsBox;
- QCheckBox *mHoverPics;
QCheckBox *mAutoAddCovers;
QCheckBox *mIconizeCovers;
QCheckBox *mAutoRefresh;
QCheckBox *mExpensive;
QCheckBox *mClearNewMovieWizard;
- QSpinBox *mHoverOpacity;
- QSpinBox *mCursorOffset;
QSpinBox *mAutoRefreshValue;
QLabel *mClipboardColor;
QLabel *mBaseColor;
diff --git a/helper.h b/helper.h
index fee3324..7de061f 100644
--- a/helper.h
+++ b/helper.h
@@ -25,7 +25,7 @@
#define MAGICKCORE_HDRI_ENABLE 1
#endif
-#include <ImageMagick-6/Magick++.h>
+#include <ImageMagick-7/Magick++.h>
class QString;
class QFileInfo;
diff --git a/hoverwindow.cpp b/hoverwindow.cpp
deleted file mode 100644
index 101265c..0000000
--- a/hoverwindow.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- 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 the Free Software Foundation; either version
- 2 of the License, or (at your option) any later version.
-*/
-
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QDesktopWidget>
-#include <QSize>
-#include <QTextDocument>
-#include <QSettings>
-#include <QPixmap>
-#include <QImage>
-#include <QPainter>
-#include <QFontMetrics>
-#include <QBrush>
-#include <QPen>
-#include <QColor>
-#include <QApplication>
-#include <QStaticText>
-#include <QScreen>
-
-#include "hoverwindow.h"
-#include "smglobals.h"
-
-HoverWindow::HoverWindow(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), mAlignCenter(false), mDesktopHeight(-1){
- setVisible(false);
- QSettings s;
- int opacity = s.value("ui/hoveropacity", 7).toInt();
- setWindowOpacity(opacity / 10.0);
- setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
- setStyleSheet("QLabel { background-color: #D6A583; color: black; border-width: 2px; border-style: solid; padding: 4px; }");
- mDesktopHeight = qApp->screens().at(0)->availableGeometry().height();
- QSize curSize = SmGlobals::instance()->cursorSize();
- setHoverOffset(QPoint(curSize.width() + 30, 0));
- mMainLayout = new QHBoxLayout;
- mMainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
- mMainLayout->setContentsMargins(4, 4, 4, 4);
- mLabel = new QLabel;
- mMainLayout->addWidget(mLabel);
- setLayout(mMainLayout);
-}
-
-void HoverWindow::setContent(const QString &parent, const QStringList &children){
- mAlignCenter = false;
- QString curText = QString("<p style=\"align: center; text-decoration: underline; font-weight: bold; margin-bottom: 0;\">%1</p>").arg(parent);
- curText.append("<ul style=\"margin-left: -25; margin-top: 0px;\">");
- int count = qMin(6, children.size());
- int i = 0;
- for(i = 0; i < count; ++i){
- curText.append(QString("<li>%1</li>").arg(children.at(i)));
- }
- if(i < children.count()){
- curText.append("<li>...</li>");
- }
- curText.append("</ul>");
- QTextDocument doc;
- doc.setHtml(curText);
- mLabel->setText(curText);
- setMinimumSize(doc.size().width() + 10, doc.size().height() + 10);
- setMaximumSize(doc.size().width() + 10, doc.size().height() + 10);
- raise();
-}
-
-void HoverWindow::setPixmap(const QPixmap &pm, bool scale){
- mAlignCenter = true;
- QPixmap curPm = pm;
- if(scale){
- if(curPm.height() > 500){
- curPm = curPm.scaledToHeight(500);
- }
- if(curPm.width() > 300){
- curPm = curPm.scaledToWidth(300);
- }
- }
- mLabel->setPixmap(curPm);
- setMaximumSize(curPm.width() + 10, curPm.height() + 10);
- setMinimumSize(curPm.width() + 10, curPm.height() + 10);
- raise();
-}
-
-void HoverWindow::setData(const QList<QVariant> &data){
- if(data.isEmpty()){
- return;
- }
- if(data.at(0).canConvert(QVariant::Pixmap)){
- setPixmap(data.at(0).value<QPixmap>());
- return;
- }
- if(data.size() != 2){
- return;
- }
- QStringList dataList = data.at(1).toStringList();
- if(dataList.isEmpty()){
- dataList << tr("&lt;empty&gt;");
- }
- setContent(data.at(0).toString(), dataList);
-}
-
-void HoverWindow::setCaption(const QString &caption){
- const QPixmap *pm = mLabel->pixmap();
- if(!pm){
- return;
- }
- QFontMetrics fm = qApp->fontMetrics();
- QString elidedCap = fm.elidedText(caption, Qt::ElideLeft, pm->size().width() - 18, Qt::TextSingleLine);
- QStaticText myCap(elidedCap);
- QImage img = pm->toImage();
- QPainter *p = new QPainter(&img);
- QColor bgColor(Qt::white);
- p->setBrush(QBrush(bgColor));
- p->setPen(Qt::NoPen);
- p->setOpacity(0.4);
- qreal xStart = (mLabel->width() - myCap.size().width() - 9) / 2.0;
- p->drawRect(QRect(QPoint(xStart, 5), QSize(myCap.size().toSize())));
- p->setOpacity(1.0);
- p->setPen(Qt::black);
- p->drawStaticText(xStart, 5, myCap);
- delete p;
- mLabel->setPixmap(QPixmap::fromImage(img));
-}
-
-void HoverWindow::setPos(){
- const QPoint globalPos(QCursor::pos());
- QPoint hoverPos(globalPos.x() + mHoverOffset.x(), globalPos.y() + mHoverOffset.y());
- if(mAlignCenter){
- hoverPos = QPoint(hoverPos.x(), hoverPos.y() - height() / 2);
- }
- if(hoverPos.y() < 0){
- hoverPos = QPoint(hoverPos.x(), 0);
- }
- if(hoverPos.y() + height() > mDesktopHeight){
- hoverPos = QPoint(hoverPos.x(), mDesktopHeight - height());
- }
- move(hoverPos);
-}
diff --git a/hoverwindow.h b/hoverwindow.h
deleted file mode 100644
index 580d9e9..0000000
--- a/hoverwindow.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- 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 the Free Software Foundation; either version
- 2 of the License, or (at your option) any later version.
-*/
-
-#ifndef HOVERWINDOW_H
-#define HOVERWINDOW_H
-
-#include <QtWidgets/QWidget>
-#include <QList>
-#include <QVariant>
-
-class QLabel;
-class QHBoxLayout;
-
-class HoverWindow : public QWidget {
- Q_OBJECT
- public:
- explicit HoverWindow(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Tool | Qt::FramelessWindowHint);
- void setContent(const QString &parent, const QStringList &children);
- void setPixmap(const QPixmap &pm, bool scale = true);
- void setData(const QList<QVariant> &data);
- void setCaption(const QString &caption);
- void setPos();
- QPoint hoverOffset() const { return mHoverOffset; }
- void setHoverOffset(const QPoint &point) { mHoverOffset = point; }
-
- private:
- QLabel *mLabel;
- QPoint mHoverOffset;
- QHBoxLayout *mMainLayout;
- bool mAlignCenter;
- int mDesktopHeight;
-};
-
-#endif // HOVERWINDOW_H
diff --git a/shemov.pro b/shemov.pro
index 94a100a..9b98bd6 100644
--- a/shemov.pro
+++ b/shemov.pro
@@ -20,7 +20,6 @@ SOURCES = main.cpp \
mappingtablewidget.cpp \
newmoviewizard.cpp \
filepropertiesdialog.cpp \
- hoverwindow.cpp \
consistencycheck.cpp \
mappingtableeditor.cpp \
smdialog.cpp \
@@ -77,7 +76,6 @@ HEADERS = \
mappingtablewidget.h \
newmoviewizard.h \
filepropertiesdialog.h \
- hoverwindow.h \
consistencycheck.h \
mappingtableeditor.h \
smdialog.h \
diff --git a/smglobals.cpp b/smglobals.cpp
index 6b73d28..9577ebf 100644
--- a/smglobals.cpp
+++ b/smglobals.cpp
@@ -18,10 +18,6 @@
#include "configurationdialog.h"
#include "archivebrowsermodel.h"
-#include <X11/Xlib.h>
-#include <X11/extensions/Xfixes.h>
-
-
SmGlobals *SmGlobals::mInstance = nullptr;
SmGlobals::~SmGlobals(){
@@ -111,16 +107,6 @@ VideoViewer *SmGlobals::videoViewer() {
return mVideoViewer;
}
-QSize SmGlobals::cursorSize() {
- if(!mCursorSize.isValid()){
- Display *dpy = XOpenDisplay(nullptr);
- XFixesCursorImage *curImage = XFixesGetCursorImage(dpy);
- mCursorSize = QSize(curImage->width, curImage->height);
- XFree(curImage);
- }
- return mCursorSize;
-}
-
QIcon SmGlobals::iconFor(const QString &type){
QString settingsS = QString("ui/%1icon").arg(type);
QSettings s;