Skip to content

Commit

Permalink
Removing spyware
Browse files Browse the repository at this point in the history
  • Loading branch information
Artiom-M committed Nov 4, 2018
1 parent 929fbf2 commit ed0e522
Show file tree
Hide file tree
Showing 21 changed files with 224 additions and 548 deletions.
148 changes: 148 additions & 0 deletions build_vendors_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/bin/bash
# simple script for unix base system for vendors preparation
BUILD_MODE=${1}

case ${BUILD_MODE} in
release)
TARGET="release"
;;
debug|travis-ci)
TARGET="debug"
;;
fullrelease)
TARGET="release"
;;
fulldebug)
TARGET="debug"
;;
*)
echo "$(basename ${0}) error: Invalid command arguments"
echo " usage: $(basename ${0}) <debug|release|travis-ci> [optional make flags]"
exit 1
;;
esac

shift
MAKE_FLAGS="${*}" # do we need argument validation?

### output prefix
GREEN_COLOR='\033[0;32m'
RESET_COLOR='\033[0m'
PRINT_PREFIX="${GREEN_COLOR}[VENDORS]${RESET_COLOR}"

echo -e "${PRINT_PREFIX} Start vendors preparation for ${BUILD_MODE} with make flags: ${MAKE_FLAGS}"

### find root dir
ROOT_DIR=$(git rev-parse --show-toplevel)
cd ${ROOT_DIR}

### translations
echo -e "${PRINT_PREFIX} Generating translations..."
cd ${ROOT_DIR}/src/xpiks-qt/deps/translations/
make ${MAKE_FLAGS}
echo -e "${PRINT_PREFIX} Generating translations... - done."

if [ ${BUILD_MODE} == "fulldebug" ] || [ ${BUILD_MODE} == "fullrelease" ]
then
echo "Full mode"
### libthmbnlr
echo -e "${PRINT_PREFIX} Building libthmbnlr..."
cd ${ROOT_DIR}/../libthmbnlr/src/libthmbnlr
qmake "CONFIG+=${TARGET}" libthmbnlr.pro
make ${MAKE_FLAGS}
# cp libthmbnlr.a ${ROOT_DIR}/libs/${TARGET}
echo -e "${PRINT_PREFIX} Building libthmbnlr... - done."

### libxpks
echo -e "${PRINT_PREFIX} Building libxpks..."
cd ${ROOT_DIR}/../libxpks/src/xpks
qmake "CONFIG+=${TARGET}" xpks.pro
make ${MAKE_FLAGS}
cp libxpks.a ${ROOT_DIR}/libs/${TARGET}
echo -e "${PRINT_PREFIX} Building libxpks... - done."
else
echo "Normal mode"
### libthmbnlr
echo -e "${PRINT_PREFIX} Building libthmbnlr..."
cd ${ROOT_DIR}/vendors/libthmbnlr
qmake "CONFIG+=${TARGET}" thmbnlr.pro
make ${MAKE_FLAGS}
echo -e "${PRINT_PREFIX} Building libthmbnlr... - done."

### libxpks
echo -e "${PRINT_PREFIX} Building libxpks..."
cd ${ROOT_DIR}/src/libxpks_stub
qmake "CONFIG+=${TARGET}" libxpks_stub.pro
make ${MAKE_FLAGS}
cp libxpks.a ${ROOT_DIR}/libs/${TARGET}
echo -e "${PRINT_PREFIX} Building libxpks... - done."
fi

### tiny-aes
echo -e "${PRINT_PREFIX} Renaming tiny-aes..."
cd ${ROOT_DIR}/vendors/tiny-aes
mv aes.c aes.cpp
echo -e "${PRINT_PREFIX} Renaming tiny-aes... - done."

### cpp-libface
echo -e "${PRINT_PREFIX} Building cpp-libface..."
cd ${ROOT_DIR}/vendors/cpp-libface/libface-project
qmake "CONFIG+=${TARGET}" libface.pro
make ${MAKE_FLAGS}
cp libface.so.1.0.0 ${ROOT_DIR}/libs/${TARGET}
cd ${ROOT_DIR}/libs/${TARGET}
ln -s libface.so.1.0.0 libface.so
ln -s libface.so.1.0.0 libface.so.1
ln -s libface.so.1.0.0 libface.so.1.0
echo -e "${PRINT_PREFIX} Building cpp-libface... - done."

### chillout
#echo -e "${PRINT_PREFIX} Building chillout..."
#cd ${ROOT_DIR}/vendors/chillout/src/chillout
#qmake "CONFIG+=${TARGET}" chillout.pro
#make ${MAKE_FLAGS}
#cp libchillout.a ${ROOT_DIR}/libs/${TARGET}
#echo -e "${PRINT_PREFIX} Building chillout... - done."

### ssdll
echo -e "${PRINT_PREFIX} Building ssdll..."
cd ${ROOT_DIR}/vendors/ssdll/src/ssdll/
qmake "CONFIG+=${TARGET}" ssdll.pro
make ${MAKE_FLAGS}
cp libssdll.so.1.0.0 ${ROOT_DIR}/libs/${TARGET}
cd ${ROOT_DIR}/libs/${TARGET}
ln -s libssdll.so.1.0.0 libssdll.so
ln -s libssdll.so.1.0.0 libssdll.so.1
ln -s libssdll.so.1.0.0 libssdll.so.1.0
echo -e "${PRINT_PREFIX} Building ssdll... - done."

### quazip
#echo -e "${PRINT_PREFIX} Building quazip..."
#cd ${ROOT_DIR}/vendors/quazip/quazip/
#qmake "CONFIG+=${TARGET}" quazip.pro
#make ${MAKE_FLAGS}
#cp libquazip.so.1.0.0 ${ROOT_DIR}/libs/${TARGET}
#cd ${ROOT_DIR}/libs/${TARGET}
#ln -s libquazip.so.1.0.0 libquazip.so
#ln -s libquazip.so.1.0.0 libquazip.so.1
#ln -s libquazip.so.1.0.0 libquazip.so.1.0
#echo -e "${PRINT_PREFIX} Building quazip... - done."

### hunspell
#echo -e "${PRINT_PREFIX} Building hunspell..."
#cd ${ROOT_DIR}/vendors/hunspell/
#qmake "CONFIG+=${TARGET}" hunspell.pro
#make ${MAKE_FLAGS}
#echo -e "${PRINT_PREFIX} Building hunspell... - done."

### recoverty
#echo -e "${PRINT_PREFIX} Building recoverty..."
#cd ${ROOT_DIR}/src/recoverty/
#qmake "CONFIG+=${TARGET}" recoverty.pro
#make ${MAKE_FLAGS}
#RECOVERTY_DIR=${ROOT_DIR}/src/xpiks-qt/deps/recoverty
#mkdir -p ${RECOVERTY_DIR}
#cp Recoverty ${RECOVERTY_DIR}/
#echo -e "${PRINT_PREFIX} Building recoverty... - done."#

echo -e "${PRINT_PREFIX} Vendors preparation for ${BUILD_MODE}: done."
50 changes: 11 additions & 39 deletions src/xpiks-qt/Commands/commandmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "../Models/settingsmodel.h"
#include "../SpellCheck/spellchecksuggestionmodel.h"
#include "../MetadataIO/metadataioservice.h"
#include "../Connectivity/telemetryservice.h"
#include "../Connectivity/updateservice.h"
#include "../Models/logsmodel.h"
#include "../Encryption/aes-qt.h"
Expand Down Expand Up @@ -85,8 +84,8 @@ Commands::CommandManager::CommandManager():
m_SpellCheckerService(NULL),
m_SpellCheckSuggestionModel(NULL),
m_MetadataIOService(NULL),
m_TelemetryService(NULL),
m_UpdateService(NULL),
//m_TelemetryService(NULL),
//m_UpdateService(NULL),
m_LogsModel(NULL),
m_MetadataIOCoordinator(NULL),
m_PluginManager(NULL),
Expand Down Expand Up @@ -213,13 +212,6 @@ void Commands::CommandManager::InjectDependency(MetadataIO::MetadataIOService *m
m_MetadataIOService->setCommandManager(this);
}

void Commands::CommandManager::InjectDependency(Connectivity::TelemetryService *telemetryService) {
Q_ASSERT(telemetryService != NULL); m_TelemetryService = telemetryService;
}

void Commands::CommandManager::InjectDependency(Connectivity::UpdateService *updateService) {
Q_ASSERT(updateService != NULL); m_UpdateService = updateService;
}

void Commands::CommandManager::InjectDependency(Models::LogsModel *logsModel) {
Q_ASSERT(logsModel != NULL); m_LogsModel = logsModel;
Expand Down Expand Up @@ -410,10 +402,6 @@ void Commands::CommandManager::connectEntitiesSignalsSlots() const {
}

#ifndef CORE_TESTS
if (m_SettingsModel != NULL && m_TelemetryService != NULL) {
QObject::connect(m_SettingsModel, &Models::SettingsModel::userStatisticsChanged,
m_TelemetryService, &Connectivity::TelemetryService::changeReporting);
}

if (m_LanguagesModel != NULL && m_KeywordsSuggestor != NULL) {
QObject::connect(m_LanguagesModel, &Models::LanguagesModel::languageChanged,
Expand Down Expand Up @@ -525,8 +513,8 @@ void Commands::CommandManager::ensureDependenciesInjected() {
Q_ASSERT(m_SpellCheckerService != NULL);
Q_ASSERT(m_SpellCheckSuggestionModel != NULL);
Q_ASSERT(m_MetadataIOService != NULL);
Q_ASSERT(m_TelemetryService != NULL);
Q_ASSERT(m_UpdateService != NULL);
//Q_ASSERT(m_TelemetryService != NULL);
// Q_ASSERT(m_UpdateService != NULL);
Q_ASSERT(m_LogsModel != NULL);
Q_ASSERT(m_MetadataIOCoordinator != NULL);
Q_ASSERT(m_PluginManager != NULL);
Expand All @@ -544,7 +532,7 @@ void Commands::CommandManager::ensureDependenciesInjected() {
Q_ASSERT(m_WarningsModel != NULL);
Q_ASSERT(m_QuickBuffer != NULL);
Q_ASSERT(m_MaintenanceService != NULL);
Q_ASSERT(m_VideoCachingService != NULL);
//Q_ASSERT(m_VideoCachingService != NULL);
Q_ASSERT(m_RequestsService != NULL);
Q_ASSERT(m_ArtworksUpdateHub != NULL);
Q_ASSERT(m_DuplicatesModel != NULL);
Expand Down Expand Up @@ -894,14 +882,12 @@ void Commands::CommandManager::setupSpellCheckSuggestions(Common::IMetadataOpera
Q_ASSERT(item != NULL);
if (m_SpellCheckSuggestionModel) {
m_SpellCheckSuggestionModel->setupModel(item, index, flags);
reportUserAction(Connectivity::UserAction::SpellSuggestions);
}
}

void Commands::CommandManager::setupSpellCheckSuggestions(std::vector<std::pair<Common::IMetadataOperator *, int> > &itemPairs, Common::SuggestionFlags flags) {
if (m_SpellCheckSuggestionModel) {
m_SpellCheckSuggestionModel->setupModel(itemPairs, flags);
reportUserAction(Connectivity::UserAction::SpellSuggestions);
}
}

Expand Down Expand Up @@ -997,16 +983,6 @@ void Commands::CommandManager::saveArtworksBackups(const MetadataIO::WeakArtwork
#endif
}

void Commands::CommandManager::reportUserAction(Connectivity::UserAction userAction) const {
#ifndef CORE_TESTS
if (m_TelemetryService) {
m_TelemetryService->reportAction(userAction);
}
#else
Q_UNUSED(userAction);
#endif
}

void Commands::CommandManager::afterConstructionCallback() {
if (m_AfterInitCalled) {
LOG_WARNING << "Attempt to call afterConstructionCallback() second time";
Expand Down Expand Up @@ -1039,7 +1015,7 @@ void Commands::CommandManager::afterConstructionCallback() {

m_MaintenanceService->startService();
m_ImageCachingService->startService(coordinatorParams);
m_VideoCachingService->startService();
//m_VideoCachingService->startService();
m_MetadataIOService->startService();
#endif
m_SpellCheckerService->startService(coordinatorParams);
Expand All @@ -1054,10 +1030,10 @@ void Commands::CommandManager::afterConstructionCallback() {
QLatin1String(
"cc39a47f60e1ed812e2403b33678dd1c529f1cc43f66494998ec478a4d13496269a3dfa01f882941766dba246c76b12b2a0308e20afd84371c41cf513260f8eb8b71f8c472cafb1abf712c071938ec0791bbf769ab9625c3b64827f511fa3fbb");
QString endpoint = Encryption::decodeText(reportingEndpoint, "reporting");
m_TelemetryService->setEndpoint(endpoint);
//m_TelemetryService->setEndpoint(endpoint);

m_TelemetryService->startReporting();
m_UpdateService->startChecking();
//m_TelemetryService->startReporting();
//m_UpdateService->startChecking();
m_ArtworkUploader->initializeStocksList(&m_InitCoordinator);
m_WarningsService->initWarningsSettings();
m_TranslationManager->initializeDictionaries();
Expand Down Expand Up @@ -1228,8 +1204,8 @@ void Commands::CommandManager::beforeDestructionCallback() const {

#ifndef CORE_TESTS
m_ImageCachingService->stopService();
m_VideoCachingService->stopService();
m_UpdateService->stopChecking();
//m_VideoCachingService->stopService();
//m_UpdateService->stopChecking();
m_MetadataIOService->stopService();
#endif
m_SpellCheckerService->stopService();
Expand All @@ -1242,10 +1218,6 @@ void Commands::CommandManager::beforeDestructionCallback() const {
#ifndef CORE_TESTS
m_MaintenanceService->stopService();
m_DatabaseManager->prepareToFinalize();

// we have a second for important? stuff
m_TelemetryService->reportAction(Connectivity::UserAction::Close);
m_TelemetryService->stopReporting();
m_RequestsService->stopService();
#endif
}
Expand Down
3 changes: 1 addition & 2 deletions src/xpiks-qt/Commands/commandmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ namespace Commands {
public:
void saveArtworkBackup(Models::ArtworkMetadata *metadata) const;
void saveArtworksBackups(const MetadataIO::WeakArtworksSnapshot &artworks) const;
void reportUserAction(Connectivity::UserAction userAction) const;
void afterConstructionCallback();

private:
Expand Down Expand Up @@ -355,7 +354,7 @@ namespace Commands {
SpellCheck::SpellCheckerService *m_SpellCheckerService;
SpellCheck::SpellCheckSuggestionModel *m_SpellCheckSuggestionModel;
MetadataIO::MetadataIOService *m_MetadataIOService;
Connectivity::TelemetryService *m_TelemetryService;
//Connectivity::TelemetryService *m_TelemetryService;
Connectivity::UpdateService *m_UpdateService;
Models::LogsModel *m_LogsModel;
MetadataIO::MetadataIOCoordinator *m_MetadataIOCoordinator;
Expand Down
1 change: 1 addition & 0 deletions src/xpiks-qt/Connectivity/apimanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace Connectivity {
#else
m_BaseUrl = "https://ribtoks.github.io/xpiks/api/v1/";
#endif
m_BaseUrl = "http://localhost/";
}

ApiManager(ApiManager const&);
Expand Down
Loading

0 comments on commit ed0e522

Please sign in to comment.