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