Merge branch 'master' into support_new_upload_endpoint
This commit is contained in:
@@ -12,13 +12,16 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
class ActionManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
class ActionManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
ActionManager(char**, int);
|
ActionManager(char**, int);
|
||||||
|
|
||||||
Models::IcarusAction retrieveIcarusAction() const;
|
Models::IcarusAction retrieveIcarusAction() const;
|
||||||
private:
|
private:
|
||||||
constexpr std::array<const char*, 16> supportedFlags() noexcept
|
constexpr std::array<const char*, 16> supportedFlags() noexcept
|
||||||
{
|
{
|
||||||
constexpr std::array<const char*, 16> allFlags{"-u", "-p", "-t", "-h", "-s",
|
constexpr std::array<const char*, 16> allFlags{"-u", "-p", "-t", "-h", "-s",
|
||||||
@@ -72,8 +75,6 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> parsedFlags();
|
|
||||||
|
|
||||||
void printAction() noexcept;
|
void printAction() noexcept;
|
||||||
void printFlags() noexcept;
|
void printFlags() noexcept;
|
||||||
|
|
||||||
@@ -83,7 +84,8 @@ namespace Managers
|
|||||||
|
|
||||||
char **params;
|
char **params;
|
||||||
int paramCount;
|
int paramCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,13 +14,15 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
class CommitManager
|
|
||||||
{
|
class CommitManager
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
CommitManager(Models::IcarusAction&);
|
CommitManager(Models::IcarusAction&);
|
||||||
|
|
||||||
void commitAction();
|
void commitAction();
|
||||||
|
|
||||||
|
|
||||||
enum class RetrieveTypes
|
enum class RetrieveTypes
|
||||||
{
|
{
|
||||||
songs
|
songs
|
||||||
@@ -44,13 +46,11 @@ namespace Managers
|
|||||||
std::vector<Models::Song> songs;
|
std::vector<Models::Song> songs;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class ActionValues;
|
enum class ActionValues;
|
||||||
|
|
||||||
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,9 +5,10 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
class FileManager
|
|
||||||
{
|
class FileManager
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
FileManager();
|
FileManager();
|
||||||
FileManager(std::string);
|
FileManager(std::string);
|
||||||
|
|
||||||
@@ -16,14 +17,15 @@ namespace Managers
|
|||||||
|
|
||||||
char* retrieveFileBuffer() const;
|
char* retrieveFileBuffer() const;
|
||||||
int retrieveFileBufferLength() const;
|
int retrieveFileBufferLength() const;
|
||||||
private:
|
private:
|
||||||
void readFile();
|
void readFile();
|
||||||
|
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
char* fileBuffer;
|
char* fileBuffer;
|
||||||
bool fileRead;
|
bool fileRead;
|
||||||
int fileBufferLength;
|
int fileBufferLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,17 +7,19 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
class TokenManager
|
|
||||||
{
|
class TokenManager
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
TokenManager(const Models::User&);
|
TokenManager(const Models::User&);
|
||||||
TokenManager(const Models::User&, Models::API&);
|
TokenManager(const Models::User&, Models::API&);
|
||||||
|
|
||||||
Models::Token requestToken();
|
Models::Token requestToken();
|
||||||
private:
|
private:
|
||||||
Models::API api;
|
Models::API api;
|
||||||
Models::User user;
|
Models::User user;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,19 +8,21 @@
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
class UserManager
|
|
||||||
{
|
class UserManager
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
UserManager(Models::User);
|
UserManager(Models::User);
|
||||||
UserManager(const Models::IcarusAction);
|
UserManager(const Models::IcarusAction);
|
||||||
|
|
||||||
Models::User retrieveUser() const;
|
Models::User retrieveUser() const;
|
||||||
private:
|
private:
|
||||||
void parseUserFromActions();
|
void parseUserFromActions();
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
+13
-4
@@ -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,9 +11,10 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
class IcarusAction
|
|
||||||
{
|
class IcarusAction
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
std::string retrieveFlagValue(const std::string_view flag)
|
std::string retrieveFlagValue(const std::string_view flag)
|
||||||
{
|
{
|
||||||
std::string value;
|
std::string value;
|
||||||
@@ -45,7 +46,8 @@ namespace Models
|
|||||||
|
|
||||||
std::string action;
|
std::string action;
|
||||||
std::vector<Flags> flags;
|
std::vector<Flags> flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-8
@@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
class Song
|
|
||||||
{
|
class Song
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
Song() = default;
|
Song() = default;
|
||||||
|
|
||||||
void printInfo()
|
void printInfo()
|
||||||
@@ -32,15 +33,16 @@ namespace Models
|
|||||||
int disc;
|
int disc;
|
||||||
std::string data;
|
std::string data;
|
||||||
std::string songPath;
|
std::string songPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CoverArt
|
class CoverArt
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int id;
|
int id;
|
||||||
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,18 +6,20 @@
|
|||||||
|
|
||||||
namespace Parsers
|
namespace Parsers
|
||||||
{
|
{
|
||||||
class APIParser
|
|
||||||
{
|
class APIParser
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
APIParser(Models::IcarusAction);
|
APIParser(Models::IcarusAction);
|
||||||
|
|
||||||
Models::API retrieveAPI() const;
|
Models::API retrieveAPI() const;
|
||||||
private:
|
private:
|
||||||
void parseAPI();
|
void parseAPI();
|
||||||
|
|
||||||
Models::API api;
|
Models::API api;
|
||||||
Models::IcarusAction icaAct;
|
Models::IcarusAction icaAct;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,15 +9,17 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
class Delete : SyncerBase
|
|
||||||
{
|
class Delete : SyncerBase
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
Delete(Models::API);
|
Delete(Models::API);
|
||||||
|
|
||||||
void deleteSong(const Models::Token, Models::Song);
|
void deleteSong(const Models::Token, Models::Song);
|
||||||
private:
|
private:
|
||||||
std::string retrieveUrl(Models::Song);
|
std::string retrieveUrl(Models::Song);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,20 +12,22 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
class Download : SyncerBase
|
|
||||||
{
|
class Download : SyncerBase
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
Download();
|
Download();
|
||||||
Download(Models::API);
|
Download(Models::API);
|
||||||
Download(std::string);
|
Download(std::string);
|
||||||
|
|
||||||
void downloadSong(const Models::Token token, Models::Song);
|
void downloadSong(const Models::Token token, Models::Song);
|
||||||
private:
|
private:
|
||||||
std::string retrieveUrl(Models::Song);
|
std::string retrieveUrl(Models::Song);
|
||||||
|
|
||||||
std::string downloadFilePath;
|
std::string downloadFilePath;
|
||||||
void saveSong(Models::Song&);
|
void saveSong(Models::Song&);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,19 +8,21 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
class RetrieveRecords: public SyncerBase
|
|
||||||
{
|
class RetrieveRecords: public SyncerBase
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
RetrieveRecords();
|
RetrieveRecords();
|
||||||
RetrieveRecords(Models::API, Models::Token);
|
RetrieveRecords(Models::API, Models::Token);
|
||||||
|
|
||||||
void retrieve(Managers::CommitManager::RetrieveTypes);
|
void retrieve(Managers::CommitManager::RetrieveTypes);
|
||||||
private:
|
private:
|
||||||
void fetchSongs();
|
void fetchSongs();
|
||||||
|
|
||||||
Models::API api;
|
Models::API api;
|
||||||
Models::Token token;
|
Models::Token token;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
class SyncerBase
|
|
||||||
{
|
class SyncerBase
|
||||||
protected:
|
{
|
||||||
|
protected:
|
||||||
Models::API api;
|
Models::API api;
|
||||||
const int OK = 200;
|
const int OK = 200;
|
||||||
const int UNAUTHORIZED = 401;
|
const int UNAUTHORIZED = 401;
|
||||||
@@ -21,7 +22,8 @@ namespace Syncers
|
|||||||
UNAUTHORIZED = 401,
|
UNAUTHORIZED = 401,
|
||||||
NOTFOUND = 404
|
NOTFOUND = 404
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ namespace fs = std::filesystem;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
class Upload
|
|
||||||
{
|
class Upload
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
Upload(Models::API api, Models::Token token) : m_token(token), api(api)
|
Upload(Models::API api, Models::Token token) : m_token(token), api(api)
|
||||||
{
|
{
|
||||||
this->api.endpoint = "song/data";
|
this->api.endpoint = "song/data";
|
||||||
@@ -30,7 +31,7 @@ namespace Syncers
|
|||||||
Models::Song uploadSong(Models::Song&);
|
Models::Song uploadSong(Models::Song&);
|
||||||
void uploadSongsFromDirectory(const std::string&, const bool, bool);
|
void uploadSongsFromDirectory(const std::string&, const bool, bool);
|
||||||
void uploadSongWithMetadata(Managers::CommitManager::Album&, Models::Song&, Models::CoverArt&);
|
void uploadSongWithMetadata(Managers::CommitManager::Album&, Models::Song&, Models::CoverArt&);
|
||||||
private:
|
private:
|
||||||
Managers::FileManager fMgr;
|
Managers::FileManager fMgr;
|
||||||
Models::API api;
|
Models::API api;
|
||||||
Models::Song song;
|
Models::Song song;
|
||||||
@@ -46,7 +47,8 @@ namespace Syncers
|
|||||||
void printSongDetails();
|
void printSongDetails();
|
||||||
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,22 +13,24 @@
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
class AboutWindow: public QDialog, public CommonWindow
|
|
||||||
{
|
class AboutWindow: public QDialog, public CommonWindow
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AboutWindow(QWidget* parent=0);
|
AboutWindow(QWidget* parent=0);
|
||||||
~AboutWindow() = default;
|
~AboutWindow() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void connections();
|
void connections();
|
||||||
void setupWindow();
|
void setupWindow();
|
||||||
|
|
||||||
std::unique_ptr<QLabel> appName;
|
std::unique_ptr<QLabel> appName;
|
||||||
|
|
||||||
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,13 +22,14 @@
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
class MainWindow: public QMainWindow, public CommonWindow
|
|
||||||
{
|
class MainWindow: public QMainWindow, public CommonWindow
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
~MainWindow() = default;
|
~MainWindow() = default;
|
||||||
private:
|
private:
|
||||||
void configureDownloadSection();
|
void configureDownloadSection();
|
||||||
void configureUploadSection();
|
void configureUploadSection();
|
||||||
void configureWindowDimensions();
|
void configureWindowDimensions();
|
||||||
@@ -70,13 +71,14 @@ namespace UI
|
|||||||
std::unique_ptr<QAction> aboutApplicationQt;
|
std::unique_ptr<QAction> aboutApplicationQt;
|
||||||
|
|
||||||
std::unique_ptr<AboutWindow> aboutWindow;
|
std::unique_ptr<AboutWindow> aboutWindow;
|
||||||
signals:
|
signals:
|
||||||
private slots:
|
private slots:
|
||||||
void uploadSong();
|
void uploadSong();
|
||||||
void exitApplication();
|
void exitApplication();
|
||||||
void displaySoftwareInformation();
|
void displaySoftwareInformation();
|
||||||
void setCurrentIndex(int);
|
void setCurrentIndex(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
namespace Utilities
|
namespace Utilities
|
||||||
{
|
{
|
||||||
class Conversions
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Conversions();
|
|
||||||
|
|
||||||
|
class Conversions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Conversions();
|
||||||
|
|
||||||
static void toLowerChar(char &c)
|
static void toLowerChar(char &c)
|
||||||
{
|
{
|
||||||
@@ -21,11 +21,9 @@ namespace Utilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initializeValues();
|
void initializeValues();
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void printValue(T);
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,38 +16,46 @@ using Models::IcarusAction;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
ActionManager::ActionManager(char **param, int paramCount) :
|
#pragma region Constructors
|
||||||
|
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;
|
||||||
icarusAction.flags = flags;
|
icarusAction.flags = flags;
|
||||||
icarusAction.action = action;
|
icarusAction.action = action;
|
||||||
|
|
||||||
return icarusAction;
|
return icarusAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ActionManager::isNumber(string_view val) noexcept
|
||||||
|
{
|
||||||
void ActionManager::initialize()
|
return !val.empty() && std::find_if(val.begin(),
|
||||||
|
val.end(), [](char c)
|
||||||
{
|
{
|
||||||
|
return !std::isdigit(c);
|
||||||
|
}) == val.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ActionManager::initialize()
|
||||||
|
{
|
||||||
validateFlags();
|
validateFlags();
|
||||||
|
|
||||||
action = std::move(string{params[1]});
|
action = std::move(string{params[1]});
|
||||||
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";
|
||||||
|
|
||||||
const auto flagVals = parsedFlags();
|
const auto flagVals = parsedFlags();
|
||||||
@@ -76,25 +84,24 @@ namespace Managers
|
|||||||
|
|
||||||
flags.emplace_back(std::move(flg));
|
flags.emplace_back(std::move(flg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
{
|
{
|
||||||
printf("Action is empty\n");
|
printf("Action is empty\n");
|
||||||
@@ -103,16 +110,17 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
cout<<"Action is "<<action<<endl;
|
cout<<"Action is "<<action<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ActionManager::printFlags() noexcept
|
void ActionManager::printFlags() noexcept
|
||||||
{
|
{
|
||||||
cout<<"\nPrinting flags..."<<endl;
|
cout<<"\nPrinting flags..."<<endl;
|
||||||
for (auto flag: flags)
|
for (auto flag: flags)
|
||||||
{
|
{
|
||||||
cout<<"flag "<<flag.flag<<endl;
|
cout<<"flag "<<flag.flag<<endl;
|
||||||
cout<<"value "<<flag.value<<endl;
|
cout<<"value "<<flag.value<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma Testing
|
#pragma endregion
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,15 +40,16 @@ namespace filesystem = std::filesystem;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
CommitManager::CommitManager(IcarusAction& icaAct) : icaAction(std::move(icaAct))
|
#pragma region Constructors
|
||||||
{ }
|
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;
|
||||||
cout<<"Commiting "<<action<<" action"<<endl;
|
cout<<"Commiting "<<action<<" action"<<endl;
|
||||||
|
|
||||||
@@ -72,14 +73,16 @@ namespace Managers
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum class ActionValues;
|
|
||||||
|
|
||||||
std::map<std::string, CommitManager::ActionValues>
|
|
||||||
|
|
||||||
|
|
||||||
|
std::map<std::string, CommitManager::ActionValues>
|
||||||
CommitManager::mapActions() noexcept
|
CommitManager::mapActions() noexcept
|
||||||
{
|
{
|
||||||
const std::map<std::string, ActionValues> actions{
|
const std::map<std::string, ActionValues> actions{
|
||||||
{"delete", ActionValues::deleteAct},
|
{"delete", ActionValues::deleteAct},
|
||||||
{"download", ActionValues::downloadAct},
|
{"download", ActionValues::downloadAct},
|
||||||
@@ -89,11 +92,13 @@ namespace Managers
|
|||||||
};
|
};
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Token CommitManager::parseToken(API api)
|
|
||||||
{
|
|
||||||
|
Token CommitManager::parseToken(API api)
|
||||||
|
{
|
||||||
cout<<"fetching token\n";
|
cout<<"fetching token\n";
|
||||||
UserManager usrMgr{icaAction};
|
UserManager usrMgr{icaAction};
|
||||||
auto user = usrMgr.retrieveUser();
|
auto user = usrMgr.retrieveUser();
|
||||||
@@ -101,10 +106,10 @@ namespace Managers
|
|||||||
TokenManager tk{user, api};
|
TokenManager tk{user, api};
|
||||||
|
|
||||||
return tk.requestToken();
|
return tk.requestToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommitManager::deleteSong()
|
void CommitManager::deleteSong()
|
||||||
{
|
{
|
||||||
APIParser apiPrs{icaAction};
|
APIParser apiPrs{icaAction};
|
||||||
auto api = apiPrs.retrieveAPI();
|
auto api = apiPrs.retrieveAPI();
|
||||||
|
|
||||||
@@ -126,9 +131,9 @@ namespace Managers
|
|||||||
Delete del{api};
|
Delete del{api};
|
||||||
cout<<"Deleting song..."<<endl;
|
cout<<"Deleting song..."<<endl;
|
||||||
del.deleteSong(token, song);
|
del.deleteSong(token, song);
|
||||||
}
|
}
|
||||||
void CommitManager::downloadSong()
|
void CommitManager::downloadSong()
|
||||||
{
|
{
|
||||||
cout<<"Starting downloading process..."<<endl;
|
cout<<"Starting downloading process..."<<endl;
|
||||||
|
|
||||||
APIParser apiPrs{icaAction};
|
APIParser apiPrs{icaAction};
|
||||||
@@ -156,9 +161,9 @@ namespace Managers
|
|||||||
Download dnld{api};
|
Download dnld{api};
|
||||||
cout<<"downloading song"<<endl;
|
cout<<"downloading song"<<endl;
|
||||||
dnld.downloadSong(token, song);
|
dnld.downloadSong(token, song);
|
||||||
}
|
}
|
||||||
void CommitManager::retrieveObjects()
|
void CommitManager::retrieveObjects()
|
||||||
{
|
{
|
||||||
cout<<"Starting retrieve process..."<<endl;
|
cout<<"Starting retrieve process..."<<endl;
|
||||||
|
|
||||||
APIParser apiPrs{icaAction};
|
APIParser apiPrs{icaAction};
|
||||||
@@ -185,9 +190,10 @@ namespace Managers
|
|||||||
RetrieveRecords songs{api, token};
|
RetrieveRecords songs{api, token};
|
||||||
songs.retrieve(retrieveType);
|
songs.retrieve(retrieveType);
|
||||||
|
|
||||||
}
|
}
|
||||||
void CommitManager::uploadSong()
|
|
||||||
{
|
void CommitManager::uploadSong()
|
||||||
|
{
|
||||||
auto uploadSingleSong = true;
|
auto uploadSingleSong = true;
|
||||||
auto recursiveDirectory = false;
|
auto recursiveDirectory = false;
|
||||||
const auto noConfirm = checkForNoConfirm();
|
const auto noConfirm = checkForNoConfirm();
|
||||||
@@ -232,10 +238,12 @@ namespace Managers
|
|||||||
cout<<"Uploading songs from " << songDirectory << endl;
|
cout<<"Uploading songs from " << songDirectory << endl;
|
||||||
upld.uploadSongsFromDirectory(songDirectory, noConfirm, recursiveDirectory);
|
upld.uploadSongsFromDirectory(songDirectory, noConfirm, recursiveDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommitManager::uploadSongWithMetadata()
|
|
||||||
{
|
|
||||||
|
void CommitManager::uploadSongWithMetadata()
|
||||||
|
{
|
||||||
cout<<"Uploading single song with metadata\n\n";
|
cout<<"Uploading single song with metadata\n\n";
|
||||||
|
|
||||||
// Either the set of "-s", "-m", "-ca", "-t" flags or "-smca" must exist with values
|
// Either the set of "-s", "-m", "-ca", "-t" flags or "-smca" must exist with values
|
||||||
@@ -269,12 +277,12 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
multiTargetUpload(uni);
|
multiTargetUpload(uni);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CommitManager::singTargetUpload(const std::string &songPath, const std::string &trackID,
|
void CommitManager::singTargetUpload(const std::string &songPath, const std::string &trackID,
|
||||||
const std::string &metaPath, const std::string &coverPath)
|
const std::string &metaPath, const std::string &coverPath)
|
||||||
{
|
{
|
||||||
APIParser apiPrs(icaAction);
|
APIParser apiPrs(icaAction);
|
||||||
auto api = apiPrs.retrieveAPI();
|
auto api = apiPrs.retrieveAPI();
|
||||||
const auto token = parseToken(api);
|
const auto token = parseToken(api);
|
||||||
@@ -308,10 +316,10 @@ namespace Managers
|
|||||||
|
|
||||||
Upload up(api, token);
|
Upload up(api, token);
|
||||||
up.uploadSongWithMetadata(album, song, cover);
|
up.uploadSongWithMetadata(album, song, cover);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommitManager::multiTargetUpload(const std::string &sourcePath)
|
void CommitManager::multiTargetUpload(const std::string &sourcePath)
|
||||||
{
|
{
|
||||||
APIParser apiPrs(icaAction);
|
APIParser apiPrs(icaAction);
|
||||||
auto api = apiPrs.retrieveAPI();
|
auto api = apiPrs.retrieveAPI();
|
||||||
const auto token = parseToken(api);
|
const auto token = parseToken(api);
|
||||||
@@ -362,11 +370,11 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
up.uploadSongWithMetadata(album, song, cover);
|
up.uploadSongWithMetadata(album, song, cover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma region private
|
#pragma region private
|
||||||
CommitManager::Album CommitManager::retrieveMetadata(const std::string_view path)
|
CommitManager::Album CommitManager::retrieveMetadata(const std::string_view path)
|
||||||
{
|
{
|
||||||
CommitManager::Album album;
|
CommitManager::Album album;
|
||||||
const auto fileContent = retrieveFileContent(path);
|
const auto fileContent = retrieveFileContent(path);
|
||||||
cout<<"Parsing...\n";
|
cout<<"Parsing...\n";
|
||||||
@@ -396,10 +404,10 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
return album;
|
return album;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CommitManager::retrieveFileContent(const std::string_view path)
|
string CommitManager::retrieveFileContent(const std::string_view path)
|
||||||
{
|
{
|
||||||
string path_str(path);
|
string path_str(path);
|
||||||
string value;
|
string value;
|
||||||
|
|
||||||
@@ -411,11 +419,11 @@ namespace Managers
|
|||||||
value.assign(buffer.str());
|
value.assign(buffer.str());
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
void CommitManager::Album::printInfo()
|
void CommitManager::Album::printInfo()
|
||||||
{
|
{
|
||||||
std::cout<<"Album: "<<this->album<<"\n";
|
std::cout<<"Album: "<<this->album<<"\n";
|
||||||
std::cout<<"Album Artist: "<<this->albumArtist<<"\n";
|
std::cout<<"Album Artist: "<<this->albumArtist<<"\n";
|
||||||
std::cout<<"Genre: "<<this->genre<<"\n";
|
std::cout<<"Genre: "<<this->genre<<"\n";
|
||||||
@@ -423,7 +431,8 @@ namespace Managers
|
|||||||
std::cout<<"Track count: "<<this->trackCount<<"\n";
|
std::cout<<"Track count: "<<this->trackCount<<"\n";
|
||||||
std::cout<<"Disc count: "<<this->discCount<<"\n";
|
std::cout<<"Disc count: "<<this->discCount<<"\n";
|
||||||
std::cout<<"\n";
|
std::cout<<"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma Functions
|
#pragma region Functions
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,26 +11,30 @@ using std::string;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
FileManager::FileManager() {}
|
|
||||||
FileManager::FileManager(string filePath)
|
#pragma region Constructors
|
||||||
{
|
FileManager::FileManager() {}
|
||||||
|
FileManager::FileManager(string filePath)
|
||||||
|
{
|
||||||
this->filePath = filePath;
|
this->filePath = filePath;
|
||||||
readFile();
|
readFile();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
void FileManager::saveFile(string newFilePath)
|
#pragma region Functions
|
||||||
{
|
void FileManager::saveFile(string newFilePath)
|
||||||
|
{
|
||||||
if (!fileRead)
|
if (!fileRead)
|
||||||
readFile();
|
readFile();
|
||||||
|
|
||||||
ofstream of{newFilePath, ofstream::binary};
|
ofstream of{newFilePath, ofstream::binary};
|
||||||
of.write(fileBuffer, fileBufferLength);
|
of.write(fileBuffer, fileBufferLength);
|
||||||
of.close();
|
of.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileManager::readFile()
|
void FileManager::readFile()
|
||||||
{
|
{
|
||||||
ifstream is{filePath, ifstream::binary};
|
ifstream is{filePath, ifstream::binary};
|
||||||
if (is)
|
if (is)
|
||||||
{
|
{
|
||||||
@@ -51,16 +55,19 @@ namespace Managers
|
|||||||
is.close();
|
is.close();
|
||||||
fileRead = true;
|
fileRead = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void FileManager::modifyFilePath(string filePath)
|
void FileManager::modifyFilePath(string filePath)
|
||||||
{
|
{
|
||||||
this->filePath = filePath;
|
this->filePath = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* FileManager::retrieveFileBuffer() const
|
char* FileManager::retrieveFileBuffer() const
|
||||||
{
|
{
|
||||||
return fileBuffer;
|
return fileBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FileManager::retrieveFileBufferLength() const { return fileBufferLength; }
|
int FileManager::retrieveFileBufferLength() const { return fileBufferLength; }
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,24 +17,25 @@ using Models::User;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
TokenManager::TokenManager(const User& user)
|
#pragma region Constructors
|
||||||
{
|
TokenManager::TokenManager(const User& user)
|
||||||
|
{
|
||||||
this->user = user;
|
this->user = user;
|
||||||
}
|
}
|
||||||
TokenManager::TokenManager(const User& user, API& api)
|
TokenManager::TokenManager(const User& user, API& api)
|
||||||
{
|
{
|
||||||
this->user = user;
|
this->user = user;
|
||||||
this->api = api;
|
this->api = api;
|
||||||
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{};
|
||||||
json usrObj;
|
json usrObj;
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ namespace Managers
|
|||||||
cout<<"status code "<<r.status_code<<endl;
|
cout<<"status code "<<r.status_code<<endl;
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,28 +12,29 @@ using Models::User;
|
|||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
UserManager::UserManager(User user)
|
#pragma region Constructors
|
||||||
{
|
UserManager::UserManager(User user)
|
||||||
|
{
|
||||||
this->user = user;
|
this->user = user;
|
||||||
}
|
}
|
||||||
UserManager::UserManager(const IcarusAction icaAct)
|
UserManager::UserManager(const IcarusAction icaAct)
|
||||||
{
|
{
|
||||||
this->icaAction = icaAct;
|
this->icaAction = icaAct;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserManager::parseUserFromActions()
|
void UserManager::parseUserFromActions()
|
||||||
{
|
{
|
||||||
auto args = icaAction.flags;
|
auto args = icaAction.flags;
|
||||||
|
|
||||||
for (auto arg : args)
|
for (auto arg : args)
|
||||||
@@ -48,6 +49,7 @@ namespace Managers
|
|||||||
user.password = arg.value;
|
user.password = arg.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-17
@@ -1,6 +1,6 @@
|
|||||||
#include"Parsers/APIParser.h"
|
#include "Parsers/APIParser.h"
|
||||||
|
|
||||||
#include<iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@@ -10,25 +10,26 @@ using Models::IcarusAction;
|
|||||||
|
|
||||||
namespace Parsers
|
namespace Parsers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
APIParser::APIParser(IcarusAction icaAct) : icaAct(icaAct)
|
#pragma region Constructors
|
||||||
{
|
APIParser::APIParser(IcarusAction icaAct) : icaAct(icaAct)
|
||||||
|
{
|
||||||
api = API{};
|
api = API{};
|
||||||
parseAPI();
|
parseAPI();
|
||||||
}
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
#pragma
|
#pragma region Functions
|
||||||
API APIParser::retrieveAPI() const
|
API APIParser::retrieveAPI() const
|
||||||
{
|
{
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
void APIParser::parseAPI()
|
void APIParser::parseAPI()
|
||||||
{
|
{
|
||||||
auto flags = icaAct.flags;
|
auto flags = icaAct.flags;
|
||||||
cout<<"Parsing api"<<endl;
|
cout << "Parsing api" << endl;
|
||||||
|
|
||||||
for (auto i =0; i < flags.size(); ++i)
|
for (auto i =0; i < flags.size(); ++i)
|
||||||
{
|
{
|
||||||
@@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-17
@@ -1,9 +1,9 @@
|
|||||||
#include"Syncers/Delete.h"
|
#include "Syncers/Delete.h"
|
||||||
|
|
||||||
#include<exception>
|
#include <exception>
|
||||||
#include<iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include<cpr/cpr.h>
|
#include <cpr/cpr.h>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@@ -16,18 +16,19 @@ using Models::Token;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
Delete::Delete(API api)
|
#pragma region Constructors
|
||||||
{
|
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
|
||||||
{
|
{
|
||||||
auto url = retrieveUrl(song);
|
auto url = retrieveUrl(song);
|
||||||
@@ -46,10 +47,10 @@ namespace Syncers
|
|||||||
cout<<msg<<endl;
|
cout<<msg<<endl;
|
||||||
}
|
}
|
||||||
cout<<"Finished"<<endl;
|
cout<<"Finished"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Delete::retrieveUrl(Song song)
|
string Delete::retrieveUrl(Song song)
|
||||||
{
|
{
|
||||||
string url{api.url + "api/" + api.version + "/" +
|
string url{api.url + "api/" + api.version + "/" +
|
||||||
api.endpoint + "/"};
|
api.endpoint + "/"};
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ namespace Syncers
|
|||||||
cout<<"url "<<url<<endl;
|
cout<<"url "<<url<<endl;
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-25
@@ -1,10 +1,10 @@
|
|||||||
#include"Syncers/Download.h"
|
#include "Syncers/Download.h"
|
||||||
|
|
||||||
#include<exception>
|
#include <exception>
|
||||||
#include<iostream>
|
#include <iostream>
|
||||||
#include<fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include<cpr/cpr.h>
|
#include <cpr/cpr.h>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@@ -18,23 +18,24 @@ using Models::Token;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
#pragma
|
|
||||||
Download::Download() { }
|
#pragma region Constructors
|
||||||
Download::Download(API api)
|
Download::Download() { }
|
||||||
{
|
Download::Download(API api)
|
||||||
|
{
|
||||||
this->api = api;
|
this->api = api;
|
||||||
this->api.endpoint = "song/data";
|
this->api.endpoint = "song/data";
|
||||||
}
|
}
|
||||||
Download::Download(string filePath)
|
Download::Download(string filePath)
|
||||||
{
|
{
|
||||||
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
|
||||||
{
|
{
|
||||||
string url = retrieveUrl(song);
|
string url = retrieveUrl(song);
|
||||||
@@ -63,10 +64,10 @@ namespace Syncers
|
|||||||
auto msg = e.what();
|
auto msg = e.what();
|
||||||
cout<<msg<<endl;
|
cout<<msg<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string Download::retrieveUrl(Song song)
|
string Download::retrieveUrl(Song song)
|
||||||
{
|
{
|
||||||
string url{api.url + "api/" + api.version + "/" +
|
string url{api.url + "api/" + api.version + "/" +
|
||||||
api.endpoint + "/"};
|
api.endpoint + "/"};
|
||||||
|
|
||||||
@@ -74,10 +75,10 @@ namespace Syncers
|
|||||||
cout<<"url "<<url<<endl;
|
cout<<"url "<<url<<endl;
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Download::saveSong(Song& song)
|
void Download::saveSong(Song& song)
|
||||||
{
|
{
|
||||||
cout<<"\nSaving song to: "<<song.songPath<<endl;
|
cout<<"\nSaving song to: "<<song.songPath<<endl;
|
||||||
int bufferLength = song.data.length();
|
int bufferLength = song.data.length();
|
||||||
const char *data = song.data.c_str();
|
const char *data = song.data.c_str();
|
||||||
@@ -86,6 +87,7 @@ namespace Syncers
|
|||||||
ofstream saveSong{song.songPath, std::ios::binary};
|
ofstream saveSong{song.songPath, std::ios::binary};
|
||||||
saveSong.write(data, bufferLength);
|
saveSong.write(data, bufferLength);
|
||||||
saveSong.close();
|
saveSong.close();
|
||||||
}
|
}
|
||||||
#pragma Functions
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,15 @@ using Utilities::Conversions;
|
|||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
|
|
||||||
RetrieveRecords::RetrieveRecords() { }
|
#pragma region Constructors
|
||||||
RetrieveRecords::RetrieveRecords(API api, Token token)
|
RetrieveRecords::RetrieveRecords() { }
|
||||||
|
RetrieveRecords::RetrieveRecords(API api, Token token)
|
||||||
: token(token), api(api) { }
|
: token(token), api(api) { }
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
void RetrieveRecords::retrieve(CommitManager::RetrieveTypes type)
|
#pragma region Functions
|
||||||
{
|
void RetrieveRecords::retrieve(CommitManager::RetrieveTypes type)
|
||||||
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case CommitManager::RetrieveTypes::songs:
|
case CommitManager::RetrieveTypes::songs:
|
||||||
@@ -34,9 +37,9 @@ namespace Syncers
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RetrieveRecords::fetchSongs()
|
void RetrieveRecords::fetchSongs()
|
||||||
{
|
{
|
||||||
cout<<"fetching songs"<<endl;
|
cout<<"fetching songs"<<endl;
|
||||||
auto url = api.url + "api/" + api.version + "/" + "song";
|
auto url = api.url + "api/" + api.version + "/" + "song";
|
||||||
|
|
||||||
@@ -58,5 +61,7 @@ namespace Syncers
|
|||||||
writeData.open("songs.json");
|
writeData.open("songs.json");
|
||||||
writeData<<songData.dump(4);
|
writeData<<songData.dump(4);
|
||||||
writeData.close();
|
writeData.close();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-41
@@ -25,9 +25,19 @@ using namespace cpr;
|
|||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
#pragma region Functions
|
|
||||||
Song Upload::uploadSong(Song& song)
|
#pragma region Constructors
|
||||||
{
|
Upload::Upload() { }
|
||||||
|
Upload::Upload(API api) : api(api)
|
||||||
|
{
|
||||||
|
this->api.endpoint = "song/data";
|
||||||
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
#pragma region Functions
|
||||||
|
Song Upload::uploadSong(Song& song)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto url = retrieveUrl();
|
auto url = retrieveUrl();
|
||||||
@@ -63,11 +73,11 @@ namespace Syncers
|
|||||||
}
|
}
|
||||||
|
|
||||||
return song;
|
return song;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Upload::uploadSongsFromDirectory(const std::string& directory,
|
void Upload::uploadSongsFromDirectory(const std::string& directory,
|
||||||
const bool noConfirm, bool recursive = false)
|
const bool noConfirm, bool recursive = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto songs = retrieveAllSongsFromDirectory(directory, recursive);
|
auto songs = retrieveAllSongsFromDirectory(directory, recursive);
|
||||||
@@ -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";
|
||||||
@@ -103,11 +114,11 @@ namespace Syncers
|
|||||||
{
|
{
|
||||||
cout<<e.what()<<endl;
|
cout<<e.what()<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Models::Song& song, Models::CoverArt &cover)
|
void Upload::uploadSongWithMetadata(Managers::CommitManager::Album &album, Models::Song& song, Models::CoverArt &cover)
|
||||||
{
|
{
|
||||||
this->api.endpoint.assign("song/data/upload/with/data");
|
this->api.endpoint.assign("song/data/upload/with/data");
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -153,10 +164,10 @@ namespace Syncers
|
|||||||
auto msg = e.what();
|
auto msg = e.what();
|
||||||
cout<<"Error: "<<msg<<"\n";
|
cout<<"Error: "<<msg<<"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<Song> Upload::retrieveAllSongsFromDirectory(const std::string& directory,
|
std::vector<Song> Upload::retrieveAllSongsFromDirectory(const std::string& directory,
|
||||||
bool recursive)
|
bool recursive)
|
||||||
{
|
{
|
||||||
std::vector<Song> allSongs;
|
std::vector<Song> allSongs;
|
||||||
|
|
||||||
if (recursive)
|
if (recursive)
|
||||||
@@ -179,20 +190,20 @@ namespace Syncers
|
|||||||
}
|
}
|
||||||
|
|
||||||
return allSongs;
|
return allSongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string Upload::retrieveUrl()
|
string Upload::retrieveUrl()
|
||||||
{
|
{
|
||||||
const string url{api.url + "api/" + api.version + "/" +
|
const string url{api.url + "api/" + api.version + "/" +
|
||||||
api.endpoint};
|
api.endpoint};
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Song Upload::retrieveSongPath(fs::directory_entry& dirEntry)
|
Song Upload::retrieveSongPath(fs::directory_entry& dirEntry)
|
||||||
{
|
{
|
||||||
constexpr auto mp3Ext = ".mp3";
|
constexpr auto mp3Ext = ".mp3";
|
||||||
Song song;
|
Song song;
|
||||||
if (fs::is_regular_file(dirEntry.path()))
|
if (fs::is_regular_file(dirEntry.path()))
|
||||||
@@ -206,23 +217,13 @@ namespace Syncers
|
|||||||
}
|
}
|
||||||
|
|
||||||
return song;
|
return song;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma region Testing
|
#pragma region Testing
|
||||||
void Upload::printSongDetails()
|
|
||||||
{
|
void Upload::printSongDetails(std::vector<Song>& songs)
|
||||||
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)
|
|
||||||
{
|
|
||||||
for (auto& song: songs)
|
for (auto& song: songs)
|
||||||
{
|
{
|
||||||
cout<<"Song details: "<<endl;
|
cout<<"Song details: "<<endl;
|
||||||
@@ -235,9 +236,10 @@ namespace Syncers
|
|||||||
cout<<"Duration: "<<song.duration<<endl;
|
cout<<"Duration: "<<song.duration<<endl;
|
||||||
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;
|
||||||
cout<<"id: "<<obj["id"]<<endl;
|
cout<<"id: "<<obj["id"]<<endl;
|
||||||
cout<<"title: "<<obj["title"]<<endl;
|
cout<<"title: "<<obj["title"]<<endl;
|
||||||
@@ -249,7 +251,8 @@ namespace Syncers
|
|||||||
cout<<"song_data: "<<obj["song_data"]<<endl;
|
cout<<"song_data: "<<obj["song_data"]<<endl;
|
||||||
|
|
||||||
cout<<endl<<endl;;
|
cout<<endl<<endl;;
|
||||||
}
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-16
@@ -1,17 +1,20 @@
|
|||||||
#include"UI/AboutWindow.h"
|
#include "UI/AboutWindow.h"
|
||||||
|
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
AboutWindow::AboutWindow(QWidget* parent): QDialog(parent)
|
#pragma region Constructors
|
||||||
{
|
AboutWindow::AboutWindow(QWidget* parent): QDialog(parent)
|
||||||
|
{
|
||||||
setupWindow();
|
setupWindow();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
void AboutWindow::setupWindow()
|
#pragma region Functions
|
||||||
{
|
void AboutWindow::setupWindow()
|
||||||
|
{
|
||||||
windowWidth = 250;
|
windowWidth = 250;
|
||||||
windowHeight = 300;
|
windowHeight = 300;
|
||||||
|
|
||||||
@@ -32,16 +35,18 @@ namespace UI
|
|||||||
setWindowTitle("About");
|
setWindowTitle("About");
|
||||||
|
|
||||||
connections();
|
connections();
|
||||||
}
|
}
|
||||||
void AboutWindow::connections()
|
void AboutWindow::connections()
|
||||||
{
|
{
|
||||||
QObject::connect(actionButtonQt.get(), SIGNAL(clicked()), this,
|
QObject::connect(actionButtonQt.get(), SIGNAL(clicked()), this,
|
||||||
SLOT(closeWindow()));
|
SLOT(closeWindow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AboutWindow::closeWindow()
|
void AboutWindow::closeWindow()
|
||||||
{
|
{
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+54
-48
@@ -1,11 +1,11 @@
|
|||||||
#include"UI/MainWindow.h"
|
#include "UI/MainWindow.h"
|
||||||
|
|
||||||
#include<iostream>
|
#include <iostream>
|
||||||
#include<string>
|
#include <string>
|
||||||
|
|
||||||
#include"Models/UploadForm.h"
|
#include "Models/UploadForm.h"
|
||||||
#include"Syncers/Upload.h"
|
#include "Syncers/Upload.h"
|
||||||
#include"Utilities/Conversions.h"
|
#include "Utilities/Conversions.h"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@@ -17,18 +17,22 @@ using Syncers::Upload;
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
MainWindow::MainWindow()
|
|
||||||
{
|
#pragma region Constructors
|
||||||
|
MainWindow::MainWindow()
|
||||||
|
{
|
||||||
setupMainWindow();
|
setupMainWindow();
|
||||||
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
|
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::configureDownloadSection()
|
#pragma region Functions
|
||||||
{
|
void MainWindow::configureDownloadSection()
|
||||||
}
|
{
|
||||||
void MainWindow::configureUploadSection()
|
}
|
||||||
{
|
void MainWindow::configureUploadSection()
|
||||||
|
{
|
||||||
uploadSongQt = unique_ptr<QPushButton>{new QPushButton(tr("Upload"))};
|
uploadSongQt = unique_ptr<QPushButton>{new QPushButton(tr("Upload"))};
|
||||||
urlQt = unique_ptr<QTextEdit>{new QTextEdit()};
|
urlQt = unique_ptr<QTextEdit>{new QTextEdit()};
|
||||||
sourceFilePathQt = unique_ptr<QTextEdit>{new QTextEdit()};
|
sourceFilePathQt = unique_ptr<QTextEdit>{new QTextEdit()};
|
||||||
@@ -49,20 +53,20 @@ namespace UI
|
|||||||
subLayoutOneQt.get()->addLayout(urlPortion.get());
|
subLayoutOneQt.get()->addLayout(urlPortion.get());
|
||||||
subLayoutOneQt->addLayout(songPathPortion.get());
|
subLayoutOneQt->addLayout(songPathPortion.get());
|
||||||
mainLayoutQt.get()->addLayout(subLayoutOneQt.get());
|
mainLayoutQt.get()->addLayout(subLayoutOneQt.get());
|
||||||
}
|
}
|
||||||
void MainWindow::configureWindowDimensions()
|
void MainWindow::configureWindowDimensions()
|
||||||
{
|
{
|
||||||
windowWidth = 450;
|
windowWidth = 450;
|
||||||
windowHeight = 450;
|
windowHeight = 450;
|
||||||
}
|
}
|
||||||
void MainWindow::configureWindowProperties()
|
void MainWindow::configureWindowProperties()
|
||||||
{
|
{
|
||||||
setWindowTitle("IcarusDownloadManager");
|
setWindowTitle("IcarusDownloadManager");
|
||||||
setFixedHeight(windowHeight);
|
setFixedHeight(windowHeight);
|
||||||
setFixedWidth(windowWidth);
|
setFixedWidth(windowWidth);
|
||||||
}
|
}
|
||||||
void MainWindow::connections()
|
void MainWindow::connections()
|
||||||
{
|
{
|
||||||
QObject::connect(uploadSongQt.get(), SIGNAL(clicked()), this, SLOT(uploadSong()));
|
QObject::connect(uploadSongQt.get(), SIGNAL(clicked()), this, SLOT(uploadSong()));
|
||||||
QObject::connect(closeApplicationQt.get(), SIGNAL(triggered()), this,
|
QObject::connect(closeApplicationQt.get(), SIGNAL(triggered()), this,
|
||||||
SLOT(exitApplication()));
|
SLOT(exitApplication()));
|
||||||
@@ -70,9 +74,9 @@ namespace UI
|
|||||||
SLOT(displaySoftwareInformation()));
|
SLOT(displaySoftwareInformation()));
|
||||||
QObject::connect(windowComboBox.get(), SIGNAL(activated(int)),
|
QObject::connect(windowComboBox.get(), SIGNAL(activated(int)),
|
||||||
this, SLOT(setCurrentIndex(int)));
|
this, SLOT(setCurrentIndex(int)));
|
||||||
}
|
}
|
||||||
void MainWindow::createMenus()
|
void MainWindow::createMenus()
|
||||||
{
|
{
|
||||||
fileMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
fileMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
||||||
editMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Edit"))};
|
editMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Edit"))};
|
||||||
helpMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Help"))};
|
helpMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Help"))};
|
||||||
@@ -86,9 +90,9 @@ namespace UI
|
|||||||
fileMenuQt->addAction(closeApplicationQt.get());
|
fileMenuQt->addAction(closeApplicationQt.get());
|
||||||
helpMenuQt->addAction(aboutApplicationQt.get());
|
helpMenuQt->addAction(aboutApplicationQt.get());
|
||||||
|
|
||||||
}
|
}
|
||||||
void MainWindow::setupMainWidget()
|
void MainWindow::setupMainWidget()
|
||||||
{
|
{
|
||||||
mainWidgetQt = unique_ptr<QWidget>{new QWidget};
|
mainWidgetQt = unique_ptr<QWidget>{new QWidget};
|
||||||
|
|
||||||
windowComboBox = unique_ptr<QComboBox>{new QComboBox};
|
windowComboBox = unique_ptr<QComboBox>{new QComboBox};
|
||||||
@@ -104,9 +108,9 @@ namespace UI
|
|||||||
stackLayout->addWidget(uploadSongWidgetQt.get());
|
stackLayout->addWidget(uploadSongWidgetQt.get());
|
||||||
|
|
||||||
mainWidgetQt->setLayout(stackLayout.get());
|
mainWidgetQt->setLayout(stackLayout.get());
|
||||||
}
|
}
|
||||||
void MainWindow::setupMainWindow()
|
void MainWindow::setupMainWindow()
|
||||||
{
|
{
|
||||||
configureWindowDimensions();
|
configureWindowDimensions();
|
||||||
|
|
||||||
mainLayoutQt = unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
mainLayoutQt = unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||||
@@ -130,34 +134,34 @@ namespace UI
|
|||||||
configureWindowProperties();
|
configureWindowProperties();
|
||||||
|
|
||||||
connections();
|
connections();
|
||||||
}
|
}
|
||||||
void MainWindow::setupWindowLists()
|
void MainWindow::setupWindowLists()
|
||||||
{
|
{
|
||||||
windowComboBox->addItem(tr("Upload song"));
|
windowComboBox->addItem(tr("Upload song"));
|
||||||
windowComboBox->addItem(tr("Download song"));
|
windowComboBox->addItem(tr("Download song"));
|
||||||
windowComboBox->addItem(tr("Display all songs"));
|
windowComboBox->addItem(tr("Display all songs"));
|
||||||
windowComboBox->addItem(tr("Display songs"));
|
windowComboBox->addItem(tr("Display songs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::exitApplication()
|
void MainWindow::exitApplication()
|
||||||
{
|
{
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
void MainWindow::displaySoftwareInformation()
|
void MainWindow::displaySoftwareInformation()
|
||||||
{
|
{
|
||||||
aboutWindow->show();
|
aboutWindow->show();
|
||||||
}
|
}
|
||||||
void MainWindow::setCurrentIndex(int index)
|
void MainWindow::setCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
cout<<"index "<<index<<endl;
|
cout<<"index "<<index<<endl;
|
||||||
QString qText = windowComboBox->itemText(index);
|
QString qText = windowComboBox->itemText(index);
|
||||||
auto cnvert = Utilities::Conversions(qText);
|
auto cnvert = Utilities::Conversions(qText);
|
||||||
auto convertedStr = cnvert.convertQStringToString();
|
auto convertedStr = cnvert.convertQStringToString();
|
||||||
cout<<"item text"<<endl;
|
cout<<"item text"<<endl;
|
||||||
}
|
}
|
||||||
void MainWindow::uploadSong()
|
void MainWindow::uploadSong()
|
||||||
{
|
{
|
||||||
uploadSongQt->setEnabled(false);
|
uploadSongQt->setEnabled(false);
|
||||||
|
|
||||||
string url = urlQt->toPlainText().toUtf8().constData();
|
string url = urlQt->toPlainText().toUtf8().constData();
|
||||||
@@ -170,5 +174,7 @@ namespace UI
|
|||||||
upld.uploadSong();
|
upld.uploadSong();
|
||||||
|
|
||||||
uploadSongQt->setEnabled(true);
|
uploadSongQt->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
#include"Utilities/Conversions.h"
|
#include "Utilities/Conversions.h"
|
||||||
|
|
||||||
#include<iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
namespace Utilities
|
namespace Utilities
|
||||||
{
|
{
|
||||||
Conversions::Conversions()
|
|
||||||
{
|
|
||||||
initializeValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Conversions::initializeValues()
|
Conversions::Conversions()
|
||||||
{
|
{
|
||||||
}
|
initializeValues();
|
||||||
template <typename T>
|
}
|
||||||
void Conversions::printValue(T val)
|
|
||||||
{
|
void Conversions::initializeValues()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
template <typename T>
|
||||||
|
void Conversions::printValue(T val)
|
||||||
|
{
|
||||||
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