diff options
| author | Max Audron <audron@cocaine.farm> | 2021-12-01 16:30:21 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-12-01 16:30:21 +0100 |
| commit | e70d4e7e7b457306d4580fd8530851867e819b63 (patch) | |
| tree | 1c690a99ef3c792c05e4f82d93b418b016cbc58d /src/message/signalproxy | |
| parent | add more bufferview details and fix logging (diff) | |
split bufferview into sepperate files
Diffstat (limited to '')
| -rw-r--r-- | src/message/signalproxy/objects/bufferviewconfig.rs (renamed from src/message/signalproxy/objects/bufferview.rs) | 51 | ||||
| -rw-r--r-- | src/message/signalproxy/objects/bufferviewmanager.rs | 61 | ||||
| -rw-r--r-- | src/message/signalproxy/objects/mod.rs | 6 |
3 files changed, 67 insertions, 51 deletions
diff --git a/src/message/signalproxy/objects/bufferview.rs b/src/message/signalproxy/objects/bufferviewconfig.rs index 5b4ab3c..3b82e7e 100644 --- a/src/message/signalproxy/objects/bufferview.rs +++ b/src/message/signalproxy/objects/bufferviewconfig.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, convert::TryFrom, convert::TryInto}; +use std::{convert::TryFrom, convert::TryInto}; use libquassel_derive::sync; use libquassel_derive::{NetworkList, NetworkMap}; @@ -11,54 +11,7 @@ use crate::message::StatefulSyncableClient; use crate::message::StatefulSyncableServer; use crate::message::Syncable; -use crate::primitive::{Variant, VariantList}; - -#[derive(Debug, Clone, PartialEq)] -// #[network(repr = "list")] -pub struct BufferViewManager { - // #[network(rename = "bufferViewConfigs", network, variant = "VariantMap")] - pub buffer_view_configs: HashMap<i32, BufferViewConfig>, - // // C->S calls - - // requestCreateBufferView(properties: QVariantMap) - // requestCreateBufferViews(properties: QVariantList) - // requestDeleteBufferView(bufferViewId: Int) - // requestDeleteBufferViews(bufferViews: QVariantList) - - // // S->C calls - - // addBufferViewConfig(bufferViewConfigId: Int) - // deleteBufferViewConfig(bufferViewConfigId: Int) - // newBufferViewConfig(bufferViewConfigId: Int) - // /** - // * Replaces all properties of the object with the content of the - // * "properties" parameter. This parameter is in network representation. - // */ - // update(properties: QVariantMap) -} - -impl super::NetworkList for BufferViewManager { - fn to_network_list(&self) -> VariantList { - let mut res = Vec::with_capacity(2); - - res.push(Variant::ByteArray(s!("bufferViewIds"))); - res.push(Variant::VariantList( - self.buffer_view_configs - .iter() - .map(|(k, _)| i32::try_into(*k).unwrap()) - .collect(), - )); - - return res; - } - - fn from_network_list(_input: &mut VariantList) -> Self { - // TODO Somehow do the initrequests for all the IDs we get here - Self { - buffer_view_configs: HashMap::new(), - } - } -} +use crate::primitive::VariantList; #[derive(Debug, Default, Clone, PartialEq, NetworkList, NetworkMap)] pub struct BufferViewConfig { diff --git a/src/message/signalproxy/objects/bufferviewmanager.rs b/src/message/signalproxy/objects/bufferviewmanager.rs new file mode 100644 index 0000000..1877c70 --- /dev/null +++ b/src/message/signalproxy/objects/bufferviewmanager.rs @@ -0,0 +1,61 @@ +use std::{collections::HashMap, convert::TryFrom, convert::TryInto}; + +use libquassel_derive::sync; +use libquassel_derive::{NetworkList, NetworkMap}; + +use crate::message::signalproxy::translation::Network; + +#[allow(unused_imports)] +use crate::message::StatefulSyncableClient; +#[allow(unused_imports)] +use crate::message::StatefulSyncableServer; +use crate::message::Syncable; + +use crate::primitive::{Variant, VariantList}; + +#[derive(Debug, Clone, PartialEq)] +// #[network(repr = "list")] +pub struct BufferViewManager { + // #[network(rename = "bufferViewConfigs", network, variant = "VariantMap")] + pub buffer_view_configs: HashMap<i32, super::BufferViewConfig>, + // // C->S calls + + // requestCreateBufferView(properties: QVariantMap) + // requestCreateBufferViews(properties: QVariantList) + // requestDeleteBufferView(bufferViewId: Int) + // requestDeleteBufferViews(bufferViews: QVariantList) + + // // S->C calls + + // addBufferViewConfig(bufferViewConfigId: Int) + // deleteBufferViewConfig(bufferViewConfigId: Int) + // newBufferViewConfig(bufferViewConfigId: Int) + // /** + // * Replaces all properties of the object with the content of the + // * "properties" parameter. This parameter is in network representation. + // */ + // update(properties: QVariantMap) +} + +impl super::NetworkList for BufferViewManager { + fn to_network_list(&self) -> VariantList { + let mut res = Vec::with_capacity(2); + + res.push(Variant::ByteArray(s!("bufferViewIds"))); + res.push(Variant::VariantList( + self.buffer_view_configs + .iter() + .map(|(k, _)| i32::try_into(*k).unwrap()) + .collect(), + )); + + return res; + } + + fn from_network_list(_input: &mut VariantList) -> Self { + // TODO Somehow do the initrequests for all the IDs we get here + Self { + buffer_view_configs: HashMap::new(), + } + } +} diff --git a/src/message/signalproxy/objects/mod.rs b/src/message/signalproxy/objects/mod.rs index 0b647f9..743392f 100644 --- a/src/message/signalproxy/objects/mod.rs +++ b/src/message/signalproxy/objects/mod.rs @@ -1,6 +1,7 @@ mod aliasmanager; mod buffersyncer; -mod bufferview; +mod bufferviewmanager; +mod bufferviewconfig; mod certmanager; mod coreinfo; mod highlightrulemanager; @@ -15,7 +16,8 @@ use std::convert::TryInto; pub use aliasmanager::*; pub use buffersyncer::*; -pub use bufferview::*; +pub use bufferviewmanager::*; +pub use bufferviewconfig::*; pub use certmanager::*; pub use coreinfo::*; pub use highlightrulemanager::*; |
