Merge branch 'master' into support_new_upload_endpoint
This commit is contained in:
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ActionManager
|
class ActionManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -72,8 +75,6 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> parsedFlags();
|
|
||||||
|
|
||||||
void printAction() noexcept;
|
void printAction() noexcept;
|
||||||
void printFlags() noexcept;
|
void printFlags() noexcept;
|
||||||
|
|
||||||
@@ -84,6 +85,7 @@ namespace Managers
|
|||||||
char **params;
|
char **params;
|
||||||
int paramCount;
|
int paramCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
|
|
||||||
class CommitManager
|
class CommitManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -21,6 +22,7 @@ namespace Managers
|
|||||||
|
|
||||||
void commitAction();
|
void commitAction();
|
||||||
|
|
||||||
|
|
||||||
enum class RetrieveTypes
|
enum class RetrieveTypes
|
||||||
{
|
{
|
||||||
songs
|
songs
|
||||||
@@ -49,8 +51,6 @@ namespace Managers
|
|||||||
|
|
||||||
std::map<std::string, ActionValues> mapActions() noexcept;
|
std::map<std::string, ActionValues> mapActions() noexcept;
|
||||||
|
|
||||||
Models::Token parseToken(Models::API);
|
|
||||||
|
|
||||||
void deleteSong();
|
void deleteSong();
|
||||||
void downloadSong();
|
void downloadSong();
|
||||||
void retrieveObjects();
|
void retrieveObjects();
|
||||||
@@ -204,7 +204,9 @@ namespace Managers
|
|||||||
|
|
||||||
|
|
||||||
Models::IcarusAction icaAction;
|
Models::IcarusAction icaAction;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
|
|
||||||
class FileManager
|
class FileManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -24,6 +25,7 @@ namespace Managers
|
|||||||
bool fileRead;
|
bool fileRead;
|
||||||
int fileBufferLength;
|
int fileBufferLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
|
|
||||||
class TokenManager
|
class TokenManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -18,6 +19,7 @@ namespace Managers
|
|||||||
Models::API api;
|
Models::API api;
|
||||||
Models::User user;
|
Models::User user;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
|
|
||||||
class UserManager
|
class UserManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -21,6 +22,7 @@ namespace Managers
|
|||||||
Models::User user;
|
Models::User user;
|
||||||
Models::IcarusAction icaAction;
|
Models::IcarusAction icaAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,12 +5,15 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
struct API
|
|
||||||
|
class API
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
std::string url;
|
std::string url;
|
||||||
std::string endpoint;
|
std::string endpoint;
|
||||||
std::string version;
|
std::string version;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,12 +5,21 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
class Flags
|
class Flags
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string flag;
|
std::string flag;
|
||||||
std::string value;
|
std::string value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct Flags
|
||||||
|
{
|
||||||
|
std::string flag;
|
||||||
|
std::string value;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
class IcarusAction
|
class IcarusAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -46,6 +47,7 @@ namespace Models
|
|||||||
std::string action;
|
std::string action;
|
||||||
std::vector<Flags> flags;
|
std::vector<Flags> flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
class Song
|
class Song
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -41,6 +42,7 @@ namespace Models
|
|||||||
std::string title;
|
std::string title;
|
||||||
std::string path;
|
std::string path;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,12 +5,14 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Token
|
struct Token
|
||||||
{
|
{
|
||||||
std::string accessToken;
|
std::string accessToken;
|
||||||
std::string tokenType;
|
std::string tokenType;
|
||||||
int expiration;
|
int expiration;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
struct UploadForm
|
struct UploadForm
|
||||||
{
|
{
|
||||||
std::string url;
|
std::string url;
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,11 +5,13 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
struct User
|
struct User
|
||||||
{
|
{
|
||||||
std::string username;
|
std::string username;
|
||||||
std::string password;
|
std::string password;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
namespace Parsers
|
namespace Parsers
|
||||||
{
|
{
|
||||||
|
|
||||||
class APIParser
|
class APIParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -18,6 +19,7 @@ namespace Parsers
|
|||||||
Models::API api;
|
Models::API api;
|
||||||
Models::IcarusAction icaAct;
|
Models::IcarusAction icaAct;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
class Delete : SyncerBase
|
class Delete : SyncerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -18,6 +19,7 @@ namespace Syncers
|
|||||||
private:
|
private:
|
||||||
std::string retrieveUrl(Models::Song);
|
std::string retrieveUrl(Models::Song);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
class Download : SyncerBase
|
class Download : SyncerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -26,6 +27,7 @@ namespace Syncers
|
|||||||
std::string downloadFilePath;
|
std::string downloadFilePath;
|
||||||
void saveSong(Models::Song&);
|
void saveSong(Models::Song&);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
class RetrieveRecords: public SyncerBase
|
class RetrieveRecords: public SyncerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -21,6 +22,7 @@ namespace Syncers
|
|||||||
Models::API api;
|
Models::API api;
|
||||||
Models::Token token;
|
Models::Token token;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
class SyncerBase
|
class SyncerBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -22,6 +23,7 @@ namespace Syncers
|
|||||||
NOTFOUND = 404
|
NOTFOUND = 404
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace fs = std::filesystem;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
class Upload
|
class Upload
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -47,6 +48,7 @@ namespace Syncers
|
|||||||
void printSongDetails(std::vector<Models::Song>&);
|
void printSongDetails(std::vector<Models::Song>&);
|
||||||
void printJsonData(const nlohmann::json&);
|
void printJsonData(const nlohmann::json&);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
|
|
||||||
class AboutWindow: public QDialog, public CommonWindow
|
class AboutWindow: public QDialog, public CommonWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -29,6 +30,7 @@ namespace UI
|
|||||||
private slots:
|
private slots:
|
||||||
void closeWindow();
|
void closeWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
#include<QPushButton>
|
#include<QPushButton>
|
||||||
|
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
|
||||||
class CommonWindow
|
class CommonWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -24,4 +27,7 @@ protected:
|
|||||||
std::unique_ptr<QVBoxLayout> subLayoutTwoQt;
|
std::unique_ptr<QVBoxLayout> subLayoutTwoQt;
|
||||||
int windowHeight, windowWidth;
|
int windowHeight, windowWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
|
|
||||||
class MainWindow: public QMainWindow, public CommonWindow
|
class MainWindow: public QMainWindow, public CommonWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -77,6 +78,7 @@ namespace UI
|
|||||||
void displaySoftwareInformation();
|
void displaySoftwareInformation();
|
||||||
void setCurrentIndex(int);
|
void setCurrentIndex(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
namespace Utilities
|
namespace Utilities
|
||||||
{
|
{
|
||||||
|
|
||||||
class Conversions
|
class Conversions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Conversions();
|
Conversions();
|
||||||
|
|
||||||
|
|
||||||
static void toLowerChar(char &c)
|
static void toLowerChar(char &c)
|
||||||
{
|
{
|
||||||
if (std::isalpha(c))
|
if (std::isalpha(c))
|
||||||
@@ -21,11 +21,9 @@ namespace Utilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initializeValues();
|
void initializeValues();
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void printValue(T);
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,16 +16,17 @@ using Models::IcarusAction;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
ActionManager::ActionManager(char **param, int paramCount) :
|
ActionManager::ActionManager(char **param, int paramCount) :
|
||||||
params(std::move(param)), paramCount(paramCount)
|
params(std::move(param)), paramCount(paramCount)
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
#pragma Constructors
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
IcarusAction ActionManager::retrieveIcarusAction() const
|
IcarusAction ActionManager::retrieveIcarusAction() const
|
||||||
{
|
{
|
||||||
IcarusAction icarusAction;
|
IcarusAction icarusAction;
|
||||||
@@ -35,6 +36,14 @@ namespace Managers
|
|||||||
return icarusAction;
|
return icarusAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ActionManager::isNumber(string_view val) noexcept
|
||||||
|
{
|
||||||
|
return !val.empty() && std::find_if(val.begin(),
|
||||||
|
val.end(), [](char c)
|
||||||
|
{
|
||||||
|
return !std::isdigit(c);
|
||||||
|
}) == val.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ActionManager::initialize()
|
void ActionManager::initialize()
|
||||||
@@ -45,7 +54,6 @@ namespace Managers
|
|||||||
transform(action.begin(), action.end(),
|
transform(action.begin(), action.end(),
|
||||||
action.begin(), ::tolower);
|
action.begin(), ::tolower);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionManager::validateFlags()
|
void ActionManager::validateFlags()
|
||||||
{
|
{
|
||||||
cout<<"Validating flags\n";
|
cout<<"Validating flags\n";
|
||||||
@@ -80,19 +88,18 @@ namespace Managers
|
|||||||
|
|
||||||
vector<string> ActionManager::parsedFlags()
|
vector<string> ActionManager::parsedFlags()
|
||||||
{
|
{
|
||||||
vector<string> parsed;
|
auto parsed = vector<string>();
|
||||||
parsed.reserve(paramCount);
|
|
||||||
|
|
||||||
for (auto i = 2; i < paramCount; ++i)
|
for (auto i = 2; i < paramCount; ++i)
|
||||||
{
|
{
|
||||||
const std::string flag(std::move(*(params + i)));
|
const std::string flag(std::move(*(params + i)));
|
||||||
parsed.emplace_back(std::move(flag));
|
parsed.push_back(std::move(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma
|
#pragma region Testing
|
||||||
void ActionManager::printAction() noexcept
|
void ActionManager::printAction() noexcept
|
||||||
{
|
{
|
||||||
if (action.empty())
|
if (action.empty())
|
||||||
@@ -113,6 +120,7 @@ namespace Managers
|
|||||||
cout<<"value "<<flag.value<<endl;
|
cout<<"value "<<flag.value<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma Testing
|
#pragma endregion
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,13 +40,14 @@ namespace filesystem = std::filesystem;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
CommitManager::CommitManager(IcarusAction& icaAct) : icaAction(std::move(icaAct))
|
CommitManager::CommitManager(IcarusAction& icaAct) : icaAction(std::move(icaAct))
|
||||||
{ }
|
{ }
|
||||||
#pragma Constructors
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
void CommitManager::commitAction()
|
void CommitManager::commitAction()
|
||||||
{
|
{
|
||||||
auto action = icaAction.action;
|
auto action = icaAction.action;
|
||||||
@@ -75,7 +76,9 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum class ActionValues;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::map<std::string, CommitManager::ActionValues>
|
std::map<std::string, CommitManager::ActionValues>
|
||||||
CommitManager::mapActions() noexcept
|
CommitManager::mapActions() noexcept
|
||||||
@@ -92,6 +95,8 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Token CommitManager::parseToken(API api)
|
Token CommitManager::parseToken(API api)
|
||||||
{
|
{
|
||||||
cout<<"fetching token\n";
|
cout<<"fetching token\n";
|
||||||
@@ -186,6 +191,7 @@ namespace Managers
|
|||||||
songs.retrieve(retrieveType);
|
songs.retrieve(retrieveType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommitManager::uploadSong()
|
void CommitManager::uploadSong()
|
||||||
{
|
{
|
||||||
auto uploadSingleSong = true;
|
auto uploadSingleSong = true;
|
||||||
@@ -234,6 +240,8 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CommitManager::uploadSongWithMetadata()
|
void CommitManager::uploadSongWithMetadata()
|
||||||
{
|
{
|
||||||
cout<<"Uploading single song with metadata\n\n";
|
cout<<"Uploading single song with metadata\n\n";
|
||||||
@@ -425,5 +433,6 @@ namespace Managers
|
|||||||
std::cout<<"\n";
|
std::cout<<"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma Functions
|
#pragma region Functions
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,14 +11,18 @@ using std::string;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#pragma region Constructors
|
||||||
FileManager::FileManager() {}
|
FileManager::FileManager() {}
|
||||||
FileManager::FileManager(string filePath)
|
FileManager::FileManager(string filePath)
|
||||||
{
|
{
|
||||||
this->filePath = filePath;
|
this->filePath = filePath;
|
||||||
readFile();
|
readFile();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
#pragma region Functions
|
||||||
void FileManager::saveFile(string newFilePath)
|
void FileManager::saveFile(string newFilePath)
|
||||||
{
|
{
|
||||||
if (!fileRead)
|
if (!fileRead)
|
||||||
@@ -63,4 +67,7 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
int FileManager::retrieveFileBufferLength() const { return fileBufferLength; }
|
int FileManager::retrieveFileBufferLength() const { return fileBufferLength; }
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ using Models::User;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
TokenManager::TokenManager(const User& user)
|
TokenManager::TokenManager(const User& user)
|
||||||
{
|
{
|
||||||
this->user = user;
|
this->user = user;
|
||||||
@@ -29,10 +30,10 @@ namespace Managers
|
|||||||
this->api.endpoint = "api/" + api.version
|
this->api.endpoint = "api/" + api.version
|
||||||
+ "/login";
|
+ "/login";
|
||||||
}
|
}
|
||||||
#pragma Constructors
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
Token TokenManager::requestToken()
|
Token TokenManager::requestToken()
|
||||||
{
|
{
|
||||||
Token token{};
|
Token token{};
|
||||||
@@ -56,5 +57,6 @@ namespace Managers
|
|||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ using Models::User;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
UserManager::UserManager(User user)
|
UserManager::UserManager(User user)
|
||||||
{
|
{
|
||||||
this->user = user;
|
this->user = user;
|
||||||
@@ -23,10 +24,10 @@ namespace Managers
|
|||||||
this->user = User{};
|
this->user = User{};
|
||||||
parseUserFromActions();
|
parseUserFromActions();
|
||||||
}
|
}
|
||||||
#pragma Constructors
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
User UserManager::retrieveUser() const
|
User UserManager::retrieveUser() const
|
||||||
{
|
{
|
||||||
return user;
|
return user;
|
||||||
@@ -49,5 +50,6 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ using Models::IcarusAction;
|
|||||||
|
|
||||||
namespace Parsers
|
namespace Parsers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
APIParser::APIParser(IcarusAction icaAct) : icaAct(icaAct)
|
APIParser::APIParser(IcarusAction icaAct) : icaAct(icaAct)
|
||||||
{
|
{
|
||||||
api = API{};
|
api = API{};
|
||||||
@@ -19,7 +20,7 @@ namespace Parsers
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
API APIParser::retrieveAPI() const
|
API APIParser::retrieveAPI() const
|
||||||
{
|
{
|
||||||
return api;
|
return api;
|
||||||
@@ -40,10 +41,13 @@ namespace Parsers
|
|||||||
api.url = (value[value.size()-1] == '/') ? value : value + "/";
|
api.url = (value[value.size()-1] == '/') ? value : value + "/";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: For now I will hard code
|
||||||
|
// the api version since I am only
|
||||||
|
// on version 1
|
||||||
api.version = "v1";
|
api.version = "v1";
|
||||||
}
|
}
|
||||||
#pragma functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,17 @@ using Models::Token;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
Delete::Delete(API api)
|
Delete::Delete(API api)
|
||||||
{
|
{
|
||||||
this->api = api;
|
this->api = api;
|
||||||
this->api.endpoint = "song/data";
|
this->api.endpoint = "song/data";
|
||||||
}
|
}
|
||||||
#pragma Constructors
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
void Delete::deleteSong(const Token token, Song song)
|
void Delete::deleteSong(const Token token, Song song)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -58,5 +59,6 @@ namespace Syncers
|
|||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ using Models::Token;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
|
#pragma region Constructors
|
||||||
Download::Download() { }
|
Download::Download() { }
|
||||||
Download::Download(API api)
|
Download::Download(API api)
|
||||||
{
|
{
|
||||||
@@ -29,10 +30,10 @@ namespace Syncers
|
|||||||
{
|
{
|
||||||
downloadFilePath = filePath;
|
downloadFilePath = filePath;
|
||||||
}
|
}
|
||||||
#pragma Constructors
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
void Download::downloadSong(const Token token, Song song)
|
void Download::downloadSong(const Token token, Song song)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -87,5 +88,6 @@ namespace Syncers
|
|||||||
saveSong.write(data, bufferLength);
|
saveSong.write(data, bufferLength);
|
||||||
saveSong.close();
|
saveSong.close();
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,13 @@ using Utilities::Conversions;
|
|||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#pragma region Constructors
|
||||||
RetrieveRecords::RetrieveRecords() { }
|
RetrieveRecords::RetrieveRecords() { }
|
||||||
RetrieveRecords::RetrieveRecords(API api, Token token)
|
RetrieveRecords::RetrieveRecords(API api, Token token)
|
||||||
: token(token), api(api) { }
|
: token(token), api(api) { }
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma region Functions
|
||||||
void RetrieveRecords::retrieve(CommitManager::RetrieveTypes type)
|
void RetrieveRecords::retrieve(CommitManager::RetrieveTypes type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
@@ -59,4 +62,6 @@ namespace Syncers
|
|||||||
writeData<<songData.dump(4);
|
writeData<<songData.dump(4);
|
||||||
writeData.close();
|
writeData.close();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-13
@@ -25,6 +25,16 @@ using namespace cpr;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#pragma region Constructors
|
||||||
|
Upload::Upload() { }
|
||||||
|
Upload::Upload(API api) : api(api)
|
||||||
|
{
|
||||||
|
this->api.endpoint = "song/data";
|
||||||
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma region Functions
|
#pragma region Functions
|
||||||
Song Upload::uploadSong(Song& song)
|
Song Upload::uploadSong(Song& song)
|
||||||
{
|
{
|
||||||
@@ -89,8 +99,9 @@ namespace Syncers
|
|||||||
|
|
||||||
if (!confirmUpload)
|
if (!confirmUpload)
|
||||||
{
|
{
|
||||||
cout << "exiting...\n";
|
confirmUpload = false;
|
||||||
std::exit(-1);
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "uploading songs\n";
|
cout << "uploading songs\n";
|
||||||
@@ -210,17 +221,7 @@ namespace Syncers
|
|||||||
|
|
||||||
|
|
||||||
#pragma region Testing
|
#pragma region Testing
|
||||||
void Upload::printSongDetails()
|
|
||||||
{
|
|
||||||
cout<<"Song details: "<<endl;
|
|
||||||
cout<<"Id: "<<song.id<<endl;
|
|
||||||
cout<<"Title: "<<song.title<<endl;
|
|
||||||
cout<<"Artist: "<<song.artist<<endl;
|
|
||||||
cout<<"Album: "<<song.album<<endl;
|
|
||||||
cout<<"Genre: "<<song.genre<<endl;
|
|
||||||
cout<<"Year: "<<song.year<<endl;
|
|
||||||
cout<<"Duration: "<<song.duration<<endl;
|
|
||||||
}
|
|
||||||
void Upload::printSongDetails(std::vector<Song>& songs)
|
void Upload::printSongDetails(std::vector<Song>& songs)
|
||||||
{
|
{
|
||||||
for (auto& song: songs)
|
for (auto& song: songs)
|
||||||
@@ -236,6 +237,7 @@ namespace Syncers
|
|||||||
cout<<"Path: "<<song.songPath<<endl;
|
cout<<"Path: "<<song.songPath<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Upload::printJsonData(const json& obj)
|
void Upload::printJsonData(const json& obj)
|
||||||
{
|
{
|
||||||
cout<<endl<<endl<<"JSon data: "<<endl;
|
cout<<endl<<endl<<"JSon data: "<<endl;
|
||||||
@@ -252,4 +254,5 @@ namespace Syncers
|
|||||||
}
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ using std::unique_ptr;
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
|
#pragma region Constructors
|
||||||
AboutWindow::AboutWindow(QWidget* parent): QDialog(parent)
|
AboutWindow::AboutWindow(QWidget* parent): QDialog(parent)
|
||||||
{
|
{
|
||||||
setupWindow();
|
setupWindow();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
#pragma region Functions
|
||||||
void AboutWindow::setupWindow()
|
void AboutWindow::setupWindow()
|
||||||
{
|
{
|
||||||
windowWidth = 250;
|
windowWidth = 250;
|
||||||
@@ -44,4 +47,6 @@ namespace UI
|
|||||||
{
|
{
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,17 @@ using Syncers::Upload;
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#pragma region Constructors
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
{
|
{
|
||||||
setupMainWindow();
|
setupMainWindow();
|
||||||
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
|
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
#pragma region Functions
|
||||||
void MainWindow::configureDownloadSection()
|
void MainWindow::configureDownloadSection()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -171,4 +175,6 @@ namespace UI
|
|||||||
|
|
||||||
uploadSongQt->setEnabled(true);
|
uploadSongQt->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using std::unique_ptr;
|
|||||||
|
|
||||||
namespace Utilities
|
namespace Utilities
|
||||||
{
|
{
|
||||||
|
|
||||||
Conversions::Conversions()
|
Conversions::Conversions()
|
||||||
{
|
{
|
||||||
initializeValues();
|
initializeValues();
|
||||||
@@ -21,4 +22,5 @@ namespace Utilities
|
|||||||
std::cout<<"going to print value"<<std::endl;
|
std::cout<<"going to print value"<<std::endl;
|
||||||
std::cout<<val<<std::endl;
|
std::cout<<val<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user