mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
clang-format
This commit is contained in:
@ -52,11 +52,11 @@ void EditShortcutItemDelegate::closeShortcutEditor()
|
||||
emit closeEditor(static_cast<QWidget *>(sender()), QAbstractItemDelegate::NoHint);
|
||||
}
|
||||
|
||||
//TODO uncoment commented code for enabling concatenated shortcuts
|
||||
// TODO uncoment commented code for enabling concatenated shortcuts
|
||||
KeySequenceLineEdit::KeySequenceLineEdit(QWidget *parent)
|
||||
: QLineEdit(parent) //,numKeys(0)
|
||||
{
|
||||
//keys[0] = keys[1] = keys[2] = keys[3] = 0;
|
||||
// keys[0] = keys[1] = keys[2] = keys[3] = 0;
|
||||
setAlignment(Qt::AlignRight);
|
||||
|
||||
QPixmap clearPixmap(":/images/clear_shortcut.png");
|
||||
@ -83,10 +83,10 @@ KeySequenceLineEdit::KeySequenceLineEdit(QWidget *parent)
|
||||
void KeySequenceLineEdit::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
QSize szClear = clearButton->sizeHint();
|
||||
//int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
// int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
int leftMargin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
//int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin);
|
||||
clearButton->move(0 + leftMargin, (e->size().height() - 19) / 2); //16 is the icon height+1blank pixel
|
||||
// int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin);
|
||||
clearButton->move(0 + leftMargin, (e->size().height() - 19) / 2); // 16 is the icon height+1blank pixel
|
||||
|
||||
acceptButton->move(leftMargin + szClear.width(), (e->size().height() - 19) / 2);
|
||||
}
|
||||
@ -95,7 +95,7 @@ void KeySequenceLineEdit::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
int key = e->key();
|
||||
|
||||
//if ( numKeys > 3 ||
|
||||
// if ( numKeys > 3 ||
|
||||
if (key == Qt::Key_Control ||
|
||||
key == Qt::Key_Shift ||
|
||||
key == Qt::Key_Meta ||
|
||||
@ -120,7 +120,7 @@ void KeySequenceLineEdit::keyPressEvent(QKeyEvent *e)
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
//numKeys++;
|
||||
// numKeys++;
|
||||
QKeySequence keySequence = QKeySequence(key);
|
||||
setText(keySequence.toString(QKeySequence::NativeText));
|
||||
e->accept();
|
||||
|
@ -14,8 +14,8 @@ public:
|
||||
explicit KeySequenceLineEdit(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
//int numKeys;
|
||||
//int keys[4];
|
||||
// int numKeys;
|
||||
// int keys[4];
|
||||
void keyPressEvent(QKeyEvent *);
|
||||
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
@ -45,7 +45,7 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent)
|
||||
actionsTableView->setModel(actionsModel);
|
||||
actionsTableView->setColumnWidth(0, 30);
|
||||
actionsTableView->setColumnWidth(1, 360);
|
||||
//actionsTableView->horizontalHeader()->sectionResizeMode(QHeaderView::Custom);
|
||||
// actionsTableView->horizontalHeader()->sectionResizeMode(QHeaderView::Custom);
|
||||
actionsTableView->horizontalHeader()->setStretchLastSection(true);
|
||||
actionsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
actionsTableView->setShowGrid(false);
|
||||
@ -58,13 +58,13 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent)
|
||||
"");*/
|
||||
|
||||
connect(resetButton, &QAbstractButton::clicked, this, &EditShortcutsDialog::resetToDefaults);
|
||||
connect(actionsGroupsListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &EditShortcutsDialog::loadShortcuts); //clicked(QModelIndex) doesn't work :S
|
||||
connect(actionsGroupsListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &EditShortcutsDialog::loadShortcuts); // clicked(QModelIndex) doesn't work :S
|
||||
connect(actionsModel, &ActionsShortcutsModel::conflict, this, &EditShortcutsDialog::processConflict);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setFixedSize(760, 500);
|
||||
#else
|
||||
setFixedSize(804, 500); //extra width for modifiers
|
||||
setFixedSize(804, 500); // extra width for modifiers
|
||||
#endif
|
||||
setWindowTitle(tr("Shortcuts settings"));
|
||||
|
||||
@ -74,7 +74,7 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent)
|
||||
void EditShortcutsDialog::addActionsGroup(const QString &name, const QIcon &ico, QList<QAction *> &group)
|
||||
{
|
||||
groupsModel->addActionsGroup(ActionsGroup(name, ico, group));
|
||||
if (actionsTableView->model()->rowCount() == 0) //first group added
|
||||
if (actionsTableView->model()->rowCount() == 0) // first group added
|
||||
actionsGroupsListView->selectionModel()->select(groupsModel->index(0, 0), QItemSelectionModel::Select);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ ShortcutsManager::ShortcutsManager()
|
||||
void ShortcutsManager::initDefaultShorcuts()
|
||||
{
|
||||
#ifdef YACREADER_LIBRARY
|
||||
//ACTIONS
|
||||
// ACTIONS
|
||||
defaultShorcuts.insert(FOCUS_SEARCH_LINE_ACTION_YL, Qt::CTRL | Qt::Key_F);
|
||||
defaultShorcuts.insert(CREATE_LIBRARY_ACTION_YL, Qt::Key_A);
|
||||
defaultShorcuts.insert(OPEN_LIBRARY_ACTION_YL, Qt::Key_O);
|
||||
@ -30,7 +30,7 @@ void ShortcutsManager::initDefaultShorcuts()
|
||||
defaultShorcuts.insert(QUIT_ACTION_YL, Qt::CTRL | Qt::Key_Q);
|
||||
defaultShorcuts.insert(TOGGLE_COMICS_VIEW_ACTION_YL, Qt::Key_V);
|
||||
|
||||
//COMMANDS (used in keypressevent)
|
||||
// COMMANDS (used in keypressevent)
|
||||
#else
|
||||
defaultShorcuts.insert(OPEN_ACTION_Y, Qt::Key_O);
|
||||
defaultShorcuts.insert(OPEN_LATEST_COMIC_Y, Qt::CTRL | Qt::Key_R);
|
||||
@ -52,25 +52,25 @@ void ShortcutsManager::initDefaultShorcuts()
|
||||
defaultShorcuts.insert(SHOW_INFO_ACTION_Y, Qt::Key_I);
|
||||
defaultShorcuts.insert(CLOSE_ACTION_Y, Qt::Key_Escape);
|
||||
defaultShorcuts.insert(SHOW_DICTIONARY_ACTION_Y, Qt::Key_T);
|
||||
defaultShorcuts.insert(ALWAYS_ON_TOP_ACTION_Y, Qt::Key_Q); //deprecated
|
||||
defaultShorcuts.insert(ALWAYS_ON_TOP_ACTION_Y, Qt::Key_Q); // deprecated
|
||||
defaultShorcuts.insert(ADJUST_TO_FULL_SIZE_ACTION_Y, Qt::Key_W);
|
||||
defaultShorcuts.insert(SHOW_FLOW_ACTION_Y, Qt::Key_S);
|
||||
defaultShorcuts.insert(ZOOM_PLUS_ACTION_Y, Qt::Key_Plus);
|
||||
defaultShorcuts.insert(ZOOM_MINUS_ACTION_Y, Qt::Key_Minus);
|
||||
defaultShorcuts.insert(RESET_ZOOM_ACTION_Y, Qt::CTRL | Qt::Key_0);
|
||||
|
||||
//main_window_viewer
|
||||
// main_window_viewer
|
||||
defaultShorcuts.insert(TOGGLE_FULL_SCREEN_ACTION_Y, Qt::Key_F);
|
||||
defaultShorcuts.insert(TOGGLE_TOOL_BARS_ACTION_Y, Qt::Key_H);
|
||||
defaultShorcuts.insert(CHANGE_FIT_ACTION_Y, Qt::Key_A);
|
||||
//viewer
|
||||
// viewer
|
||||
defaultShorcuts.insert(AUTO_SCROLL_FORWARD_ACTION_Y, Qt::Key_Space);
|
||||
defaultShorcuts.insert(AUTO_SCROLL_BACKWARD_ACTION_Y, Qt::Key_B);
|
||||
defaultShorcuts.insert(MOVE_DOWN_ACTION_Y, Qt::Key_Down);
|
||||
defaultShorcuts.insert(MOVE_UP_ACTION_Y, Qt::Key_Up);
|
||||
defaultShorcuts.insert(GO_TO_FIRST_PAGE_ACTION_Y, Qt::Key_Home);
|
||||
defaultShorcuts.insert(GO_TO_LAST_PAGE_ACTION_Y, Qt::Key_End);
|
||||
//mglass
|
||||
// mglass
|
||||
defaultShorcuts.insert(SIZE_UP_MGLASS_ACTION_Y, Qt::Key_Plus);
|
||||
defaultShorcuts.insert(SIZE_DOWN_MGLASS_ACTION_Y, Qt::Key_Minus);
|
||||
defaultShorcuts.insert(ZOOM_IN_MGLASS_ACTION_Y, Qt::Key_Asterisk);
|
||||
@ -85,7 +85,7 @@ void ShortcutsManager::initDefaultShorcuts()
|
||||
|
||||
void ShortcutsManager::resetToDefaults()
|
||||
{
|
||||
//TODO reset to defaults
|
||||
// TODO reset to defaults
|
||||
}
|
||||
|
||||
QString ShortcutsManager::getShortcut(const QString &name)
|
||||
@ -125,7 +125,7 @@ bool ShortcutsManager::checkConflicts(const QKeySequence &shortcut, const QActio
|
||||
return false;
|
||||
|
||||
foreach (QAction *action, actions) {
|
||||
if (action != dest) //if the same shortcut is setted there is no conflict
|
||||
if (action != dest) // if the same shortcut is setted there is no conflict
|
||||
if (action->shortcut() == shortcut)
|
||||
return true;
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
|
||||
class QAction;
|
||||
|
||||
//QAction: used setData() and data() for storing (userData) an identifier for each QAction. This value is ussed in QSettings
|
||||
// QAction: used setData() and data() for storing (userData) an identifier for each QAction. This value is ussed in QSettings
|
||||
|
||||
class ShortcutsManager
|
||||
{
|
||||
private:
|
||||
ShortcutsManager();
|
||||
QMap<QString, QKeySequence> defaultShorcuts;
|
||||
QList<QAction *> actions; //all actions registered, used for checking conflicts
|
||||
QList<QAction *> actions; // all actions registered, used for checking conflicts
|
||||
|
||||
void initDefaultShorcuts();
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
bool checkConflicts(const QKeySequence &shortcut, const QAction *dest);
|
||||
};
|
||||
|
||||
//ACTION NAMES YACReaderLibrary
|
||||
// ACTION NAMES YACReaderLibrary
|
||||
#define BACK_ACTION_YL "BACK_ACTION_YL"
|
||||
#define FORWARD_ACTION_YL "FORWARD_ACTION_YL"
|
||||
#define CREATE_LIBRARY_ACTION_YL "CREATE_LIBRARY_ACTION_YL"
|
||||
@ -89,9 +89,9 @@ public:
|
||||
#define RENAME_LIST_ACTION_YL "RENAME_LIST_ACTION_YL"
|
||||
#define ADD_TO_FAVORITES_ACTION_YL "ADD_TO_FAVORITES_ACTION_YL"
|
||||
#define SAVE_COVERS_TO_ACTION_YL "SAVE_COVERS_TO_ACTION_YL"
|
||||
//COMMANDS YACReaderLibrary
|
||||
// COMMANDS YACReaderLibrary
|
||||
|
||||
//ACTION NAMES YACReader
|
||||
// ACTION NAMES YACReader
|
||||
#define OPEN_ACTION_Y "OPEN_ACTION_Y"
|
||||
#define NEW_INSTANCE_ACTION_Y "NEW_INSTANCE_ACTION_Y"
|
||||
#define OPEN_FOLDER_ACTION_Y "OPEN_FOLDER_ACTION_Y"
|
||||
@ -123,15 +123,15 @@ public:
|
||||
#define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y"
|
||||
#define OPEN_LATEST_COMIC_Y "OPEN_LATEST_COMIC_Y"
|
||||
|
||||
//COMMANDS YACReader
|
||||
//main_viewer_window
|
||||
// COMMANDS YACReader
|
||||
// main_viewer_window
|
||||
#define TOGGLE_FULL_SCREEN_ACTION_Y "TOGGLE_FULL_SCREEN_ACTION_Y"
|
||||
#define TOGGLE_TOOL_BARS_ACTION_Y "TOGGLE_TOOL_BARS_ACTION_Y"
|
||||
#define CHANGE_FIT_ACTION_Y "CHANGE_FIT_ACTION_Y"
|
||||
#define ZOOM_PLUS_ACTION_Y "ZOOM_PLUS_ACTION_Y"
|
||||
#define ZOOM_MINUS_ACTION_Y "ZOOM_MINUS_ACTION_Y"
|
||||
#define RESET_ZOOM_ACTION_Y "RESET_ZOOM_ACTION_Y"
|
||||
//viewer
|
||||
// viewer
|
||||
#define AUTO_SCROLL_FORWARD_ACTION_Y "AUTO_SCROLL_FORWARD_ACTION_Y"
|
||||
#define AUTO_SCROLL_BACKWARD_ACTION_Y "AUTO_SCROLL_BACKWARD_ACTION_Y"
|
||||
#define AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y"
|
||||
@ -144,7 +144,7 @@ public:
|
||||
#define MOVE_RIGHT_ACTION_Y "MOVE_RIGHT_ACTION_Y"
|
||||
#define GO_TO_FIRST_PAGE_ACTION_Y "GO_TO_FIRST_PAGE_ACTION_Y"
|
||||
#define GO_TO_LAST_PAGE_ACTION_Y "GO_TO_LAST_PAGE_ACTION_Y"
|
||||
//mglass
|
||||
// mglass
|
||||
#define SIZE_UP_MGLASS_ACTION_Y "SIZE_UP_MGLASS_ACTION_Y"
|
||||
#define SIZE_DOWN_MGLASS_ACTION_Y "SIZE_DOWN_MGLASS_ACTION_Y"
|
||||
#define ZOOM_IN_MGLASS_ACTION_Y "ZOOM_IN_MGLASS_ACTION_Y"
|
||||
|
Reference in New Issue
Block a user