Removing QColor (from Qt::Widgets) from core modules. (#4247)

This commit is contained in:
louib
2020-01-26 21:38:43 -05:00
committed by Jonathan White
parent 8bac8a7163
commit c8ab3b5f4f
15 changed files with 47 additions and 97 deletions

View File

@@ -15,24 +15,3 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Compare.h"
#include <QColor>
bool operator<(const QColor& lhs, const QColor& rhs)
{
const QColor adaptedLhs = lhs.toCmyk();
const QColor adaptedRhs = rhs.toCmyk();
const int iCyan = compare(adaptedLhs.cyanF(), adaptedRhs.cyanF());
if (iCyan != 0) {
return iCyan;
}
const int iMagenta = compare(adaptedLhs.magentaF(), adaptedRhs.magentaF());
if (iMagenta != 0) {
return iMagenta;
}
const int iYellow = compare(adaptedLhs.yellowF(), adaptedRhs.yellowF());
if (iYellow != 0) {
return iYellow;
}
return compare(adaptedLhs.blackF(), adaptedRhs.blackF()) < 0;
}

View File

@@ -34,14 +34,6 @@ enum CompareItemOption
Q_DECLARE_FLAGS(CompareItemOptions, CompareItemOption)
Q_DECLARE_OPERATORS_FOR_FLAGS(CompareItemOptions)
class QColor;
/*!
* \return true when both color match
*
* Comparison converts both into the cmyk-model
*/
bool operator<(const QColor& lhs, const QColor& rhs);
template <typename Type> inline short compareGeneric(const Type& lhs, const Type& rhs, CompareItemOptions)
{
if (lhs != rhs) {

View File

@@ -208,12 +208,12 @@ const QUuid& Entry::iconUuid() const
return m_data.customIcon;
}
QColor Entry::foregroundColor() const
QString Entry::foregroundColor() const
{
return m_data.foregroundColor;
}
QColor Entry::backgroundColor() const
QString Entry::backgroundColor() const
{
return m_data.backgroundColor;
}
@@ -508,14 +508,14 @@ void Entry::setIcon(const QUuid& uuid)
}
}
void Entry::setForegroundColor(const QColor& color)
void Entry::setForegroundColor(const QString& colorStr)
{
set(m_data.foregroundColor, color);
set(m_data.foregroundColor, colorStr);
}
void Entry::setBackgroundColor(const QColor& color)
void Entry::setBackgroundColor(const QString& colorStr)
{
set(m_data.backgroundColor, color);
set(m_data.backgroundColor, colorStr);
}
void Entry::setOverrideUrl(const QString& url)

View File

@@ -19,7 +19,6 @@
#ifndef KEEPASSX_ENTRY_H
#define KEEPASSX_ENTRY_H
#include <QColor>
#include <QImage>
#include <QMap>
#include <QPixmap>
@@ -57,8 +56,8 @@ struct EntryData
{
int iconNumber;
QUuid customIcon;
QColor foregroundColor;
QColor backgroundColor;
QString foregroundColor;
QString backgroundColor;
QString overrideUrl;
QString tags;
bool autoTypeEnabled;
@@ -86,8 +85,8 @@ public:
QPixmap iconScaledPixmap() const;
int iconNumber() const;
const QUuid& iconUuid() const;
QColor foregroundColor() const;
QColor backgroundColor() const;
QString foregroundColor() const;
QString backgroundColor() const;
QString overrideUrl() const;
QString tags() const;
const TimeInfo& timeInfo() const;
@@ -132,8 +131,8 @@ public:
void setUuid(const QUuid& uuid);
void setIcon(int iconNumber);
void setIcon(const QUuid& uuid);
void setForegroundColor(const QColor& color);
void setBackgroundColor(const QColor& color);
void setForegroundColor(const QString& color);
void setBackgroundColor(const QString& color);
void setOverrideUrl(const QString& url);
void setTags(const QString& tags);
void setTimeInfo(const TimeInfo& timeInfo);

View File

@@ -131,7 +131,7 @@ int Metadata::maintenanceHistoryDays() const
return m_data.maintenanceHistoryDays;
}
QColor Metadata::color() const
QString Metadata::color() const
{
return m_data.color;
}
@@ -347,7 +347,7 @@ void Metadata::setMaintenanceHistoryDays(int value)
set(m_data.maintenanceHistoryDays, value);
}
void Metadata::setColor(const QColor& value)
void Metadata::setColor(const QString& value)
{
set(m_data.color, value);
}

View File

@@ -18,7 +18,6 @@
#ifndef KEEPASSX_METADATA_H
#define KEEPASSX_METADATA_H
#include <QColor>
#include <QDateTime>
#include <QHash>
#include <QImage>
@@ -49,7 +48,7 @@ public:
QString defaultUserName;
QDateTime defaultUserNameChanged;
int maintenanceHistoryDays;
QColor color;
QString color;
bool recycleBinEnabled;
int historyMaxItems;
int historyMaxSize;
@@ -72,7 +71,7 @@ public:
QDateTime defaultUserNameChanged() const;
QDateTime settingsChanged() const;
int maintenanceHistoryDays() const;
QColor color() const;
QString color() const;
bool protectTitle() const;
bool protectUsername() const;
bool protectPassword() const;
@@ -113,7 +112,7 @@ public:
void setDefaultUserNameChanged(const QDateTime& value);
void setSettingsChanged(const QDateTime& value);
void setMaintenanceHistoryDays(int value);
void setColor(const QColor& value);
void setColor(const QString& value);
void setProtectTitle(bool value);
void setProtectUsername(bool value);
void setProtectPassword(bool value);