switch (mode) {
case Type::ENCRYPT_DEVICE:
- interface = new EncryptDeviceInterface{};
+ interface.reset(new EncryptDeviceInterface{});
break;
case Type::DECRYPT_DEVICE:
- interface = new DecryptDeviceInterface{};
+ interface.reset(new DecryptDeviceInterface{});
break;
case Type::ENCRYPT_SD_CARD:
- interface = new EncryptSDCardInterface{};
+ interface.reset(new EncryptSDCardInterface{});
break;
case Type::DECRYPT_SD_CARD:
- interface = new DecryptSDCardInterface{};
+ interface.reset(new DecryptSDCardInterface{});
break;
case Type::INSERT_SD_CARD:
- interface = new InsertSDCardInterface{appControl.get()};
+ interface.reset(new InsertSDCardInterface{appControl.get()});
break;
case Type::SD_CARD_PASSWORD:
- interface = new PasswordSDCard{};
+ interface.reset(new PasswordSDCard{});
break;
case Type::ENCRYPT_EXTENSION:
dlog_print(DLOG_INFO, "ODE-UI", "Device Path : %s / Mapping Node : %s", appControl->getData("dev_path").c_str(), appControl->getData("mapping_node").c_str());
- interface = new EncryptExtensionInterface{appControl.get()};
+ interface.reset(new EncryptExtensionInterface{appControl.get()});
break;
case Type::SD_CARD_EXTENDED_PASSWORD:
dlog_print(DLOG_INFO, "ODE-UI", "Device Path : %s / Mapping Node : %s", appControl->getData("dev_path").c_str(), appControl->getData("mapping_node").c_str());
- interface = new PasswordSDCardExtended{appControl->getData("dev_path"), appControl->getData("mapping_node")};
+ interface.reset(new PasswordSDCardExtended{appControl->getData("dev_path"), appControl->getData("mapping_node")});
break;
default:
throw runtime::Exception("Do not supported viewtype");
void ODELaunchPad::onTerminate()
{
- if (interface) {
- delete interface;
- }
}
ODEStandAlone::ODEStandAlone()
ODEStandAlone::~ODEStandAlone()
{
- if (interface) {
- delete interface;
- }
}
void ODEStandAlone::createProgressInterface(const std::string &type, const std::string &target)
{
- if (interface == nullptr) {
- interface = new ODEInterface{};
- }
+ interface.reset(new ODEInterface{});
interface->setBaseLayout();
if ((!type.compare("encrypt") || !type.compare("Encrypting"))
}
}
+void ODEStandAlone::createPasswordInterface()
+{
+ interface.reset(new PasswordSDCard{});
+
+ if (interface)
+ interface->create();
+}
+
int ODEStandAlone::run(int argc, char *argv[])
{
char *lang = nullptr;
::elm_init(argc, argv);
::elm_scale_set(1.8);
+
if (!strncmp(argv[1], "progress", sizeof("progress"))) {
if (argc < 4) {
return -1;
}
createProgressInterface(argv[2], argv[3]);
+ } else if (!strncmp(argv[1], "lock", sizeof("lock"))) {
+ createPasswordInterface();
}
::elm_run();
int getMode(const std::string &type);
std::string viewtype;
int mode;
- ODEInterface *interface;
+ std::unique_ptr<ODEInterface> interface;
};
class ODEStandAlone : public Application {
int run(int argc, char *argv[]);
void createProgressInterface(const std::string &type, const std::string &target);
+ void createPasswordInterface();
private:
- ODEInterface *interface;
+ std::unique_ptr<ODEInterface> interface;
std::unique_ptr<ProgressPage> progress;
};