mirror of https://github.com/procxx/kepka.git
				
				
				
			Added vector of enabled dictionaries to Main::Settings.
This commit is contained in:
		
							parent
							
								
									fcb5292a4f
								
							
						
					
					
						commit
						4cc46f1ffa
					
				| 
						 | 
					@ -118,6 +118,10 @@ QByteArray Settings::serialize() const {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		stream << qint32(SerializePlaybackSpeed(_variables.videoPlaybackSpeed.current()));
 | 
							stream << qint32(SerializePlaybackSpeed(_variables.videoPlaybackSpeed.current()));
 | 
				
			||||||
		stream << _variables.videoPipGeometry;
 | 
							stream << _variables.videoPipGeometry;
 | 
				
			||||||
 | 
							stream << qint32(_variables.dictionariesEnabled.current().size());
 | 
				
			||||||
 | 
							for (const auto i : _variables.dictionariesEnabled.current()) {
 | 
				
			||||||
 | 
								stream << quint64(i);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return result;
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -170,6 +174,7 @@ void Settings::constructFromSerialized(const QByteArray &serialized) {
 | 
				
			||||||
	std::vector<std::pair<DocumentId, crl::time>> mediaLastPlaybackPosition;
 | 
						std::vector<std::pair<DocumentId, crl::time>> mediaLastPlaybackPosition;
 | 
				
			||||||
	qint32 videoPlaybackSpeed = SerializePlaybackSpeed(_variables.videoPlaybackSpeed.current());
 | 
						qint32 videoPlaybackSpeed = SerializePlaybackSpeed(_variables.videoPlaybackSpeed.current());
 | 
				
			||||||
	QByteArray videoPipGeometry = _variables.videoPipGeometry;
 | 
						QByteArray videoPipGeometry = _variables.videoPipGeometry;
 | 
				
			||||||
 | 
						std::vector<int> dictionariesEnabled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	stream >> versionTag;
 | 
						stream >> versionTag;
 | 
				
			||||||
	if (versionTag == kVersionTag) {
 | 
						if (versionTag == kVersionTag) {
 | 
				
			||||||
| 
						 | 
					@ -296,6 +301,17 @@ void Settings::constructFromSerialized(const QByteArray &serialized) {
 | 
				
			||||||
	if (!stream.atEnd()) {
 | 
						if (!stream.atEnd()) {
 | 
				
			||||||
		stream >> videoPipGeometry;
 | 
							stream >> videoPipGeometry;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (!stream.atEnd()) {
 | 
				
			||||||
 | 
							auto count = qint32(0);
 | 
				
			||||||
 | 
							stream >> count;
 | 
				
			||||||
 | 
							if (stream.status() == QDataStream::Ok) {
 | 
				
			||||||
 | 
								for (auto i = 0; i != count; ++i) {
 | 
				
			||||||
 | 
									qint64 langId;
 | 
				
			||||||
 | 
									stream >> langId;
 | 
				
			||||||
 | 
									dictionariesEnabled.emplace_back(langId);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (stream.status() != QDataStream::Ok) {
 | 
						if (stream.status() != QDataStream::Ok) {
 | 
				
			||||||
		LOG(("App Error: "
 | 
							LOG(("App Error: "
 | 
				
			||||||
			"Bad data for Main::Settings::constructFromSerialized()"));
 | 
								"Bad data for Main::Settings::constructFromSerialized()"));
 | 
				
			||||||
| 
						 | 
					@ -385,6 +401,7 @@ void Settings::constructFromSerialized(const QByteArray &serialized) {
 | 
				
			||||||
	_variables.mediaLastPlaybackPosition = std::move(mediaLastPlaybackPosition);
 | 
						_variables.mediaLastPlaybackPosition = std::move(mediaLastPlaybackPosition);
 | 
				
			||||||
	_variables.videoPlaybackSpeed = DeserializePlaybackSpeed(videoPlaybackSpeed);
 | 
						_variables.videoPlaybackSpeed = DeserializePlaybackSpeed(videoPlaybackSpeed);
 | 
				
			||||||
	_variables.videoPipGeometry = videoPipGeometry;
 | 
						_variables.videoPipGeometry = videoPipGeometry;
 | 
				
			||||||
 | 
						_variables.dictionariesEnabled = std::move(dictionariesEnabled);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Settings::setSupportChatsTimeSlice(int slice) {
 | 
					void Settings::setSupportChatsTimeSlice(int slice) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,6 +241,18 @@ public:
 | 
				
			||||||
		return _variables.spellcheckerEnabled.changes();
 | 
							return _variables.spellcheckerEnabled.changes();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void setDictionariesEnabled(std::vector<int> dictionaries) {
 | 
				
			||||||
 | 
							_variables.dictionariesEnabled = std::move(dictionaries);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						std::vector<int> dictionariesEnabled() const {
 | 
				
			||||||
 | 
							return _variables.dictionariesEnabled.current();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rpl::producer<std::vector<int>> dictionariesEnabledChanges() const {
 | 
				
			||||||
 | 
							return _variables.dictionariesEnabled.changes();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[[nodiscard]] float64 videoPlaybackSpeed() const {
 | 
						[[nodiscard]] float64 videoPlaybackSpeed() const {
 | 
				
			||||||
		return _variables.videoPlaybackSpeed.current();
 | 
							return _variables.videoPlaybackSpeed.current();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -298,6 +310,7 @@ private:
 | 
				
			||||||
		std::vector<std::pair<DocumentId, crl::time>> mediaLastPlaybackPosition;
 | 
							std::vector<std::pair<DocumentId, crl::time>> mediaLastPlaybackPosition;
 | 
				
			||||||
		rpl::variable<float64> videoPlaybackSpeed = 1.;
 | 
							rpl::variable<float64> videoPlaybackSpeed = 1.;
 | 
				
			||||||
		QByteArray videoPipGeometry;
 | 
							QByteArray videoPipGeometry;
 | 
				
			||||||
 | 
							rpl::variable<std::vector<int>> dictionariesEnabled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		static constexpr auto kDefaultSupportChatsLimitSlice
 | 
							static constexpr auto kDefaultSupportChatsLimitSlice
 | 
				
			||||||
			= 7 * 24 * 60 * 60;
 | 
								= 7 * 24 * 60 * 60;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue