Formatting
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
|
||||
class ActionManager
|
||||
{
|
||||
public:
|
||||
@@ -38,6 +39,7 @@ namespace Managers
|
||||
char **params;
|
||||
int paramCount;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
|
||||
class CommitManager
|
||||
{
|
||||
public:
|
||||
@@ -44,6 +45,7 @@ namespace Managers
|
||||
|
||||
Models::IcarusAction icaAction;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
|
||||
class FileManager
|
||||
{
|
||||
public:
|
||||
@@ -24,6 +25,7 @@ namespace Managers
|
||||
bool fileRead;
|
||||
int fileBufferLength;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
|
||||
class TokenManager
|
||||
{
|
||||
public:
|
||||
@@ -18,6 +19,7 @@ namespace Managers
|
||||
Models::API api;
|
||||
Models::User user;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
|
||||
class UserManager
|
||||
{
|
||||
public:
|
||||
@@ -21,6 +22,7 @@ namespace Managers
|
||||
Models::User user;
|
||||
Models::IcarusAction icaAction;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
struct API
|
||||
|
||||
class API
|
||||
{
|
||||
public:
|
||||
std::string url;
|
||||
std::string endpoint;
|
||||
std::string version;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
|
||||
struct Flags
|
||||
{
|
||||
std::string flag;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
|
||||
struct IcarusAction
|
||||
{
|
||||
std::string action;
|
||||
std::vector<Flags> flags;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
|
||||
struct Song
|
||||
{
|
||||
int id;
|
||||
@@ -19,6 +20,7 @@ namespace Models
|
||||
std::string data;
|
||||
std::string songPath;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
|
||||
struct Token
|
||||
{
|
||||
std::string accessToken;
|
||||
std::string tokenType;
|
||||
int expiration;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
|
||||
struct UploadForm
|
||||
{
|
||||
std::string url;
|
||||
std::string filePath;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
|
||||
struct User
|
||||
{
|
||||
std::string username;
|
||||
std::string password;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace Parsers
|
||||
{
|
||||
|
||||
class APIParser
|
||||
{
|
||||
public:
|
||||
@@ -18,6 +19,7 @@ namespace Parsers
|
||||
Models::API api;
|
||||
Models::IcarusAction icaAct;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
class Delete : SyncerBase
|
||||
{
|
||||
public:
|
||||
@@ -18,6 +19,7 @@ namespace Syncers
|
||||
private:
|
||||
std::string retrieveUrl(Models::Song);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
class Download : SyncerBase
|
||||
{
|
||||
public:
|
||||
@@ -26,6 +27,7 @@ namespace Syncers
|
||||
std::string downloadFilePath;
|
||||
void saveSong(Models::Song&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
class RetrieveRecords: public SyncerBase
|
||||
{
|
||||
public:
|
||||
@@ -21,6 +22,7 @@ namespace Syncers
|
||||
Models::API api;
|
||||
Models::Token token;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
class SyncerBase
|
||||
{
|
||||
protected:
|
||||
@@ -22,6 +23,7 @@ namespace Syncers
|
||||
NOTFOUND = 404
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace fs = std::filesystem;
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
class Upload
|
||||
{
|
||||
public:
|
||||
@@ -43,6 +44,7 @@ namespace Syncers
|
||||
void printSongDetails(std::vector<Models::Song>&);
|
||||
void printJsonData(const nlohmann::json&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
class AboutWindow: public QDialog, public CommonWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -29,6 +30,7 @@ namespace UI
|
||||
private slots:
|
||||
void closeWindow();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include<QPushButton>
|
||||
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
class CommonWindow
|
||||
{
|
||||
public:
|
||||
@@ -24,4 +27,7 @@ protected:
|
||||
std::unique_ptr<QVBoxLayout> subLayoutTwoQt;
|
||||
int windowHeight, windowWidth;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
class MainWindow: public QMainWindow, public CommonWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -77,6 +78,7 @@ namespace UI
|
||||
void displaySoftwareInformation();
|
||||
void setCurrentIndex(int);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
class Conversions
|
||||
{
|
||||
public:
|
||||
@@ -17,6 +18,7 @@ namespace Utilities
|
||||
void printValue(T);
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,16 +16,17 @@ using Models::IcarusAction;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
ActionManager::ActionManager(char **param, int paramCount) :
|
||||
params(std::move(param)), paramCount(paramCount)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
#pragma Constructors
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
IcarusAction ActionManager::retrieveIcarusAction() const
|
||||
{
|
||||
IcarusAction icarusAction;
|
||||
@@ -83,7 +84,7 @@ namespace Managers
|
||||
if (flag.size() > 3 || isNumber(flag))
|
||||
{
|
||||
flg.value = flag;
|
||||
//cout<<"flag value "<<flg.value<<endl;
|
||||
|
||||
flags.push_back(flg);
|
||||
flg = Flags{};
|
||||
continue;
|
||||
@@ -95,7 +96,6 @@ namespace Managers
|
||||
return !flag.compare(val);
|
||||
}))
|
||||
{
|
||||
//cout<<"flag "<<flag<<endl;
|
||||
flg.flag = flag;
|
||||
}
|
||||
else
|
||||
@@ -119,7 +119,7 @@ namespace Managers
|
||||
return parsed;
|
||||
}
|
||||
|
||||
#pragma
|
||||
#pragma region Testing
|
||||
void ActionManager::printAction() noexcept
|
||||
{
|
||||
if (action.empty())
|
||||
@@ -140,6 +140,7 @@ namespace Managers
|
||||
cout<<"value "<<flag.value<<endl;
|
||||
}
|
||||
}
|
||||
#pragma Testing
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -33,13 +33,14 @@ using Syncers::Upload;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
CommitManager::CommitManager(IcarusAction& icaAct) : icaAction(std::move(icaAct))
|
||||
{ }
|
||||
#pragma Constructors
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
void CommitManager::commitAction()
|
||||
{
|
||||
auto action = icaAction.action;
|
||||
@@ -225,5 +226,6 @@ namespace Managers
|
||||
upld.uploadSongsFromDirectory(token, songDirectory, noConfirm, recursiveDirectory);
|
||||
}
|
||||
}
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -11,14 +11,18 @@ using std::string;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
|
||||
#pragma region Constructors
|
||||
FileManager::FileManager() {}
|
||||
FileManager::FileManager(string filePath)
|
||||
{
|
||||
this->filePath = filePath;
|
||||
readFile();
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region Functions
|
||||
void FileManager::saveFile(string newFilePath)
|
||||
{
|
||||
if (!fileRead)
|
||||
@@ -63,4 +67,7 @@ namespace Managers
|
||||
}
|
||||
|
||||
int FileManager::retrieveFileBufferLength() const { return fileBufferLength; }
|
||||
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ using Models::User;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
TokenManager::TokenManager(const User& user)
|
||||
{
|
||||
this->user = user;
|
||||
@@ -29,10 +30,10 @@ namespace Managers
|
||||
this->api.endpoint = "api/" + api.version
|
||||
+ "/login";
|
||||
}
|
||||
#pragma Constructors
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
Token TokenManager::requestToken()
|
||||
{
|
||||
Token token{};
|
||||
@@ -56,5 +57,6 @@ namespace Managers
|
||||
|
||||
return token;
|
||||
}
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ using Models::User;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
UserManager::UserManager(User user)
|
||||
{
|
||||
this->user = user;
|
||||
@@ -23,10 +24,10 @@ namespace Managers
|
||||
this->user = User{};
|
||||
parseUserFromActions();
|
||||
}
|
||||
#pragma Constructors
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
User UserManager::retrieveUser() const
|
||||
{
|
||||
return user;
|
||||
@@ -49,5 +50,6 @@ namespace Managers
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ using Models::IcarusAction;
|
||||
|
||||
namespace Parsers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
APIParser::APIParser(IcarusAction icaAct) : icaAct(icaAct)
|
||||
{
|
||||
api = API{};
|
||||
@@ -19,7 +20,7 @@ namespace Parsers
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
API APIParser::retrieveAPI() const
|
||||
{
|
||||
return api;
|
||||
@@ -48,5 +49,6 @@ namespace Parsers
|
||||
// on version 1
|
||||
api.version = "v1";
|
||||
}
|
||||
#pragma functions
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -16,16 +16,17 @@ using Models::Token;
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
Delete::Delete(API api)
|
||||
{
|
||||
this->api = api;
|
||||
this->api.endpoint = "song/data";
|
||||
}
|
||||
#pragma Constructors
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
void Delete::deleteSong(const Token token, Song song)
|
||||
{
|
||||
try
|
||||
@@ -58,5 +59,6 @@ namespace Syncers
|
||||
|
||||
return url;
|
||||
}
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ using Models::Token;
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
#pragma
|
||||
|
||||
#pragma region Constructors
|
||||
Download::Download() { }
|
||||
Download::Download(API api)
|
||||
{
|
||||
@@ -29,10 +30,10 @@ namespace Syncers
|
||||
{
|
||||
downloadFilePath = filePath;
|
||||
}
|
||||
#pragma Constructors
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Functions
|
||||
void Download::downloadSong(const Token token, Song song)
|
||||
{
|
||||
try
|
||||
@@ -87,5 +88,6 @@ namespace Syncers
|
||||
saveSong.write(data, bufferLength);
|
||||
saveSong.close();
|
||||
}
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -20,10 +20,13 @@ using Utilities::Conversions;
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
#pragma region Constructors
|
||||
RetrieveRecords::RetrieveRecords() { }
|
||||
RetrieveRecords::RetrieveRecords(API api, Token token)
|
||||
: token(token), api(api) { }
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Functions
|
||||
void RetrieveRecords::retrieve(CommitManager::RetrieveTypes type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -59,4 +62,6 @@ namespace Syncers
|
||||
writeData<<songData.dump(4);
|
||||
writeData.close();
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -24,13 +24,17 @@ using namespace cpr;
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
|
||||
#pragma region Constructors
|
||||
Upload::Upload() { }
|
||||
Upload::Upload(API api) : api(api)
|
||||
{
|
||||
this->api.endpoint = "song/data";
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region Functions
|
||||
Song Upload::uploadSong(const Models::Token& token, Song& song)
|
||||
{
|
||||
try
|
||||
@@ -170,7 +174,7 @@ namespace Syncers
|
||||
}
|
||||
|
||||
|
||||
#pragma
|
||||
#pragma region Testing
|
||||
void Upload::printSongDetails()
|
||||
{
|
||||
cout<<"Song details: "<<endl;
|
||||
@@ -211,6 +215,7 @@ namespace Syncers
|
||||
|
||||
cout<<endl<<endl;;
|
||||
}
|
||||
#pragma Testing
|
||||
#pragma Functions
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@ using std::unique_ptr;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
#pragma region Constructors
|
||||
AboutWindow::AboutWindow(QWidget* parent): QDialog(parent)
|
||||
{
|
||||
setupWindow();
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region Functions
|
||||
void AboutWindow::setupWindow()
|
||||
{
|
||||
windowWidth = 250;
|
||||
@@ -44,4 +47,6 @@ namespace UI
|
||||
{
|
||||
this->hide();
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -17,13 +17,17 @@ using Syncers::Upload;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
#pragma region Constructors
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
setupMainWindow();
|
||||
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region Functions
|
||||
void MainWindow::configureDownloadSection()
|
||||
{
|
||||
}
|
||||
@@ -171,4 +175,6 @@ namespace UI
|
||||
|
||||
uploadSongQt->setEnabled(true);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using std::unique_ptr;
|
||||
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
Conversions::Conversions()
|
||||
{
|
||||
initializeValues();
|
||||
@@ -21,4 +22,5 @@ namespace Utilities
|
||||
std::cout<<"going to print value"<<std::endl;
|
||||
std::cout<<val<<std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user