change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+43 -41
View File
@@ -22,90 +22,92 @@
#include "ui/style/style.h"
namespace olive {
namespace olive
{
Menu::Menu(QMenuBar *bar)
{
bar->addMenu(this);
bar->addMenu(this);
Init();
Init();
}
Menu::Menu(Menu *menu)
{
menu->addMenu(this);
menu->addMenu(this);
Init();
Init();
}
Menu::Menu(QWidget *parent) :
QMenu(parent)
Menu::Menu(QWidget *parent)
: QMenu(parent)
{
Init();
Init();
}
Menu::Menu(const QString &s, QWidget *parent) :
QMenu(s, parent)
Menu::Menu(const QString &s, QWidget *parent)
: QMenu(s, parent)
{
Init();
Init();
}
QAction *Menu::AddActionWithData(const QString &text, const QVariant &d, const QVariant &compare)
QAction *Menu::AddActionWithData(const QString &text, const QVariant &d,
const QVariant &compare)
{
QAction* a = addAction(text);
QAction *a = addAction(text);
a->setData(d);
a->setCheckable(true);
a->setChecked(d == compare);
a->setData(d);
a->setCheckable(true);
a->setChecked(d == compare);
return a;
return a;
}
QAction* Menu::InsertAlphabetically(const QString &s)
QAction *Menu::InsertAlphabetically(const QString &s)
{
QAction* action = new QAction(s, this);
InsertAlphabetically(action);
return action;
QAction *action = new QAction(s, this);
InsertAlphabetically(action);
return action;
}
void Menu::InsertAlphabetically(QAction *entry)
{
QList<QAction*> actions = this->actions();
QList<QAction *> actions = this->actions();
foreach (QAction* action, actions) {
if (action->text() > entry->text()) {
insertAction(action, entry);
return;
}
}
foreach (QAction *action, actions) {
if (action->text() > entry->text()) {
insertAction(action, entry);
return;
}
}
addAction(entry);
addAction(entry);
}
void Menu::InsertAlphabetically(Menu *menu)
{
InsertAlphabetically(menu->menuAction());
InsertAlphabetically(menu->menuAction());
}
void Menu::ConformItem(QAction *a, const QString &id, const QKeySequence &key)
{
a->setProperty("id", id);
a->setProperty("id", id);
if (!key.isEmpty()) {
a->setShortcut(key);
a->setProperty("keydefault", key);
if (!key.isEmpty()) {
a->setShortcut(key);
a->setProperty("keydefault", key);
// Set to application context so that ViewerWindows still trigger shortcuts
a->setShortcutContext(Qt::ApplicationShortcut);
}
// Set to application context so that ViewerWindows still trigger shortcuts
a->setShortcutContext(Qt::ApplicationShortcut);
}
}
void Menu::Init()
{
// HACK: Disables embossing on disabled text for a slightly nicer UI
QPalette p = palette();
p.setColor(QPalette::Disabled, QPalette::Light, QColor(0, 0, 0, 0));
setPalette(p);
// HACK: Disables embossing on disabled text for a slightly nicer UI
QPalette p = palette();
p.setColor(QPalette::Disabled, QPalette::Light, QColor(0, 0, 0, 0));
setPalette(p);
}
}