mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
gui/hdd_menu.cpp: rework HDD menu, add device mount/umount,
add support for mmc and DVD/BD devices, make easy to add other filesystems mkfs/fsck, parts based on code (C) martii
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,14 @@
|
||||
Neutrino-GUI - DBoxII-Project
|
||||
|
||||
|
||||
License: GPL
|
||||
Copyright (C) 2009-2014 CoolStream International Ltd
|
||||
Copyright (C) 2013-2014 martii
|
||||
|
||||
License: GPLv2
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -28,11 +30,14 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
enum {
|
||||
fs_ext3,
|
||||
fs_ext4,
|
||||
|
||||
fs_max
|
||||
struct devtool_s {
|
||||
std::string fmt;
|
||||
std::string fsck;
|
||||
std::string fsck_options;
|
||||
std::string mkfs;
|
||||
std::string mkfs_options;
|
||||
bool fsck_supported;
|
||||
bool mkfs_supported;
|
||||
};
|
||||
|
||||
class CHDDDestExec : public CMenuTarget
|
||||
@@ -40,21 +45,50 @@ class CHDDDestExec : public CMenuTarget
|
||||
public:
|
||||
int exec(CMenuTarget* parent, const std::string&);
|
||||
};
|
||||
class CHDDFmtExec : public CMenuTarget
|
||||
{
|
||||
public:
|
||||
int exec(CMenuTarget* parent, const std::string&);
|
||||
};
|
||||
class CHDDChkExec : public CMenuTarget
|
||||
{
|
||||
public:
|
||||
int exec(CMenuTarget* parent, const std::string&);
|
||||
};
|
||||
|
||||
class CHDDMenuHandler : public CMenuTarget
|
||||
{
|
||||
private:
|
||||
int width;
|
||||
std::string mount;
|
||||
std::string umount;
|
||||
bool show_menu;
|
||||
std::map<std::string, std::string> devtitle;
|
||||
struct hdd_s {
|
||||
std::string devname;
|
||||
std::string fmt;
|
||||
std::string desc;
|
||||
CMenuForwarder *cmf;
|
||||
bool mounted;
|
||||
};
|
||||
std::vector<hdd_s> hdd_list;
|
||||
struct cmp_hdd_by_name: public binary_function <const struct hdd_s, const struct hdd_s, bool>
|
||||
{
|
||||
bool operator() (const struct hdd_s c1, const struct hdd_s c2)
|
||||
{
|
||||
return std::lexicographical_compare(c1.devname.begin(), c1.devname.end(), c2.devname.begin(), c2.devname.end());
|
||||
};
|
||||
};
|
||||
|
||||
static devtool_s devtools[];
|
||||
|
||||
bool is_mounted(const char *dev);
|
||||
void getBlkIds();
|
||||
std::string getFmtType(std::string name, std::string part = "");
|
||||
std::string getDefaultPart(std::string dev);
|
||||
bool mount_dev(std::string name);
|
||||
bool umount_dev(std::string name);
|
||||
bool umount_all(std::string dev);
|
||||
bool add_dev(std::string dev, std::string part);
|
||||
bool waitfordev(std::string dev, int maxwait);
|
||||
void check_dev_tools();
|
||||
devtool_s * get_dev_tool(std::string fmt);
|
||||
|
||||
int showDeviceMenu(std::string dev);
|
||||
int checkDevice(std::string dev);
|
||||
int formatDevice(std::string dev);
|
||||
void showError(neutrino_locale_t err);
|
||||
|
||||
public:
|
||||
CHDDMenuHandler();
|
||||
~CHDDMenuHandler();
|
||||
@@ -63,4 +97,3 @@ class CHDDMenuHandler : public CMenuTarget
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user