OSDN Git Service

b33c25a655b7718391b8ed0be4e40173e6d2e0b3
[csp-qt/common_source_project-fm7.git] / source / src / qt / gui / util_hdd.cpp
1 /*
2  * UI->Qt->MainWindow : FDD Utils.
3  * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
4  * License: GPLv2
5  *
6  * History:
7  * Jan 24, 2014 : Moved from some files.
8  */
9 #include <QApplication>
10
11 #include "mainwidget_base.h"
12 #include "commonclasses.h"
13 #include "menu_harddisk.h"
14
15 #include "qt_dialogs.h"
16 #include "csp_logger.h"
17
18 #include "menu_flags.h"
19
20 //extern USING_FLAGS *using_flags;
21 //extern class EMU *emu;
22
23
24 void Ui_MainWindowBase::do_update_recent_hard_disk(int drv)
25 {
26 }
27
28
29 int Ui_MainWindowBase::set_recent_hard_disk(int drv, int num) 
30 {
31         return 0;
32 }
33
34 void Ui_MainWindowBase::_open_hard_disk(int drv, const QString fname)
35 {
36 }
37
38 void Ui_MainWindowBase::eject_hard_disk(int drv) 
39 {
40         emit sig_close_hard_disk(drv);
41         menu_hdds[drv]->do_clear_inner_media();
42 }
43
44 // Common Routine
45
46 void Ui_MainWindowBase::CreateHardDiskMenu(int drv, int drv_base)
47 {
48         {
49                 QString ext = "*.thd;*.nhd;*.hdi;*.hdd;*.dat";
50                 QString desc1 = "Hard Disk Drive";
51                 menu_hdds[drv] = new Menu_HDDClass(menubar, QString::fromUtf8("HDD"), using_flags, this, drv, drv_base);
52                 menu_hdds[drv]->create_pulldown_menu();
53                 
54                 menu_hdds[drv]->do_clear_inner_media();
55                 menu_hdds[drv]->do_add_media_extension(ext, desc1);
56                 SETUP_HISTORY(p_config->recent_hard_disk_path[drv], listHDDs[drv]);
57                 menu_hdds[drv]->do_update_histories(listHDDs[drv]);
58                 menu_hdds[drv]->do_set_initialize_directory(p_config->initial_hard_disk_dir);
59         }
60 }
61
62 void Ui_MainWindowBase::CreateHardDiskPulldownMenu(int drv)
63 {
64 }
65
66 void Ui_MainWindowBase::ConfigHardDiskMenuSub(int drv)
67 {
68 }
69
70 void Ui_MainWindowBase::retranslateHardDiskMenu(int drv, int basedrv)
71 {
72         QString s = QApplication::translate("MenuMedia", "HDD", 0);
73         s = s + QString::number(basedrv);
74         retranslateHardDiskMenu(drv, basedrv, s);
75 }
76
77 void Ui_MainWindowBase::retranslateHardDiskMenu(int drv, int basedrv, QString specName)
78 {
79         QString drive_name;
80         drive_name = QString::fromUtf8(":");
81         drive_name = specName + drive_name;
82         //drive_name += QString::number(basedrv);
83   
84         if((drv < 0) || (drv >= using_flags->get_max_hdd())) return;
85         menu_hdds[drv]->setTitle(QApplication::translate("MenuMedia", drive_name.toUtf8().constData() , 0));
86         menu_hdds[drv]->retranslateUi();
87 }
88
89 void Ui_MainWindowBase::ConfigHardDiskMenu(void)
90 {
91         for(int i = 0; i < using_flags->get_max_hdd(); i++) {
92                 ConfigHardDiskMenuSub(i);
93         }
94 }