Skip to content

Commit

Permalink
Added new "No Boot Device"(found) dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobgle committed Jun 12, 2016
1 parent 6ae0377 commit e9ed52c
Show file tree
Hide file tree
Showing 9 changed files with 440 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -28,6 +28,7 @@ SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )

# Files
SET( aqemu_headers
src/No_Boot_Device.h
src/Highlighted_Label.h
src/Service.h
src/Run_Guard.h
Expand Down Expand Up @@ -77,6 +78,7 @@ SET( aqemu_headers
)

SET( aqemu_sources
src/No_Boot_Device.cpp
src/Highlighted_Label.cpp
src/Service.cpp
src/Run_Guard.cpp
Expand Down Expand Up @@ -127,6 +129,7 @@ SET( aqemu_sources
)

SET( aqemu_ui
src/No_Boot_Device.ui
src/About_Window.ui
src/Add_New_Device_Window.ui
src/Add_Port_Window.ui
Expand Down
9 changes: 6 additions & 3 deletions meson.build
Expand Up @@ -11,7 +11,8 @@ incdir = include_directories('src')

add_global_arguments( ['-DVNC_DISPLAY', '-DQTONLY'] , language : 'cpp')

aqemu_headers = ['src/Highlighted_Label.h',
aqemu_headers = ['src/No_Boot_Device.h',
'src/Highlighted_Label.h',
'src/main.h',
'src/Service.h',
'src/Run_Guard.h',
Expand Down Expand Up @@ -63,7 +64,8 @@ aqemu_headers = ['src/Highlighted_Label.h',
'src/Embedded_Display/vncclientthread.h',
'src/Embedded_Display/vncview.h']

aqemu_sources = ['src/Highlighted_Label.cpp',
aqemu_sources = ['src/No_Boot_Device.cpp',
'src/Highlighted_Label.cpp',
'src/Service.cpp',
'src/Run_Guard.cpp',
'src/QEMU_Docopt.cpp',
Expand Down Expand Up @@ -118,7 +120,8 @@ aqemu_sources = ['src/Highlighted_Label.cpp',
aqemu_resources = ['resources/icons.qrc',
'resources/shared_images.qrc']

aqemu_ui = ['src/About_Window.ui',
aqemu_ui = ['src/No_Boot_Device.ui',
'src/About_Window.ui',
'src/Add_New_Device_Window.ui',
'src/Add_Port_Window.ui',
'src/Add_USB_Port_Window.ui',
Expand Down
6 changes: 4 additions & 2 deletions src/Main_Window.cpp
Expand Up @@ -57,6 +57,7 @@
#include "Settings_Widget.h"
#include "Utils.h"
#include "Service.h"
#include "No_Boot_Device.h"

// This is static emulator devices data
QMap<QString, Available_Devices> System_Info::Emulator_QEMU_2_0;
Expand Down Expand Up @@ -4100,7 +4101,8 @@ bool Main_Window::Boot_Is_Correct( Virtual_Machine *tmp_vm )

if( foundEnabledDevice )
{
AQGraphic_Warning( tr("Error!"), tr("No boot device found!") );
//AQGraphic_Warning( tr("Error!"), tr("No boot device found!") );
No_Boot_Device(this).exec();
return false;
}
else return true; // boot device type: None
Expand Down Expand Up @@ -5485,7 +5487,7 @@ void Main_Window::Set_Boot_Order( const QList<VM::Boot_Order> &list )

void Main_Window::on_TB_Show_Boot_Settings_Window_clicked()
{
Boot_Device_Window boot_win;
Boot_Device_Window boot_win(this);
boot_win.setData( Boot_Order_List );
boot_win.setUseBootMenu( Show_Boot_Menu );

Expand Down
2 changes: 2 additions & 0 deletions src/Main_Window.h
Expand Up @@ -48,6 +48,8 @@ class Network_Card_Widget;

class Main_Window: public QMainWindow
{
friend class No_Boot_Device;

Q_OBJECT

public:
Expand Down
103 changes: 103 additions & 0 deletions src/No_Boot_Device.cpp
@@ -0,0 +1,103 @@
/****************************************************************************
**
** Copyirght (C) 2016 Tobias Gläßer
**
** This file is part of AQEMU.
**
** 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.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/

#include <QFileInfo>
#include <QMessageBox>
#include <QMenu>
#include <QTimer>

#include "Main_Window.h"
#include "No_Boot_Device.h"
#include "Add_New_Device_Window.h"
#include "Utils.h"
#include "Create_HDD_Image_Window.h"
#include "System_Info.h"
#include <iostream>

No_Boot_Device::No_Boot_Device( QWidget *parent )
: QDialog( parent )
{
ui.setupUi( this );

connect(ui.boot_order_button,SIGNAL(clicked()),this,SLOT(Change_Boot_Order()));
connect(ui.device_manager_button,SIGNAL(clicked()),this,SLOT(Device_Manager()));
connect(ui.special_image_boot_button,SIGNAL(clicked()),this,SLOT(Special_Image()));
connect(ui.computer_port_button,SIGNAL(clicked()),this,SLOT(Computer_Port()));
connect(ui.kernel_boot_button,SIGNAL(clicked()),this,SLOT(Kernel_Boot()));

auto mw = static_cast<Main_Window*>(parent);
ui.boot_order_button->setDescription(tr("Current order:")+" "+mw->ui.CB_Boot_Priority->currentText());
}

No_Boot_Device::~No_Boot_Device()
{
}

void No_Boot_Device::Set_VM( const Virtual_Machine &vm )
{
}

void No_Boot_Device::Change_Boot_Order()
{
auto mw = static_cast<Main_Window*>(parent());
mw->ui.Tabs->setCurrentIndex(1);

QTimer::singleShot(50, mw, SLOT(on_TB_Show_Boot_Settings_Window_clicked()));

accept();
}

void No_Boot_Device::Device_Manager()
{
auto mw = static_cast<Main_Window*>(parent());
mw->ui.Tabs->setCurrentIndex(2);
mw->Media_Settings_Widget->setCurrentIndex(0);
accept();
}


void No_Boot_Device::Special_Image()
{
auto mw = static_cast<Main_Window*>(parent());
mw->ui.Tabs->setCurrentIndex(2);
mw->Media_Settings_Widget->setCurrentIndex(4);
accept();
}


void No_Boot_Device::Computer_Port()
{
auto mw = static_cast<Main_Window*>(parent());
mw->ui.Tabs->setCurrentIndex(2);
mw->Media_Settings_Widget->setCurrentIndex(2);
accept();
}


void No_Boot_Device::Kernel_Boot()
{
auto mw = static_cast<Main_Window*>(parent());
mw->ui.Tabs->setCurrentIndex(2);
mw->Media_Settings_Widget->setCurrentIndex(3);
accept();
}

51 changes: 51 additions & 0 deletions src/No_Boot_Device.h
@@ -0,0 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2016 Tobias Gläßer
**
** This file is part of AQEMU.
**
** 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.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/

#ifndef NO_BOOT_DEVICE_H
#define NO_BOOT_DEVICE_H

#include "VM.h"
#include "ui_No_Boot_Device.h"

class No_Boot_Device: public QDialog
{

Q_OBJECT

public:
No_Boot_Device( QWidget *parent = 0 );
~No_Boot_Device();
void Set_VM( const Virtual_Machine &vm );

private slots:
void Change_Boot_Order();
void Device_Manager();
void Special_Image();
void Kernel_Boot();
void Computer_Port();

private:
Ui::No_Boot_Device ui;
};

#endif

0 comments on commit e9ed52c

Please sign in to comment.