Skip to content

Commit

Permalink
GUI: Remove Selection class
Browse files Browse the repository at this point in the history
  • Loading branch information
fdde authored and DrMcCoy committed Dec 27, 2017
1 parent 99511c5 commit df84f80
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 111 deletions.
21 changes: 10 additions & 11 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,21 @@ void MainWindow::setLabels() {
QString labelFileType = "File type: ";
QString labelResType = "Resource type: ";

labelName += _currentSelection.fileName();
labelName += _currentItem->getName();

if (_currentSelection.getSource() == Source::kSourceDirectory) {
if (_currentItem->getSource() == Source::kSourceDirectory) {

labelSize += "-";
labelFileType += "Directory";
labelResType += "Directory";

} else if ((_currentSelection.getSource() == Source::kSourceFile) ||
(_currentSelection.getSource() == Source::kSourceArchiveFile)) {
} else if ((_currentItem->getSource() == Source::kSourceFile) ||
(_currentItem->getSource() == Source::kSourceArchiveFile)) {

Aurora::FileType fileType = _currentSelection.getFileType();
Aurora::ResourceType resType = _currentSelection.getResourceType();
Aurora::FileType fileType = _currentItem->getFileType();
Aurora::ResourceType resType = _currentItem->getResourceType();

labelSize += getSizeLabel(_currentSelection.size());
labelSize += getSizeLabel(_currentItem->getSize());
labelFileType += getFileTypeLabel(fileType);
labelResType += getResTypeLabel(resType);
}
Expand All @@ -210,7 +210,6 @@ void MainWindow::setLabels() {
_ui->resLabelResType->setText(labelResType);
}


void MainWindow::clearLabels() {
_ui->resLabelName->setText("Resource name:");
_ui->resLabelSize->setText("Size:");
Expand All @@ -230,7 +229,7 @@ void MainWindow::showPreviewPanel(QFrame *panel) {
}

void MainWindow::showPreviewPanel() {
switch (_currentSelection.getResourceType()) {
switch (_currentItem->getResourceType()) {
case Aurora::kResourceImage:
showPreviewPanel(_panelPreviewImage);
break;
Expand All @@ -241,7 +240,7 @@ void MainWindow::showPreviewPanel() {

default:
{
switch (_currentSelection.getFileType()) {
switch (_currentItem->getFileType()) {
case Aurora::FileType::kFileTypeICO:
showPreviewPanel(_panelPreviewImage);
break;
Expand All @@ -261,7 +260,7 @@ void MainWindow::showPreviewPanel() {

void MainWindow::selection(const QItemSelection &selected) {
const QModelIndex index = selected.indexes().at(0);
_currentSelection = Selection(_treeModel->getNode(index)->getFileInfo());
_currentItem = _treeModel->getNode(index);
setLabels();
showPreviewPanel();
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "src/gui/panelpreviewimage.h"
#include "src/gui/panelpreviewsound.h"
#include "src/gui/panelpreviewtext.h"
#include "src/gui/selection.h"

namespace Ui {
class MainWindow;
Expand All @@ -46,6 +45,7 @@ namespace Ui {
namespace GUI {

class ResourceTree;
class ResourceTreeItem;

class MainWindow : public QMainWindow {
W_OBJECT(MainWindow)
Expand Down Expand Up @@ -83,7 +83,7 @@ class MainWindow : public QMainWindow {
Ui::MainWindow *_ui;
ResourceTree *_treeModel;
QLabel *_statusLabel;
Selection _currentSelection;
ResourceTreeItem *_currentItem;

PanelPreviewEmpty *_panelPreviewEmpty;
PanelPreviewImage *_panelPreviewImage;
Expand Down
4 changes: 1 addition & 3 deletions src/gui/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ src_gui_libgui_la_SOURCES += \
src/gui/eventid.h \
src/gui/mainwindow.h \
src/gui/resourcetree.h \
src/gui/resoutcetreeitem.h \
src/gui/resourcetreeitem.h \
src/gui/panelresourceinfo.h \
src/gui/panelpreviewempty.h \
src/gui/panelpreviewsound.h \
src/gui/panelpreviewimage.h \
src/gui/panelpreviewtext.h \
src/gui/selection.h \
$(QT_UI_FORMS_BUILT) \
$(EMPTY)

Expand All @@ -54,7 +53,6 @@ src_gui_libgui_la_SOURCES += \
src/gui/panelpreviewsound.cpp \
src/gui/panelpreviewimage.cpp \
src/gui/panelpreviewtext.cpp \
src/gui/selection.cpp \
$(EMPTY)

EXTRA_src_gui_libgui_la_DEPENDENCIES = \
Expand Down
59 changes: 0 additions & 59 deletions src/gui/selection.cpp

This file was deleted.

36 changes: 0 additions & 36 deletions src/gui/selection.h

This file was deleted.

0 comments on commit df84f80

Please sign in to comment.