mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-23 00:56:21 +03:00
commit
0f7855d2f5
@ -87,8 +87,6 @@ class Action
|
||||
static const char* m_LockCursorModeNames[];
|
||||
};
|
||||
|
||||
typedef QList<Action> ActionList;
|
||||
|
||||
QTextStream& operator<<(QTextStream& outStream, const Action& action);
|
||||
|
||||
#endif
|
||||
|
@ -47,7 +47,7 @@ void Hotkey::loadSettings(QSettings& settings)
|
||||
settings.setArrayIndex(i);
|
||||
Action a;
|
||||
a.loadSettings(settings);
|
||||
m_Actions.append(a);
|
||||
m_Actions.push_back(a);
|
||||
}
|
||||
|
||||
settings.endArray();
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "Action.h"
|
||||
#include "KeySequence.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class HotkeyDialog;
|
||||
class ServerConfigDialog;
|
||||
class QSettings;
|
||||
@ -40,10 +42,10 @@ class Hotkey
|
||||
const KeySequence& keySequence() const { return m_KeySequence; }
|
||||
void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; }
|
||||
|
||||
const ActionList& actions() const { return m_Actions; }
|
||||
void appendAction(const Action& action) { m_Actions.append(action); }
|
||||
const std::vector<Action>& actions() const { return m_Actions; }
|
||||
void appendAction(const Action& action) { m_Actions.push_back(action); }
|
||||
void setAction(int index, const Action& action) { m_Actions[index] = action; }
|
||||
void removeAction(int index) { m_Actions.removeAt(index); }
|
||||
void removeAction(int index) { m_Actions.erase(m_Actions.begin() + index); }
|
||||
|
||||
void loadSettings(QSettings& settings);
|
||||
void saveSettings(QSettings& settings) const;
|
||||
@ -51,11 +53,9 @@ class Hotkey
|
||||
|
||||
private:
|
||||
KeySequence m_KeySequence;
|
||||
ActionList m_Actions;
|
||||
std::vector<Action> m_Actions;
|
||||
};
|
||||
|
||||
typedef QList<Hotkey> HotkeyList;
|
||||
|
||||
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey);
|
||||
|
||||
#endif
|
||||
|
@ -101,8 +101,6 @@ class Screen : public BaseConfig
|
||||
bool m_Swapped;
|
||||
};
|
||||
|
||||
typedef QList<Screen> ScreenList;
|
||||
|
||||
QDataStream& operator<<(QDataStream& outStream, const Screen& screen);
|
||||
QDataStream& operator>>(QDataStream& inStream, Screen& screen);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
const QString ScreenSetupModel::m_MimeType = "application/x-qbarrier-screen";
|
||||
|
||||
ScreenSetupModel::ScreenSetupModel(ScreenList& screens, int numColumns, int numRows) :
|
||||
ScreenSetupModel::ScreenSetupModel(std::vector<Screen>& screens, int numColumns, int numRows) :
|
||||
QAbstractTableModel(NULL),
|
||||
m_Screens(screens),
|
||||
m_NumColumns(numColumns),
|
||||
|
@ -38,7 +38,7 @@ class ScreenSetupModel : public QAbstractTableModel
|
||||
friend class ServerConfigDialog;
|
||||
|
||||
public:
|
||||
ScreenSetupModel(ScreenList& screens, int numColumns, int numRows);
|
||||
ScreenSetupModel(std::vector<Screen>& screens, int numColumns, int numRows);
|
||||
|
||||
public:
|
||||
static const QString& mimeType() { return m_MimeType; }
|
||||
@ -60,7 +60,7 @@ class ScreenSetupModel : public QAbstractTableModel
|
||||
Screen& screen(int column, int row) { return m_Screens[row * m_NumColumns + column]; }
|
||||
|
||||
private:
|
||||
ScreenList& m_Screens;
|
||||
std::vector<Screen>& m_Screens;
|
||||
const int m_NumColumns;
|
||||
const int m_NumRows;
|
||||
|
||||
|
@ -183,7 +183,7 @@ void ServerConfig::loadSettings()
|
||||
settings().setArrayIndex(i);
|
||||
Hotkey h;
|
||||
h.loadSettings(settings());
|
||||
hotkeys().append(h);
|
||||
hotkeys().push_back(h);
|
||||
}
|
||||
settings().endArray();
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ServerConfig : public BaseConfig
|
||||
~ServerConfig();
|
||||
|
||||
public:
|
||||
const ScreenList& screens() const { return m_Screens; }
|
||||
const std::vector<Screen>& screens() const { return m_Screens; }
|
||||
int numColumns() const { return m_NumColumns; }
|
||||
int numRows() const { return m_NumRows; }
|
||||
bool hasHeartbeat() const { return m_HasHeartbeat; }
|
||||
@ -59,7 +59,7 @@ class ServerConfig : public BaseConfig
|
||||
bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast<int>(c)]; }
|
||||
int switchCornerSize() const { return m_SwitchCornerSize; }
|
||||
const QList<bool>& switchCorners() const { return m_SwitchCorners; }
|
||||
const HotkeyList& hotkeys() const { return m_Hotkeys; }
|
||||
const std::vector<Hotkey>& hotkeys() const { return m_Hotkeys; }
|
||||
bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; }
|
||||
bool enableDragAndDrop() const { return m_EnableDragAndDrop; }
|
||||
bool clipboardSharing() const { return m_ClipboardSharing; }
|
||||
@ -73,9 +73,9 @@ class ServerConfig : public BaseConfig
|
||||
|
||||
protected:
|
||||
QSettings& settings() { return *m_pSettings; }
|
||||
ScreenList& screens() { return m_Screens; }
|
||||
void setScreens(const ScreenList& screens) { m_Screens = screens; }
|
||||
void addScreen(const Screen& screen) { m_Screens.append(screen); }
|
||||
std::vector<Screen>& screens() { return m_Screens; }
|
||||
void setScreens(const std::vector<Screen>& screens) { m_Screens = screens; }
|
||||
void addScreen(const Screen& screen) { m_Screens.push_back(screen); }
|
||||
void setNumColumns(int n) { m_NumColumns = n; }
|
||||
void setNumRows(int n) { m_NumRows = n; }
|
||||
void haveHeartbeat(bool on) { m_HasHeartbeat = on; }
|
||||
@ -93,7 +93,7 @@ class ServerConfig : public BaseConfig
|
||||
void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; }
|
||||
void setClipboardSharing(bool on) { m_ClipboardSharing = on; }
|
||||
QList<bool>& switchCorners() { return m_SwitchCorners; }
|
||||
HotkeyList& hotkeys() { return m_Hotkeys; }
|
||||
std::vector<Hotkey>& hotkeys() { return m_Hotkeys; }
|
||||
|
||||
void init();
|
||||
int adjacentScreenIndex(int idx, int deltaColumn, int deltaRow) const;
|
||||
@ -106,7 +106,7 @@ class ServerConfig : public BaseConfig
|
||||
|
||||
private:
|
||||
QSettings* m_pSettings;
|
||||
ScreenList m_Screens;
|
||||
std::vector<Screen> m_Screens;
|
||||
int m_NumColumns;
|
||||
int m_NumRows;
|
||||
bool m_HasHeartbeat;
|
||||
@ -120,7 +120,7 @@ class ServerConfig : public BaseConfig
|
||||
int m_SwitchDoubleTap;
|
||||
int m_SwitchCornerSize;
|
||||
QList<bool> m_SwitchCorners;
|
||||
HotkeyList m_Hotkeys;
|
||||
std::vector<Hotkey> m_Hotkeys;
|
||||
QString m_ServerName;
|
||||
bool m_IgnoreAutoConfigClient;
|
||||
bool m_EnableDragAndDrop;
|
||||
|
@ -121,7 +121,7 @@ void ServerConfigDialog::on_m_pButtonNewHotkey_clicked()
|
||||
HotkeyDialog dlg(this, hotkey);
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
serverConfig().hotkeys().append(hotkey);
|
||||
serverConfig().hotkeys().push_back(hotkey);
|
||||
m_pListHotkeys->addItem(hotkey.text());
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ void ServerConfigDialog::on_m_pButtonRemoveHotkey_clicked()
|
||||
{
|
||||
int idx = m_pListHotkeys->currentRow();
|
||||
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
|
||||
serverConfig().hotkeys().removeAt(idx);
|
||||
serverConfig().hotkeys().erase(serverConfig().hotkeys().begin() + idx);
|
||||
m_pListActions->clear();
|
||||
delete m_pListHotkeys->item(idx);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user