diff --git a/filelist.cpp b/filelist.cpp --- a/filelist.cpp +++ b/filelist.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #include "filelist.h" #include #include diff --git a/filelist.h b/filelist.h --- a/filelist.h +++ b/filelist.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #ifndef FILELIST_H #define FILELIST_H diff --git a/genericBinaryFiles.qrc b/genericBinaryFiles.qrc --- a/genericBinaryFiles.qrc +++ b/genericBinaryFiles.qrc @@ -2,5 +2,6 @@ ressources/Gnome-list-add.svg ressources/Gnome-user-trash.svg + ressources/Gnome-emblem-unreadable.svg diff --git a/genericbinaryfilewidget.cpp b/genericbinaryfilewidget.cpp --- a/genericbinaryfilewidget.cpp +++ b/genericbinaryfilewidget.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #include "genericbinaryfilewidget.h" #include "ui_genericbinaryfilewidget.h" #include @@ -15,10 +36,15 @@ genericBinaryFileWidget::genericBinaryFi ui(new Ui::genericBinaryFileWidget) { ui->setupUi(this); + ui->showFileListQpb->setOrientation(Qt::Vertical); + ui->showFileListWdgt->setHidden(true); connect(this->ui->openFileQpb,SIGNAL(clicked()),this,SLOT(openFile())); connect(this->ui->removeFileQpb,SIGNAL(clicked()),this,SLOT(removeFiles())); connect(this->ui->fileList,SIGNAL(cellActivated(int,int)),this,SLOT(fileCellActivated(int,int))); connect(this->ui->fileList,SIGNAL(openFiles(QStringList)),this,SLOT(openFile(QStringList))); + connect(this->ui->hideFileListQpb,SIGNAL(clicked()),this,SLOT(hideFileList())); + connect(this->ui->showFileListQpb,SIGNAL(clicked()),this,SLOT(showFileList())); + } genericBinaryFileWidget::~genericBinaryFileWidget() @@ -185,6 +211,18 @@ void genericBinaryFileWidget::fileCellAc } } +void genericBinaryFileWidget::hideFileList() +{ + this->ui->fileListGBox->setHidden(true); + this->ui->showFileListWdgt->setVisible(true); +} + +void genericBinaryFileWidget::showFileList() +{ + this->ui->fileListGBox->setVisible(true); + this->ui->showFileListWdgt->setHidden(true); +} + diff --git a/genericbinaryfilewidget.h b/genericbinaryfilewidget.h --- a/genericbinaryfilewidget.h +++ b/genericbinaryfilewidget.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #ifndef GENERICBINARYFILEWIDGET_H #define GENERICBINARYFILEWIDGET_H @@ -55,6 +76,8 @@ public slots: void updateFileList(); void removeFiles(); void fileCellActivated(int row, int column); + void hideFileList(); + void showFileList(); private: Ui::genericBinaryFileWidget *ui; diff --git a/genericbinaryfilewidget.ui b/genericbinaryfilewidget.ui --- a/genericbinaryfilewidget.ui +++ b/genericbinaryfilewidget.ui @@ -16,76 +16,201 @@ Form - - + + + 0 + + + 0 + + + 2 + + + 2 + + + 2 + + + + + + 0 + + + + + File list + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal - - - - - - - - - - :/img/ressources/Gnome-list-add.svg:/img/ressources/Gnome-list-add.svg - - - - 24 - 24 - - - - - - - - - - - - :/img/ressources/Gnome-user-trash.svg:/img/ressources/Gnome-user-trash.svg - - - - 24 - 24 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - - File + + + File list + + + + 2 + + + 2 + + + + + + 2 + + + 2 - - - - Type - - + + + + + 16 + 16 + + + + + 16 + 16 + + + + + + + + :/img/ressources/Gnome-emblem-unreadable.svg:/img/ressources/Gnome-emblem-unreadable.svg + + + + + + + false + + + + File + + + + + Type + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + + + + + :/img/ressources/Gnome-user-trash.svg:/img/ressources/Gnome-user-trash.svg + + + + 24 + 24 + + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + + + + + :/img/ressources/Gnome-list-add.svg:/img/ressources/Gnome-list-add.svg + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -111,6 +236,11 @@ QTableWidget
filelist.h
+ + QVPushButton + QPushButton +
qvpushbutton.h
+
diff --git a/qtablewidgetintitem.cpp b/qtablewidgetintitem.cpp --- a/qtablewidgetintitem.cpp +++ b/qtablewidgetintitem.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #include "qtablewidgetintitem.h" QTableWidgetIntItem::QTableWidgetIntItem(const QString &text,int Type) diff --git a/qtablewidgetintitem.h b/qtablewidgetintitem.h --- a/qtablewidgetintitem.h +++ b/qtablewidgetintitem.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #ifndef QTABLEWIDGETINTITEM_H #define QTABLEWIDGETINTITEM_H diff --git a/qvpushbutton.cpp b/qvpushbutton.cpp new file mode 100644 --- /dev/null +++ b/qvpushbutton.cpp @@ -0,0 +1,153 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#include "qvpushbutton.h" +#include +#include + +QVPushButton::QVPushButton(QWidget *parent) : + QPushButton(parent) +{ + init(); +} + +QVPushButton::QVPushButton(const QString &text, QWidget *parent) +{ + init(); +} + +QVPushButton::QVPushButton(const QIcon &icon, const QString &text, QWidget *parent): + QPushButton(parent) +{ + init(); +} + +QVPushButton::~QVPushButton() +{ + +} + +Qt::Orientation QVPushButton::orientation() const +{ + return orientation_; +} + +void QVPushButton::setOrientation(Qt::Orientation orientation) +{ + orientation_ = orientation; + switch (orientation) + { + case Qt::Horizontal: + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); + break; + + case Qt::Vertical: + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); + break; + } +} + +bool QVPushButton::mirrored() const +{ + return mirrored_; +} + +void QVPushButton::setMirrored(bool mirrored) +{ + mirrored_ = mirrored; +} + +QSize QVPushButton::sizeHint() const +{ + QSize size = QPushButton::sizeHint(); + if (orientation_ == Qt::Vertical) + size.transpose(); + return size; +} + +void QVPushButton::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + QStylePainter p(this); + + switch (orientation_) + { + case Qt::Horizontal: + if (mirrored_) + { + p.rotate(180); + p.translate(-width(), -height()); + } + break; + + case Qt::Vertical: + if (mirrored_) + { + p.rotate(-90); + p.translate(-height(), 0); + } + else + { + p.rotate(90); + p.translate(0, -width()); + } + break; + } + + p.drawControl(QStyle::CE_PushButton, getStyleOption()); +} + +QStyleOptionButton QVPushButton::getStyleOption() const +{ + QStyleOptionButton opt; + opt.initFrom(this); + if (orientation_ == Qt::Vertical) + { + QSize size = opt.rect.size(); + size.transpose(); + opt.rect.setSize(size); + } + opt.features = QStyleOptionButton::None; + if (isFlat()) + opt.features |= QStyleOptionButton::Flat; + if (menu()) + opt.features |= QStyleOptionButton::HasMenu; + if (autoDefault() || isDefault()) + opt.features |= QStyleOptionButton::AutoDefaultButton; + if (isDefault()) + opt.features |= QStyleOptionButton::DefaultButton; + if (isDown() || (menu() && menu()->isVisible())) + opt.state |= QStyle::State_Sunken; + if (isChecked()) + opt.state |= QStyle::State_On; + if (!isFlat() && !isDown()) + opt.state |= QStyle::State_Raised; + opt.text = text(); + opt.icon = icon(); + opt.iconSize = iconSize(); + return opt; +} + +void QVPushButton::init() +{ + orientation_ = Qt::Horizontal; + mirrored_ = false; +} diff --git a/qvpushbutton.h b/qvpushbutton.h new file mode 100644 --- /dev/null +++ b/qvpushbutton.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- 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. +-- +-- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +-- Copied from example http://www.qtcentre.org/wiki/index.php?title=OrientationButton +----------------------------------------------------------------------------*/ +#ifndef QVPUSHBUTTON_H +#define QVPUSHBUTTON_H + +#include +#include + +class QVPushButton : public QPushButton +{ + Q_OBJECT +public: + explicit QVPushButton(QWidget *parent = 0); + QVPushButton(const QString& text, QWidget* parent = 0); + QVPushButton(const QIcon& icon, const QString& text, QWidget* parent = 0); + ~QVPushButton(); + + Qt::Orientation orientation() const; + void setOrientation(Qt::Orientation orientation); + + bool mirrored() const; + void setMirrored(bool mirrored); + + QSize sizeHint() const; + +protected: + void paintEvent(QPaintEvent* event); + +private: + QStyleOptionButton getStyleOption() const; + void init(); + + Qt::Orientation orientation_; + bool mirrored_; + +}; + +#endif // QVPUSHBUTTON_H diff --git a/ressources/Gnome-emblem-unreadable.svg b/ressources/Gnome-emblem-unreadable.svg new file mode 100644 --- /dev/null +++ b/ressources/Gnome-emblem-unreadable.svg @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + + Read-only + + + emblem + read-only + no-read + locked + lock + + + + + + + + + + + + + + + + + + + + + + + +