Skip to content

Commit

Permalink
add icons, set the first version
Browse files Browse the repository at this point in the history
  • Loading branch information
dridk committed Dec 19, 2016
1 parent d2aae13 commit e7cd97e
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 7 deletions.
6 changes: 4 additions & 2 deletions CuteVcf.pro
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ SOURCES += main.cpp\
vcfline.cpp \
infowidget.cpp \
samplewidget.cpp \
vcfheader.cpp
vcfheader.cpp \
aboutdialog.cpp

HEADERS += mainwindow.h \
qtabix.h \
vcfmodel.h \
vcfline.h \
infowidget.h \
samplewidget.h \
vcfheader.h
vcfheader.h \
aboutdialog.h

RESOURCES += \
icons/icons.qrc
Expand Down
67 changes: 67 additions & 0 deletions aboutdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include "aboutdialog.h"

AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{

setWindowTitle(tr("About"));

mTabWidget = new QTabWidget;

QLabel * mIconLabel = new QLabel;
QLabel * mTitleLabel = new QLabel;

mIconLabel->setPixmap(QPixmap(":/app.png").scaledToHeight(64, Qt::SmoothTransformation));
mTitleLabel->setText(qApp->applicationName());
mTitleLabel->setAlignment(Qt::AlignLeft);
QFont font;
font.setPixelSize(25);
mTitleLabel->setFont(font);

QHBoxLayout * hLayout = new QHBoxLayout;
hLayout->addWidget(mIconLabel);
hLayout->addWidget(mTitleLabel);

QVBoxLayout * vLayout = new QVBoxLayout;
vLayout->addLayout(hLayout);
vLayout->addWidget(mTabWidget);

QPlainTextEdit * edit = new QPlainTextEdit;
edit->setPlainText(QString("Version: %1").arg(qApp->applicationVersion()));

mTabWidget->addTab(edit, "Version");

setLayout(vLayout);


}

void AboutDialog::makeHeader()
{

// QPixmap pix(width(), height()/2);
// pix.fill(Qt::white);

// QPainter painter(&pix);

// QPixmap logo = QPixmap(":/app.png");
// int size = 128;
// int margin = (pix.height() - size) / 2 ;

// painter.drawPixmap(0,margin,logo);

// QRect area(130, 0, pix.width()-130, pix.height() );

// QFont font;
// font.setPixelSize(30);
// painter.setFont(font);

// painter.drawText(area, Qt::AlignLeft|Qt::AlignVCenter, qApp->applicationName() + "\n" + qApp->applicationVersion());


// mHeader->setPixmap(pix);
// mHeader->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
// mHeader->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);



}
21 changes: 21 additions & 0 deletions aboutdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QtWidgets>

class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);

protected:
void makeHeader();

private:
QTabWidget * mTabWidget;
QDialogButtonBox * mButtons;


};

#endif // ABOUTDIALOG_H
179 changes: 179 additions & 0 deletions design/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions icons/icons.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/">
<file>dna.png</file>
<file>search.png</file>
<file>app.png</file>
</qresource>
</RCC>
Binary file added icons/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName("CuteVCF");
QCoreApplication::setOrganizationDomain("labsquare.org");
QCoreApplication::setOrganizationName("labsquare");
QCoreApplication::setApplicationVersion("0.1.0");



MainWindow win;
Expand Down
19 changes: 14 additions & 5 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ MainWindow::MainWindow(QWidget *parent) :
mSampleWidget = new SampleWidget(mModel);
mVariantCount = new QLabel(this);

setWindowIcon(QIcon(":/app.png"));

mView->setModel(mModel);
setCentralWidget(mView);

Expand All @@ -20,7 +22,7 @@ MainWindow::MainWindow(QWidget *parent) :
mSearchEdit->setPlaceholderText(tr("Write the region to select in format <chr> or <chr:start-end>"));
mSearchEdit->setCompleter(new QCompleter);
mSearchEdit->completer()->setCaseSensitivity(Qt::CaseInsensitive);

mSearchEdit->addAction(QIcon::fromTheme("system-search"),QLineEdit::LeadingPosition);
statusBar()->addPermanentWidget(mVariantCount);


Expand Down Expand Up @@ -143,16 +145,22 @@ void MainWindow::exportCsv()

}

void MainWindow::showAbout()
{
AboutDialog dialog;
dialog.exec();
}


void MainWindow::createMenuBar()
{
QMenuBar * bar = new QMenuBar;

// File menu
QMenu * fileMenu = bar->addMenu(tr("&File"));
fileMenu->addAction(tr("Open of vcf file"),this,SLOT(openFile()),QKeySequence::Open);
fileMenu->addAction(tr("Export to CSV"),this,SLOT(exportCsv()),QKeySequence::Save);
fileMenu->addAction(tr("Close"),qApp, SLOT(closeAllWindows()), QKeySequence::Quit);
fileMenu->addAction(QIcon::fromTheme("document-open"), tr("Open of vcf file"),this,SLOT(openFile()),QKeySequence::Open);
fileMenu->addAction(QIcon::fromTheme("document-save-as"),tr("Export to CSV"),this,SLOT(exportCsv()),QKeySequence::Save);
fileMenu->addAction(QIcon::fromTheme("application-exit"),tr("Close"),qApp, SLOT(closeAllWindows()), QKeySequence::Quit);

// Edit menu
QMenu * editMenu = bar->addMenu(tr("&Edit"));
Expand All @@ -171,7 +179,8 @@ void MainWindow::createMenuBar()

// Help menu
QMenu * helpMenu = bar->addMenu(tr("&Help"));
helpMenu->addAction(tr("About Qt"),qApp,SLOT(aboutQt()));
helpMenu->addAction(QIcon::fromTheme("help-about"),tr("About %1").arg(qApp->applicationName()),this,SLOT(showAbout()));
helpMenu->addAction(QIcon::fromTheme("help-about"),tr("About Qt"),qApp,SLOT(aboutQt()));


setMenuBar(bar);
Expand Down
3 changes: 3 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "vcfmodel.h"
#include "infowidget.h"
#include "samplewidget.h"
#include "aboutdialog.h"
class MainWindow : public QMainWindow
{
Q_OBJECT
Expand All @@ -20,6 +21,7 @@ public Q_SLOTS:
void openFile();
void searchRegion();
void exportCsv();
void showAbout();

protected:
void createMenuBar();
Expand All @@ -36,6 +38,7 @@ public Q_SLOTS:
QLabel * mVariantCount;



};

#endif // MAINWINDOW_H

0 comments on commit e7cd97e

Please sign in to comment.