committed by
Jonathan White
parent
f3f1520f81
commit
7e1d980d08
@@ -90,7 +90,7 @@ void ShortcutWidget::keyEvent(QKeyEvent* event)
|
||||
return;
|
||||
}
|
||||
|
||||
Qt::Key key = static_cast<Qt::Key>(event->key());
|
||||
auto key = static_cast<Qt::Key>(event->key());
|
||||
|
||||
if (key <= 0 || key == Qt::Key_unknown) {
|
||||
return;
|
||||
|
||||
@@ -57,7 +57,7 @@ int AddGroup::executeWithDatabase(QSharedPointer<Database> database, QSharedPoin
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Group* newGroup = new Group();
|
||||
auto newGroup = new Group();
|
||||
newGroup->setUuid(QUuid::createUuid());
|
||||
newGroup->setName(groupName);
|
||||
newGroup->setParent(parentGroup);
|
||||
|
||||
@@ -41,7 +41,7 @@ static void estimate(const char* pwd, bool advanced)
|
||||
{
|
||||
auto& out = Utils::STDOUT;
|
||||
|
||||
int len = static_cast<int>(strlen(pwd));
|
||||
auto len = static_cast<int>(strlen(pwd));
|
||||
if (!advanced) {
|
||||
const auto e = PasswordHealth(pwd).entropy();
|
||||
// clang-format off
|
||||
|
||||
@@ -865,7 +865,7 @@ bool Entry::equals(const Entry* other, CompareItemOptions options) const
|
||||
|
||||
Entry* Entry::clone(CloneFlags flags) const
|
||||
{
|
||||
Entry* entry = new Entry();
|
||||
auto entry = new Entry();
|
||||
entry->setUpdateTimeinfo(false);
|
||||
if (flags & CloneNewUuid) {
|
||||
entry->m_uuid = QUuid::createUuid();
|
||||
|
||||
@@ -890,7 +890,7 @@ Group* Group::findChildByName(const QString& name)
|
||||
*/
|
||||
Group* Group::clone(Entry::CloneFlags entryFlags, Group::CloneFlags groupFlags) const
|
||||
{
|
||||
Group* clonedGroup = new Group();
|
||||
auto clonedGroup = new Group();
|
||||
|
||||
clonedGroup->setUpdateTimeinfo(false);
|
||||
|
||||
|
||||
@@ -432,13 +432,13 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
||||
bool reachedEnd = false;
|
||||
|
||||
do {
|
||||
quint16 fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
|
||||
auto fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
|
||||
if (!ok) {
|
||||
raiseError(tr("Invalid group field type number"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
|
||||
auto fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
|
||||
if (!ok) {
|
||||
raiseError(tr("Invalid group field size"));
|
||||
return nullptr;
|
||||
@@ -513,7 +513,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
||||
raiseError(tr("Incorrect group icon field size"));
|
||||
return nullptr;
|
||||
}
|
||||
quint32 iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
|
||||
auto iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
|
||||
group->setIcon(iconNumber);
|
||||
break;
|
||||
}
|
||||
@@ -564,13 +564,13 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
||||
bool reachedEnd = false;
|
||||
|
||||
do {
|
||||
quint16 fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
|
||||
auto fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
|
||||
if (!ok) {
|
||||
raiseError(tr("Missing entry field type number"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
|
||||
auto fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
|
||||
if (!ok) {
|
||||
raiseError(tr("Invalid entry field size"));
|
||||
return nullptr;
|
||||
@@ -598,7 +598,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
||||
raiseError(tr("Invalid entry group id field size"));
|
||||
return nullptr;
|
||||
}
|
||||
quint32 groupId = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
|
||||
auto groupId = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
|
||||
m_entryGroupIds.insert(entry.data(), groupId);
|
||||
break;
|
||||
}
|
||||
@@ -607,7 +607,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
||||
raiseError(tr("Invalid entry icon field size"));
|
||||
return nullptr;
|
||||
}
|
||||
quint32 iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
|
||||
auto iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
|
||||
entry->setIcon(iconNumber);
|
||||
break;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ bool KeePass1Reader::parseGroupTreeState(const QByteArray& data)
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
quint32 num = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto num = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
if (static_cast<quint32>(data.size() - 4) != (num * 5)) {
|
||||
@@ -814,7 +814,7 @@ bool KeePass1Reader::parseGroupTreeState(const QByteArray& data)
|
||||
}
|
||||
|
||||
for (quint32 i = 0; i < num; i++) {
|
||||
quint32 groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
bool expanded = data.at(pos);
|
||||
@@ -836,13 +836,13 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
|
||||
|
||||
int pos = 0;
|
||||
|
||||
quint32 numIcons = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto numIcons = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
quint32 numEntries = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto numEntries = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
quint32 numGroups = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto numGroups = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
QList<QUuid> iconUuids;
|
||||
@@ -851,7 +851,7 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
|
||||
if (data.size() < (pos + 4)) {
|
||||
return false;
|
||||
}
|
||||
quint32 iconSize = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto iconSize = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
if (static_cast<quint32>(data.size()) < (pos + iconSize)) {
|
||||
@@ -873,7 +873,7 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
|
||||
QByteArray entryUuid = data.mid(pos, 16);
|
||||
pos += 16;
|
||||
|
||||
quint32 iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
if (m_entryUuids.contains(entryUuid) && (iconId < static_cast<quint32>(iconUuids.size()))) {
|
||||
@@ -886,10 +886,10 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
|
||||
}
|
||||
|
||||
for (quint32 i = 0; i < numGroups; i++) {
|
||||
quint32 groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
quint32 iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
auto iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
if (m_groupIds.contains(groupId) && (iconId < static_cast<quint32>(iconUuids.size()))) {
|
||||
|
||||
@@ -281,7 +281,7 @@ void Application::processIncomingConnection()
|
||||
|
||||
void Application::socketReadyRead()
|
||||
{
|
||||
QLocalSocket* socket = qobject_cast<QLocalSocket*>(sender());
|
||||
auto socket = qobject_cast<QLocalSocket*>(sender());
|
||||
if (!socket) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ QSize CategoryListWidget::minimumSizeHint() const
|
||||
|
||||
int CategoryListWidget::addCategory(const QString& labelText, const QIcon& icon)
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem(m_ui->categoryList);
|
||||
auto item = new QListWidgetItem(m_ui->categoryList);
|
||||
item->setText(labelText);
|
||||
item->setIcon(icon);
|
||||
m_ui->categoryList->addItem(item);
|
||||
|
||||
@@ -899,7 +899,7 @@ void DatabaseWidget::openUrlForEntry(Entry* entry)
|
||||
this);
|
||||
msgbox.setDefaultButton(QMessageBox::No);
|
||||
|
||||
QCheckBox* checkbox = new QCheckBox(tr("Remember my choice"), &msgbox);
|
||||
auto checkbox = new QCheckBox(tr("Remember my choice"), &msgbox);
|
||||
msgbox.setCheckBox(checkbox);
|
||||
bool remember = false;
|
||||
QObject::connect(checkbox, &QCheckBox::stateChanged, [&](int state) {
|
||||
|
||||
@@ -88,7 +88,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
|
||||
QObject::connect(textLabel, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString)));
|
||||
QObject::connect(textLabel, SIGNAL(linkHovered(QString)), q, SIGNAL(linkHovered(QString)));
|
||||
|
||||
QAction *closeAction = new QAction(q);
|
||||
auto closeAction = new QAction(q);
|
||||
closeAction->setText(KMessageWidget::tr("&Close"));
|
||||
closeAction->setToolTip(KMessageWidget::tr("Close message"));
|
||||
closeAction->setIcon(icons()->icon("message-close"));
|
||||
@@ -114,7 +114,7 @@ void KMessageWidgetPrivate::createLayout()
|
||||
|
||||
const auto actions = q->actions();
|
||||
for (QAction *action: actions) {
|
||||
QToolButton *button = new QToolButton(content);
|
||||
auto button = new QToolButton(content);
|
||||
button->setDefaultAction(action);
|
||||
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
buttons.append(button);
|
||||
@@ -126,12 +126,12 @@ void KMessageWidgetPrivate::createLayout()
|
||||
closeButton->setAutoRaise(buttons.isEmpty());
|
||||
|
||||
if (wordWrap) {
|
||||
QGridLayout *layout = new QGridLayout(content);
|
||||
auto layout = new QGridLayout(content);
|
||||
// Set alignment to make sure icon does not move down if text wraps
|
||||
layout->addWidget(iconLabel, 0, 0, 1, 1, Qt::AlignHCenter | Qt::AlignTop);
|
||||
layout->addWidget(textLabel, 0, 1);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
auto buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
for (QToolButton* button: asConst(buttons)) {
|
||||
// For some reason, calling show() is necessary if wordwrap is true,
|
||||
@@ -143,7 +143,7 @@ void KMessageWidgetPrivate::createLayout()
|
||||
buttonLayout->addWidget(closeButton);
|
||||
layout->addItem(buttonLayout, 1, 0, 1, 2);
|
||||
} else {
|
||||
QHBoxLayout *layout = new QHBoxLayout(content);
|
||||
auto layout = new QHBoxLayout(content);
|
||||
layout->addWidget(iconLabel);
|
||||
layout->addWidget(textLabel);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
||||
// set font size of password quality and entropy labels dynamically to 80% of
|
||||
// the default font size, but make it no smaller than 8pt
|
||||
QFont defaultFont;
|
||||
int smallerSize = static_cast<int>(defaultFont.pointSize() * 0.8f);
|
||||
auto smallerSize = static_cast<int>(defaultFont.pointSize() * 0.8f);
|
||||
if (smallerSize >= 8) {
|
||||
defaultFont.setPointSize(smallerSize);
|
||||
m_ui->entropyLabel->setFont(defaultFont);
|
||||
|
||||
@@ -83,7 +83,7 @@ SearchWidget::~SearchWidget()
|
||||
bool SearchWidget::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
auto keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if (keyEvent->key() == Qt::Key_Escape) {
|
||||
emit escapePressed();
|
||||
return true;
|
||||
|
||||
@@ -82,7 +82,7 @@ TotpExportSettingsDialog::TotpExportSettingsDialog(DatabaseWidget* parent, Entry
|
||||
QBuffer buffer;
|
||||
qrc.writeSvg(&buffer, logicalDpiX());
|
||||
m_totpSvgWidget->load(buffer.data());
|
||||
const int minsize = static_cast<int>(logicalDpiX() * 2.5);
|
||||
const auto minsize = static_cast<int>(logicalDpiX() * 2.5);
|
||||
m_totpSvgWidget->setMinimumSize(minsize, minsize);
|
||||
} else {
|
||||
auto errorBox = new QMessageBox(parent);
|
||||
|
||||
@@ -82,7 +82,7 @@ void WelcomeWidget::refreshLastDatabases()
|
||||
m_ui->recentListWidget->clear();
|
||||
const QStringList lastDatabases = config()->get(Config::LastDatabases).toStringList();
|
||||
for (const QString& database : lastDatabases) {
|
||||
QListWidgetItem* itm = new QListWidgetItem;
|
||||
auto itm = new QListWidgetItem;
|
||||
itm->setText(database);
|
||||
m_ui->recentListWidget->addItem(itm);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ void CsvImportWidget::writeDatabase()
|
||||
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid()) {
|
||||
continue;
|
||||
}
|
||||
Entry* entry = new Entry();
|
||||
auto entry = new Entry();
|
||||
entry->setUuid(QUuid::createUuid());
|
||||
entry->setGroup(splitGroups(m_parserModel->data(m_parserModel->index(r, 0)).toString()));
|
||||
entry->setTitle(m_parserModel->data(m_parserModel->index(r, 1)).toString());
|
||||
@@ -325,7 +325,7 @@ Group* CsvImportWidget::splitGroups(const QString& label)
|
||||
for (const QString& groupName : groupList) {
|
||||
Group* children = hasChildren(current, groupName);
|
||||
if (children == nullptr) {
|
||||
Group* brandNew = new Group();
|
||||
auto brandNew = new Group();
|
||||
brandNew->setParent(current);
|
||||
brandNew->setName(groupName);
|
||||
brandNew->setUuid(QUuid::createUuid());
|
||||
|
||||
@@ -790,7 +790,7 @@ void EditEntryWidget::copyPublicKey()
|
||||
void EditEntryWidget::useExpiryPreset(QAction* action)
|
||||
{
|
||||
m_mainUi->expireCheck->setChecked(true);
|
||||
TimeDelta delta = action->data().value<TimeDelta>();
|
||||
auto delta = action->data().value<TimeDelta>();
|
||||
QDateTime now = Clock::currentDateTime();
|
||||
QDateTime expiryDateTime = now + delta;
|
||||
m_mainUi->expireDatePicker->setDateTime(expiryDateTime);
|
||||
|
||||
@@ -390,14 +390,14 @@ bool EntryAttachmentsWidget::eventFilter(QObject* watched, QEvent* e)
|
||||
if (watched == m_ui->attachmentsView->viewport() && !isReadOnly()) {
|
||||
const QEvent::Type eventType = e->type();
|
||||
if (eventType == QEvent::DragEnter || eventType == QEvent::DragMove) {
|
||||
QDropEvent* dropEv = static_cast<QDropEvent*>(e);
|
||||
auto dropEv = static_cast<QDropEvent*>(e);
|
||||
const QMimeData* mimeData = dropEv->mimeData();
|
||||
if (mimeData->hasUrls()) {
|
||||
dropEv->acceptProposedAction();
|
||||
return true;
|
||||
}
|
||||
} else if (eventType == QEvent::Drop) {
|
||||
QDropEvent* dropEv = static_cast<QDropEvent*>(e);
|
||||
auto dropEv = static_cast<QDropEvent*>(e);
|
||||
const QMimeData* mimeData = dropEv->mimeData();
|
||||
if (mimeData->hasUrls()) {
|
||||
dropEv->acceptProposedAction();
|
||||
|
||||
@@ -462,7 +462,7 @@ QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QMimeData* data = new QMimeData();
|
||||
auto data = new QMimeData();
|
||||
QByteArray encoded;
|
||||
QDataStream stream(&encoded, QIODevice::WriteOnly);
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QMimeData* data = new QMimeData();
|
||||
auto data = new QMimeData();
|
||||
QByteArray encoded;
|
||||
QDataStream stream(&encoded, QIODevice::WriteOnly);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void ScreenLockListenerDBus::login1SessionObjectReceived(QDBusMessage response)
|
||||
qDebug() << "org.freedesktop.login1.Manager.GetSession did not return a QDBusObjectPath";
|
||||
return;
|
||||
}
|
||||
QDBusObjectPath path = arg0.value<QDBusObjectPath>();
|
||||
auto path = arg0.value<QDBusObjectPath>();
|
||||
QDBusConnection systemBus = QDBusConnection::systemBus();
|
||||
|
||||
systemBus.connect("", // service
|
||||
|
||||
@@ -37,12 +37,12 @@ QWidget* ReportsPageStatistics::createWidget()
|
||||
|
||||
void ReportsPageStatistics::loadSettings(QWidget* widget, QSharedPointer<Database> db)
|
||||
{
|
||||
ReportsWidgetStatistics* settingsWidget = reinterpret_cast<ReportsWidgetStatistics*>(widget);
|
||||
auto settingsWidget = reinterpret_cast<ReportsWidgetStatistics*>(widget);
|
||||
settingsWidget->loadSettings(db);
|
||||
}
|
||||
|
||||
void ReportsPageStatistics::saveSettings(QWidget* widget)
|
||||
{
|
||||
ReportsWidgetStatistics* settingsWidget = reinterpret_cast<ReportsWidgetStatistics*>(widget);
|
||||
auto settingsWidget = reinterpret_cast<ReportsWidgetStatistics*>(widget);
|
||||
settingsWidget->saveSettings();
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ namespace Phantom
|
||||
m.rightMarginForArrow = static_cast<int>(fontHeight * MenuItem_RightMarginForArrowFontRatio);
|
||||
m.topMargin = static_cast<int>(fontHeight * MenuItem_VerticalMarginsFontRatio);
|
||||
m.bottomMargin = static_cast<int>(fontHeight * MenuItem_VerticalMarginsFontRatio);
|
||||
int checkVMargin = static_cast<int>(fontHeight * MenuItem_CheckMarkVerticalInsetFontRatio);
|
||||
auto checkVMargin = static_cast<int>(fontHeight * MenuItem_CheckMarkVerticalInsetFontRatio);
|
||||
int checkHeight = fontHeight - checkVMargin * 2;
|
||||
if (checkHeight < 0)
|
||||
checkHeight = 0;
|
||||
@@ -817,7 +817,7 @@ namespace Phantom
|
||||
menuItemCheckRect(const MenuItemMetrics& metrics, Qt::LayoutDirection direction, QRect itemRect, bool hasArrow)
|
||||
{
|
||||
QRect r = menuItemContentRect(metrics, itemRect, hasArrow);
|
||||
int checkVMargin = static_cast<int>(metrics.fontHeight * MenuItem_CheckMarkVerticalInsetFontRatio);
|
||||
auto checkVMargin = static_cast<int>(metrics.fontHeight * MenuItem_CheckMarkVerticalInsetFontRatio);
|
||||
if (checkVMargin < 0)
|
||||
checkVMargin = 0;
|
||||
r.setSize(QSize(metrics.checkWidth, metrics.fontHeight));
|
||||
@@ -1671,7 +1671,7 @@ void BaseStyle::drawPrimitive(PrimitiveElement elem,
|
||||
if (arrow == Qt::DownArrow && !qstyleoption_cast<const QStyleOptionToolButton*>(option) && widget) {
|
||||
auto tbutton = qobject_cast<const QToolButton*>(widget);
|
||||
if (tbutton && tbutton->popupMode() != QToolButton::InstantPopup && tbutton->defaultAction()) {
|
||||
int dim = static_cast<int>(qMin(rw, rh) * 0.25);
|
||||
auto dim = static_cast<int>(qMin(rw, rh) * 0.25);
|
||||
aw -= dim;
|
||||
ah -= dim;
|
||||
// We have another hack in PE_IndicatorButtonDropDown where we shift
|
||||
@@ -2472,7 +2472,7 @@ void BaseStyle::drawControl(ControlElement element,
|
||||
QPixmap pixmap = header->icon.pixmap(window,
|
||||
QSize(iconExtent, iconExtent),
|
||||
(header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
|
||||
int pixw = static_cast<int>(pixmap.width() / pixmap.devicePixelRatio());
|
||||
auto pixw = static_cast<int>(pixmap.width() / pixmap.devicePixelRatio());
|
||||
QRect aligned = alignedRect(
|
||||
header->direction, QFlag(header->iconAlignment), pixmap.size() / pixmap.devicePixelRatio(), rect);
|
||||
QRect inter = aligned.intersected(rect);
|
||||
@@ -2745,8 +2745,8 @@ void BaseStyle::drawControl(ControlElement element,
|
||||
}
|
||||
QWindow* window = widget ? widget->windowHandle() : nullptr;
|
||||
QPixmap pixmap = menuItem->icon.pixmap(window, iconSize, mode, state);
|
||||
const int pixw = static_cast<int>(pixmap.width() / pixmap.devicePixelRatio());
|
||||
const int pixh = static_cast<int>(pixmap.height() / pixmap.devicePixelRatio());
|
||||
const auto pixw = static_cast<int>(pixmap.width() / pixmap.devicePixelRatio());
|
||||
const auto pixh = static_cast<int>(pixmap.height() / pixmap.devicePixelRatio());
|
||||
QRect pixmapRect = QStyle::alignedRect(option->direction, Qt::AlignCenter, QSize(pixw, pixh), iconRect);
|
||||
painter->drawPixmap(pixmapRect.topLeft(), pixmap);
|
||||
}
|
||||
@@ -2883,8 +2883,8 @@ void BaseStyle::drawControl(ControlElement element,
|
||||
QIcon::State state = button->state & State_On ? QIcon::On : QIcon::Off;
|
||||
auto window = widget ? widget->window()->windowHandle() : nullptr;
|
||||
QPixmap pixmap = button->icon.pixmap(window, button->iconSize, mode, state);
|
||||
int pixmapWidth = static_cast<int>(pixmap.width() / pixmap.devicePixelRatio());
|
||||
int pixmapHeight = static_cast<int>(pixmap.height() / pixmap.devicePixelRatio());
|
||||
auto pixmapWidth = static_cast<int>(pixmap.width() / pixmap.devicePixelRatio());
|
||||
auto pixmapHeight = static_cast<int>(pixmap.height() / pixmap.devicePixelRatio());
|
||||
int labelWidth = pixmapWidth;
|
||||
int labelHeight = pixmapHeight;
|
||||
// 4 is hardcoded in QPushButton::sizeHint()
|
||||
@@ -3276,7 +3276,7 @@ void BaseStyle::drawComplexControl(ComplexControl control,
|
||||
|
||||
{
|
||||
// Fill title
|
||||
QColor titlebarColor = QColor(active ? highlight : palette.background().color());
|
||||
auto titlebarColor = QColor(active ? highlight : palette.background().color());
|
||||
painter->fillRect(option->rect.adjusted(1, 1, -1, 0), titlebarColor);
|
||||
// Frame and rounded corners
|
||||
painter->setPen(titleBarFrameBorder);
|
||||
@@ -3983,8 +3983,8 @@ QSize BaseStyle::sizeFromContents(ContentsType type,
|
||||
}
|
||||
case CT_MenuBarItem: {
|
||||
int fontHeight = option ? option->fontMetrics.height() : size.height();
|
||||
int w = static_cast<int>(fontHeight * Ph::MenuBar_HorizontalPaddingFontRatio);
|
||||
int h = static_cast<int>(fontHeight * Ph::MenuBar_VerticalPaddingFontRatio);
|
||||
auto w = static_cast<int>(fontHeight * Ph::MenuBar_HorizontalPaddingFontRatio);
|
||||
auto h = static_cast<int>(fontHeight * Ph::MenuBar_VerticalPaddingFontRatio);
|
||||
int line = Ph::dpiScaled(1);
|
||||
return QSize(size.width() + w * 2, size.height() + h * 2 + line);
|
||||
}
|
||||
@@ -4176,7 +4176,8 @@ QSize BaseStyle::sizeFromContents(ContentsType type,
|
||||
auto pbopt = qstyleoption_cast<const QStyleOptionButton*>(option);
|
||||
if (!pbopt || pbopt->text.isEmpty())
|
||||
break;
|
||||
int hpad = static_cast<int>(pbopt->fontMetrics.height() * Phantom::PushButton_HorizontalPaddingFontHeightRatio);
|
||||
auto hpad =
|
||||
static_cast<int>(pbopt->fontMetrics.height() * Phantom::PushButton_HorizontalPaddingFontHeightRatio);
|
||||
newSize.rwidth() += hpad * 2;
|
||||
if (widget && qobject_cast<const QDialogButtonBox*>(widget->parent())) {
|
||||
int dialogButtonMinWidth = Phantom::dpiScaled(80);
|
||||
|
||||
@@ -398,9 +398,9 @@ namespace Phantom
|
||||
|
||||
QColor qcolor_of_rgb(qreal r, qreal g, qreal b)
|
||||
{
|
||||
int r_ = static_cast<int>(std::lround(srgb_of_linear(r) * 255.0));
|
||||
int g_ = static_cast<int>(std::lround(srgb_of_linear(g) * 255.0));
|
||||
int b_ = static_cast<int>(std::lround(srgb_of_linear(b) * 255.0));
|
||||
auto r_ = static_cast<int>(std::lround(srgb_of_linear(r) * 255.0));
|
||||
auto g_ = static_cast<int>(std::lround(srgb_of_linear(g) * 255.0));
|
||||
auto b_ = static_cast<int>(std::lround(srgb_of_linear(b) * 255.0));
|
||||
return {r_, g_, b_};
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ bool HashedBlockStream::readHashedBlock()
|
||||
{
|
||||
bool ok;
|
||||
|
||||
quint32 index = Endian::readSizedInt<quint32>(m_baseDevice, ByteOrder, &ok);
|
||||
auto index = Endian::readSizedInt<quint32>(m_baseDevice, ByteOrder, &ok);
|
||||
if (!ok || index != m_blockIndex) {
|
||||
m_error = true;
|
||||
setErrorString("Invalid block index.");
|
||||
|
||||
Reference in New Issue
Block a user