Example #1
0
MainWindow::MainWindow()
{
    setUnifiedTitleAndToolBarOnMac( true );

    QStatusBar* status = new QStatusBar( this );
    PlaybackControlsWidget* pcw = new PlaybackControlsWidget( status );

    //FIXME: this code is duplicated in the audioscrobbler app too
    //In order to compensate for the sizer grip on the bottom right
    //of the window, an empty QWidget is added as a spacer.
    QSizeGrip* sg = status->findChild<QSizeGrip *>();
    if( sg ) {
        int gripWidth = sg->sizeHint().width();
        QWidget* w = new QWidget( status );
        w->setFixedWidth( gripWidth );
        status->addWidget( w );
    }

    //Seemingly the only way to get a central widget in a QStatusBar
    //is to add an empty widget either side with a stretch value.
    status->addWidget( new QWidget( status), 1 );
    status->addWidget( pcw );
    status->addWidget( new QWidget( status), 1 );

    setStatusBar( status );

    MainWidget* mw;

    QWidget* w = new QWidget();
    
    new QVBoxLayout( w );
    w->layout()->addWidget(mw = new MainWidget());

    m_messageBar = new MessageBar( this );

    connect(mw, SIGNAL(startRadio(RadioStation)), SIGNAL(startRadio(RadioStation)));

    AuthenticatedUser user;
    connect(user.getFriends(), SIGNAL(finished()), mw, SLOT(onUserGotFriends()));
    connect(user.getTopTags(), SIGNAL(finished()), mw, SLOT(onUserGotTopTags()));
    connect(user.getPlaylists(), SIGNAL(finished()), mw, SLOT(onUserGotPlaylists()));
    connect(user.getRecentStations(), SIGNAL(finished()), mw, SLOT(onUserGotRecentStations()));

    setCentralWidget( w );

    finishUi();

    //todo: bury this:
    menuBar()->addMenu("Normania")->addAction( tr("RQL"), mw, SLOT(rawrql()), QKeySequence(tr("Ctrl+r")) );

    m_messageBar->raise();
}
Example #2
0
//! Methode zum Setzen / Füllen der Statusleiste
void MainWindow::setStatusBar()
{
  QStatusBar* statusBar = new QStatusBar();
  statusBar->addWidget(new QLabel(tr("Gebiete: ") + QString::number(_DB->allArea()->count()) \
                                  + tr(" | Bewohner: ") + QString::number(_DB->allHabitant()->count())));
  QMainWindow::setStatusBar(statusBar);
}
Example #3
0
void MainWindow::init_statusBar()
{
    QStatusBar* bar = ui->statusBar;
    first_statusLabel = new QLabel;
    first_statusLabel->setMinimumSize(150,20);
    first_statusLabel->setFrameShape(QFrame::WinPanel);
    first_statusLabel->setFrameShadow(QFrame::Sunken);
    second_statusLabel = new QLabel;
    second_statusLabel->setMinimumSize(150,20);
    second_statusLabel->setFrameShape(QFrame::WinPanel);
    second_statusLabel->setFrameShadow(QFrame::Sunken);
    bar->addWidget(first_statusLabel);
    bar->addWidget(second_statusLabel);
    first_statusLabel->setText(tr("欢迎使用文本编辑器"));
    second_statusLabel->setText(tr("Lootepad 0.5.8"));
}
Example #4
0
void MainWindow::CreateStatusbar()
{
    shebei = new QLabel;
    shebei->setText(tr("设备ID:"));
    sbid = new QLabel;
    sbid->setText(m_strDevID);
    kjl = new QLabel;
    kjl->setText(tr("      快精灵"));
    time = new QLabel;
    QDateTime im = QDateTime::currentDateTime();
    QString str = im.toString("yyyy-MM-dd hh:mm:ss");
    time->setText(str);
    QTimer* timTm = new QTimer;
    connect(timTm,SIGNAL(timeout()),this,SLOT(TimeNow()));
    timTm->start(1000);
    jiaoshi = new ClickedLabel;
    jiaoshi->setText(tr("<u>校时</u>"));
    jiaoshi->setEnabled(false);
    m_jiaozhun = new ClickedLabel;
    m_jiaozhun->setText(tr("<u>屏幕校准</u>"));
    connect(m_jiaozhun, SIGNAL(clicked()), this, SLOT(OnJiaoZhun()));
    help = new ClickedLabel;
    help->setText(tr("<u>帮助</u>"));
    connect(help, SIGNAL(clicked()), this, SLOT(OnHelp()));

    QStatusBar* statusBar = this->statusBar();
    statusBar->addWidget(shebei,1);
    statusBar->addWidget(sbid,2);
    statusBar->addWidget(kjl,3);
    statusBar->addWidget(time,4);
    statusBar->addWidget(jiaoshi,5);
    statusBar->addWidget(m_jiaozhun,6);
    statusBar->addWidget(help,7);
}
Example #5
0
void MainWindow::init_statusBar()
{
    QStatusBar* bar = ui->statusBar;

    statusLabel1 = new QLabel(this);
    statusLabel1->setMinimumSize(150,20);
    statusLabel1->setFrameShape(QFrame::WinPanel);
    statusLabel1->setFrameShadow(QFrame::Sunken);
    bar->addWidget(statusLabel1);

    statusLabel2 = new QLabel(this);
    statusLabel2->setMinimumSize(150,20);
    statusLabel2->setFrameShape(QFrame::WinPanel);
    statusLabel2->setFrameShadow(QFrame::Sunken);
    bar->addWidget(statusLabel2);

    statusLabel1->setText(tr("Welcome to SPICE"));
    statusLabel2->setText(tr("By Hu Hanbin"));
}
Example #6
0
void MainWindow::addStatus(QWidget *w, bool)
{
    QStatusBar *status = statusBar();
    w->reparent(status, QPoint());
    statusWidgets.push_back(w);
    status->addWidget(w, true);
    w->show();
    status->show();
    setGrip();
}
Example #7
0
void MainWindow::addStatus(QWidget *w, bool)
{
    QStatusBar *status = statusBar();
    w->setParent(status);
    w->move(QPoint());
    statusWidgets.push_back(w);
    status->addWidget(w, true);
    w->show();
    status->setSizeGripEnabled(true);
    status->show();
}
Example #8
0
void MainWindow::init_statusBar()
{
	QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
	//使能显示中文

	QStatusBar* bar = ui->statusBar;//获取状态栏
	first_statusLabel = new QLabel;
	first_statusLabel->setMinimumSize(150,20);
	first_statusLabel->setFrameShape(QFrame::WinPanel);
	first_statusLabel->setFrameShadow(QFrame::Sunken);
	second_statusLabel = new QLabel;
	second_statusLabel->setMinimumSize(150,20);
	second_statusLabel->setFrameShape(QFrame::WinPanel);
	second_statusLabel->setFrameShadow(QFrame::Sunken);

	bar->addWidget(first_statusLabel);
	bar->addWidget(second_statusLabel);
	first_statusLabel->setText(tr("欢迎使用图书管理系统"));
	second_statusLabel->setText(tr("Copyright Reserved! The 7th!"));
}
Example #9
0
void CMainWindow::iniStatusBar()
{
	QStatusBar* bar = statusBar();
	label1 = new QLabel;
	label1->setMinimumSize(200, 25);
	label1->setFrameShadow(QFrame::Sunken);
	label1->setFrameShape(QFrame::WinPanel);
	label2 = new QLabel;	
	label2->setMinimumSize(200, 25);
	label2->setFrameShadow(QFrame::Sunken);
	label2->setFrameShape(QFrame::WinPanel);
	bar->addWidget(label1);
	bar->addWidget(label2);
}
Example #10
0
int StatusBar::addWidget(lua_State * L) // ( QWidget * widget, int stretch = 0 )
{
	QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1);
	QWidget* widget = ObjectHelper<QWidget>::check( L, 2);
	int stretch = 0;
	if (Util::isNum( L, 3 ) )
	{
		if ( Util::toInt( L, 3 ) < 0 )
		{
			Util::error( L, "Starting No can not be negative" );
		}
		else
		{
			stretch = Util::toInt( L, 3 );
		}
	}
	obj->addWidget( widget, stretch ) ;
	return 0;
}
MainWindow::MainWindow()
{
    settings.defaults();

    m_hsi = NULL;
    m_sectval = NULL;
    m_mainval = NULL;
    m_specval = NULL;
    m_waveval = NULL;

    m_maincan = new CurveCanvas2D(&m_points);
    m_mainstatus = new QLabel;
    m_mainstatus->setText("Ready");

    m_scroll = new QScrollArea;
    m_scroll->setBackgroundRole(QPalette::Dark);
    m_scroll->setWidget(m_maincan);
    setCentralWidget(m_scroll);

    QStatusBar *statusArea = new QStatusBar;
    statusArea->addWidget(m_mainstatus);
    setStatusBar(statusArea);

    m_sectwin = new SectionWindow(this);
    m_sectwin->setWindowTitle("Section Viewer");
    m_sectwin->hide();

    m_specwin = new SpectrumWindow(this);
    m_specwin->setWindowTitle("Spectrum Viewer");
    m_specwin->hide();

    createMainOptions();
    createSectOptions();
    createElements();

    setWindowTitle(tr("Image Viewer"));
    resize(settings.mainWidth, settings.mainHeight);
}
Example #12
0
MainWindow::MainWindow( IfcPlusPlusSystem* sys, ViewerWidget* vw, QWidget *parent) : m_system(sys), m_viewer_widget(vw), QMainWindow(parent)
{
	m_system = sys;
	setWindowTitle("IFC++ example application");
	setWindowIcon( QIcon( ":img/IfcPlusPlusViewerWindowIcon.png" ) );
	
	// global style sheet definitions
	QFile file( ":styles.css" );
	file.open( QFile::ReadOnly );
	QString styleSheet = QLatin1String( file.readAll() );
	setStyleSheet( styleSheet );
	createTabWidget();

	QAction* zoom_bounds_btn = new QAction(QIcon(":img/zoomBoundings.png"), "&Zoom to boundings", this );
	zoom_bounds_btn->setShortcut(tr("Ctrl+Z"));
	zoom_bounds_btn->setStatusTip("Zoom to boundings");
	connect(zoom_bounds_btn, SIGNAL(triggered()), this, SLOT(slotBtnZoomBoundingsClicked()));

	QAction* remove_selected_objects = new QAction(QIcon(":img/RemoveSelectedObjects.png"), "&Remove selected objects [del]", this );
	remove_selected_objects->setStatusTip("Remove selected objects [del]");
	connect(remove_selected_objects, SIGNAL(triggered()), this, SLOT(slotBtnRemoveSelectedObjectsClicked()));

	m_file_toolbar = new QToolBar();
	m_file_toolbar->setObjectName("FileToolbar");
	m_file_toolbar->addAction(zoom_bounds_btn);
	m_file_toolbar->addAction(remove_selected_objects);
	addToolBar( Qt::LeftToolBarArea, m_file_toolbar );

	// building structure widget
	QDockWidget *dock = new QDockWidget(tr("Project structure"), this);
	dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	addDockWidget(Qt::RightDockWidgetArea, dock);
	
	IfcTreeWidget* ifc_tree_widget = new IfcTreeWidget( m_system );
	dock->setWidget( ifc_tree_widget );

	m_splitter = new QSplitter( Qt::Vertical );
	m_splitter->setContentsMargins( 0, 0, 0, 0 );
	m_splitter->addWidget( m_viewer_widget );
	m_splitter->addWidget( m_tabwidget );
	m_splitter->setStretchFactor( 0, 2 );
	m_splitter->setStretchFactor( 1, 0 );

	QList<int> splitter_sizes;
	splitter_sizes << 400 << 100;
	m_splitter->setSizes( splitter_sizes );

	// status bar
	QStatusBar* status = new QStatusBar();
	m_label_status_cursor = new QLabel( "0.000, 0.000, 0.000" );
	status->addWidget( m_label_status_cursor, 0 );
	status->setSizeGripEnabled( true );
	setStatusBar( status );

	// central widget
	setCentralWidget( m_splitter );

	// restore geometry
	QSettings settings(QSettings::UserScope, QLatin1String("IfcPlusPlus"));
	QStringList keys = settings.allKeys();
	if( keys.contains( "MainWindowGeometry" ) )
	{
		restoreGeometry(settings.value("MainWindowGeometry").toByteArray());
	}
	else
	{
		showMaximized();
	}
	if( keys.contains( "mainWindowState" ) )
	{
		restoreState(settings.value("mainWindowState").toByteArray());
	}
}
Example #13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    curPage(0),
    curQuestion(0),
    zoomFactor(1.0)
{
  /* Set up the Qt user interface */
  ui->setupUi(this);
  Global::setMainWindow(this);

  /* Set up a status bar in the main window */
  QStatusBar *sb = statusBar();
  QLabel *statusLabel = new QLabel ("");
  sb->addWidget(statusLabel);
  Global::setStatusLabel(statusLabel);

  /* Set up the GradeWindow and also fill the table with initial values from the database */
  Global::setGradeWindow(new GradeWindow);

  /* Set up page change buttons */
  connect(ui->pageLeft ,   SIGNAL(clicked()), this, SLOT(handlePagePrev()));
  connect(ui->pageRight,   SIGNAL(clicked()), this, SLOT(handlePageNext()));
  connect(ui->studentPrev, SIGNAL(clicked()), this, SLOT(handleStudentPrev()));
  connect(ui->studentNext, SIGNAL(clicked()), this, SLOT(handleStudentNext()));
  connect(ui->questionPrev, SIGNAL(clicked()), this, SLOT(handleQuestionPrev()));
  connect(ui->questionNext, SIGNAL(clicked()), this, SLOT(handleQuestionNext()));
  connect(ui->zoomIn,     SIGNAL(clicked()), this, SLOT(handleZoomIn()));
  connect(ui->zoomOut,    SIGNAL(clicked()), this, SLOT(handleZoomOut()));
  connect(ui->zoomWidth,  SIGNAL(clicked()), this, SLOT(handleZoomWidth()));
  connect(ui->zoomHeight, SIGNAL(clicked()), this, SLOT(handleZoomHeight()));
  connect(ui->zoomOne,    SIGNAL(clicked()), this, SLOT(handleZoomOne()));

  /* Set up various actions */
  connect(ui->actionSave,    SIGNAL(triggered()), this, SLOT(handleSave()));
  connect(ui->actionGenPDFs, SIGNAL(triggered()), this, SLOT(handleGeneratePDFs()));
  connect(Global::gw()->getUI()->actionSave, SIGNAL(triggered()), this, SLOT(handleSave()));
  connect(ui->actionPagePrev, SIGNAL(triggered()), this, SLOT(handlePagePrev()));
  connect(ui->actionPageNext, SIGNAL(triggered()), this, SLOT(handlePageNext()));
  connect(ui->actionStudentPrev, SIGNAL(triggered()), this, SLOT(handleStudentPrev()));
  connect(ui->actionStudentNext, SIGNAL(triggered()), this, SLOT(handleStudentNext()));

  connect(ui->actionGradeWindow, SIGNAL(triggered()), Global::gw(), SLOT(handleGradeWindow()));
  connect(Global::gw()->getUI()->actionGradeWindow, SIGNAL(triggered()), Global::gw(), SLOT(handleGradeWindow()));
  connect(ui->actionResizeContents, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeContents()));
  connect(ui->actionResizeLarge, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeLarge()));
  connect(ui->actionResizeSmall, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeSmall()));

  /* Detect user input in data entry fields */
  connect(ui->studentId,        SIGNAL(textEdited(const QString&)), this, SLOT(handleEditStudentId(const QString&)));
  connect(ui->studentName,      SIGNAL(textEdited(const QString&)), this, SLOT(handleEditStudentName(const QString&)));
  connect(ui->questionScore,    SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionScore(const QString&)));
  connect(ui->questionFeedback, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionFeedback(const QString&)));
  connect(ui->questionMaximum,  SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionMaximum(const QString&)));
  connect(ui->questionPage,     SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionPage(const QString&)));
  connect(ui->action0_Points,   SIGNAL(triggered()), this, SLOT(handleScore0()));
  connect(ui->action1_Point,    SIGNAL(triggered()), this, SLOT(handleScore1()));
  connect(ui->action2_Points,   SIGNAL(triggered()), this, SLOT(handleScore2()));
  connect(ui->action3_Points,   SIGNAL(triggered()), this, SLOT(handleScore3()));
  connect(ui->action4_Points,   SIGNAL(triggered()), this, SLOT(handleScore4()));
  connect(ui->action5_Points,   SIGNAL(triggered()), this, SLOT(handleScore5()));
  connect(ui->action6_Points,   SIGNAL(triggered()), this, SLOT(handleScore6()));
  connect(ui->action7_Points,   SIGNAL(triggered()), this, SLOT(handleScore7()));
  connect(ui->action8_Points,   SIGNAL(triggered()), this, SLOT(handleScore8()));
  connect(ui->actionEmpty_Points, SIGNAL(triggered()), this, SLOT(handleScoreEmpty()));

  /* Now set the first page and first question */
  adjustPage(0);
  adjustQuestion(0);
}
Example #14
0
Fenetre::Fenetre(QWidget *parent) : courant(0), QMainWindow(parent)
{
    //*************************
    courant = NULL;
    folder = NULL;
    resize(1200, 512);
    //*************************** Menu ***************************
    QMenu* mFile = menuBar()->addMenu("&File");
    QMenu* mEdit = menuBar()->addMenu("&Edit");
    QMenu* mView = menuBar()->addMenu("&View");


    QMenu* mNouveau = mFile->addMenu("New");
    QAction* mactionAnnuler = mEdit->addAction("Annuler");
    QAction* mactionRefaire = mEdit->addAction("Refaire");
    QAction* mactionSupprimer = mEdit->addAction("Supprimer");
    QMenu* mTag = mEdit->addMenu("Tags");
    QAction* mactionSupprimerTag = mTag->addAction("Supprimer");
    QMenu* mDocument = mEdit->addMenu("Documents");
    QAction* mactionUp = mDocument->addAction("Monter");
    QAction* mactionDown = mDocument->addAction("Descendre");
    QMenu* mExport = mEdit->addMenu("Exporter");
    QAction* mactionOuvrir = mFile->addAction("Ouvrir un espace de travail");
    QAction* mactionNew = mFile->addAction("Nouvel espace de travail");
    QAction* mactionSaveAs = mFile->addAction("Enregistrer sous...");
    QAction* mactionNewArticle = mNouveau->addAction("Article");
    QAction* mactionNewImage = mNouveau->addAction("Image");
    QAction* mactionNewAudio = mNouveau->addAction("Audio");
    QAction* mactionNewVideo = mNouveau->addAction("Video");
    QAction* mactionNewDocument = mNouveau->addAction("Document");

    QAction* mactionExportHTML = mExport->addAction("Html");
    QAction* mactionExportTex = mExport->addAction("Tex");
    QAction* mactionExportTexte = mExport->addAction("Texte");
    QAction* mactionOption=mEdit->addAction("Setting");

    QAction* mactionAddTag = mNouveau->addAction("Tag");

    QAction* mactionSave = mFile->addAction("Sauvegarder");
    mFile->addSeparator();
    QMenu* ouvrirCorbeille = mFile->addMenu("Corbeille");
    QAction* mactionRestaurer = ouvrirCorbeille->addAction("Restaurer");
    QAction* mactionVider = ouvrirCorbeille->addAction("Vider la Corbeille");

    mactionViewEdit = mView->addAction("Onglet Editeur");
    mactionViewHTML = mView->addAction("Onglet Html");
    mactionViewTex = mView->addAction("Onglet Tex");
    mactionViewTexte = mView->addAction("Onglet Texte");

    mFile->addSeparator();
    QAction* actionQuitter = mFile->addAction("&Quitter");
    actionQuitter->setIcon(QIcon("icon/quitter.png"));
    mactionNewArticle->setIcon(QIcon("icon/article.png"));
    mactionNewImage->setIcon(QIcon("icon/image.png"));
    mactionNewAudio->setIcon(QIcon("icon/audio.png"));
    mactionNewVideo->setIcon(QIcon("icon/video.png"));
    mNouveau->setIcon(QIcon("icon/plus.png"));
    mactionDown->setIcon(QIcon("icon/down.png"));
    mactionUp->setIcon(QIcon("icon/up.png"));
    mactionAddTag->setIcon(QIcon("icon/tag.png"));
    mactionSave->setIcon(QIcon("icon/save.png"));

    mactionExportHTML->setIcon(QIcon("icon/html.png"));
    mactionExportTex->setIcon(QIcon("icon/tex.png"));
    mactionExportTexte->setIcon(QIcon("icon/texte.png"));

    mactionAnnuler->setIcon(QIcon("icon/undo.png"));
    mactionRefaire->setIcon(QIcon("icon/redo.png"));
    mactionSupprimer->setIcon(QIcon("icon/cross.png"));
    mactionRestaurer->setIcon(QIcon("icon/corbeille.png"));
    mactionNewDocument->setIcon(QIcon("icon/document.png"));
    mactionOption->setIcon(QIcon("icon/setting.png"));


    mactionOuvrir->setShortcut(QKeySequence("Ctrl+O"));
    actionQuitter->setShortcut(QKeySequence("Ctrl+Q"));
    mactionSave->setShortcut(QKeySequence("Ctrl+S"));

    mactionAnnuler->setShortcut(QKeySequence("Ctrl+Z"));
    mactionRefaire->setShortcut(QKeySequence("Ctrl+Y"));
    mactionSupprimer->setShortcut(tr("Delete"));

    //** VIEW **//
    mactionViewEdit->setCheckable(true);
    mactionViewEdit->setChecked(true);
    mactionViewHTML->setCheckable(true);
    mactionViewTex->setCheckable(true);
    mactionViewTexte->setCheckable(true);


    //Bar de statue
    QStatusBar* statusBar = new QStatusBar;
    statusBar->addWidget(new QLabel("Projet Lo21 - Pauline Crouillère / Emilien Notarianni"));
    this->setStatusBar(statusBar);
    // Création de la barre d'outils
    QToolBar *toolBarFichier = addToolBar("Fichier");

    toolBarFichier->addAction(mactionNewArticle);
    toolBarFichier->addAction(mactionNewImage);
    toolBarFichier->addAction(mactionNewAudio);
    toolBarFichier->addAction(mactionNewVideo);
    toolBarFichier->addAction(mactionNewDocument);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionAddTag);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionUp);
    toolBarFichier->addAction(mactionDown);
    toolBarFichier->addSeparator();

    toolBarFichier->addAction(mactionExportHTML);
    toolBarFichier->addAction(mactionExportTex);
    toolBarFichier->addAction(mactionExportTexte);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionRestaurer);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionSupprimer);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(actionQuitter);

    /*************************************************************/
    couche = new QHBoxLayout();
    lw = new LeftWindows();
    ow = new OngletWindows();
    couche->addWidget(lw);
    couche->addWidget(ow);
    couche->setMargin(0);
    couche->setAlignment(Qt::AlignTop);
    centerWindows = new QWidget();
    centerWindows->setLayout(couche);
    setCentralWidget(centerWindows);

    //************************** CONNECT **************************/
    QObject::connect(mactionNewArticle, SIGNAL(triggered()), this, SLOT(newArticle()));
    QObject::connect(mactionNewDocument, SIGNAL(triggered()), this, SLOT(newDocument()));
    QObject::connect(mactionNewImage, SIGNAL(triggered()), this, SLOT(newImage()));
    QObject::connect(mactionNewAudio, SIGNAL(triggered()), this, SLOT(newAudio()));
    QObject::connect(mactionNewVideo, SIGNAL(triggered()), this, SLOT(newVideo()));
    QObject::connect(mactionAddTag, SIGNAL(triggered()), this, SLOT(newTag()));
    QObject::connect(mactionOuvrir,SIGNAL(triggered()),this, SLOT(ouvrirDialogue()));
    QObject::connect(actionQuitter,SIGNAL(triggered()),qApp, SLOT(quit()));

    QObject::connect(mactionUp,SIGNAL(triggered()),this, SLOT(docUp()));
    QObject::connect(mactionDown,SIGNAL(triggered()),this, SLOT(docDown()));

    QObject::connect(mactionRestaurer, SIGNAL(triggered()), this, SLOT(ouvrirCorbeille()));

    QObject::connect(mactionSave, SIGNAL(triggered()), this, SLOT(asave()));

    QObject::connect(mactionExportHTML, SIGNAL(triggered()), this, SLOT(exportHTML()));
    QObject::connect(mactionExportTex, SIGNAL(triggered()), this, SLOT(exportTex()));
    QObject::connect(mactionExportTexte, SIGNAL(triggered()), this, SLOT(exportTexte()));

    QObject::connect(mactionSupprimer, SIGNAL(triggered()), this, SLOT(deleteInCorbeille()));
    QObject::connect(mactionVider, SIGNAL(triggered()), this, SLOT(viderLaCorbeille()));
    //TODO
    QObject::connect(mactionAnnuler, SIGNAL(triggered()), qApp, SLOT(undo()));
    QObject::connect(mactionRefaire, SIGNAL(triggered()), qApp, SLOT(redo()));
    //
    QObject::connect(mactionSaveAs, SIGNAL(triggered()), this, SLOT(copieWorkSpace()));
    QObject::connect(mactionNew, SIGNAL(triggered()), this, SLOT(newWorkSpace()));
    QObject::connect(mactionOption, SIGNAL(triggered()), this, SLOT(setting()));



    QObject::connect(mactionViewEdit, SIGNAL(triggered()), this, SLOT(changeEdit()));
    QObject::connect(mactionViewHTML, SIGNAL(triggered()), this, SLOT(changeHtml()));
    QObject::connect(mactionViewTex,SIGNAL(triggered()),this, SLOT(changeTex()));
    QObject::connect(mactionViewTexte,SIGNAL(triggered()),this, SLOT(changeTexte()));
    QObject::connect(ow, SIGNAL(currentChanged(int)), this, SLOT(changeOnglet(int)));
    QObject::connect(mactionSupprimerTag, SIGNAL(triggered()), this, SLOT(supprimeTag()));

}
Example #15
0
TazDlg::TazDlg(QWidget* pParent)
	: QMainWindow(pParent), m_settings("tobis_stuff", "takin"),
		m_pSettingsDlg(new SettingsDlg(this, &m_settings)),
		m_pStatusMsg(new QLabel(this)),
		m_pCoordQStatusMsg(new QLabel(this)),
		m_pCoordCursorStatusMsg(new QLabel(this)),
		m_sceneRecip(this),
		m_dlgRecipParam(this, &m_settings),
		m_dlgRealParam(this, &m_settings),
		m_pGotoDlg(new GotoDlg(this, &m_settings))
{
	//log_debug("In ", __func__, ".");

	const bool bSmallqVisible = 0;
	const bool bBZVisible = 1;
	const bool bWSVisible = 1;

	this->setupUi(this);
	this->setWindowTitle(s_strTitle.c_str());
	this->setFont(g_fontGen);
	this->setWindowIcon(load_icon("res/icons/takin.svg"));

	btnAtoms->setEnabled(g_bHasScatlens);

	if(m_settings.contains("main/geo"))
	{
		QByteArray geo = m_settings.value("main/geo").toByteArray();
		restoreGeometry(geo);
	}
	/*if(m_settings.contains("main/width") && m_settings.contains("main/height"))
	{
		int iW = m_settings.value("main/width").toInt();
		int iH = m_settings.value("main/height").toInt();
		resize(iW, iH);
	}*/

	m_pStatusMsg->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	m_pCoordQStatusMsg->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	m_pCoordCursorStatusMsg->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	for(QLabel* pLabel : {m_pStatusMsg/*, m_pCoordQStatusMsg, m_pCoordCursorStatusMsg*/})
		pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);

	QStatusBar *pStatusBar = new QStatusBar(this);
	pStatusBar->addWidget(m_pStatusMsg, 1);
	pStatusBar->addPermanentWidget(m_pCoordQStatusMsg, 0);
	pStatusBar->addPermanentWidget(m_pCoordCursorStatusMsg, 0);
	m_pCoordQStatusMsg->setMinimumWidth(350);
	m_pCoordQStatusMsg->setAlignment(Qt::AlignCenter);
	m_pCoordCursorStatusMsg->setMinimumWidth(325);
	m_pCoordCursorStatusMsg->setAlignment(Qt::AlignCenter);
	this->setStatusBar(pStatusBar);

	// --------------------------------------------------------------------------------

	m_vecEdits_real =
	{
		editA, editB, editC,
		editAlpha, editBeta, editGamma
	};
	m_vecEdits_recip =
	{
		editARecip, editBRecip, editCRecip,
		editAlphaRecip, editBetaRecip, editGammaRecip
	};

	m_vecEdits_plane =
	{
		editScatX0, editScatX1, editScatX2,
		editScatY0, editScatY1, editScatY2,

		editRealX0, editRealX1, editRealX2,
		editRealY0, editRealY1, editRealY2,
	};
	m_vecEdits_monoana =
	{
		editMonoD, editAnaD
	};

	//m_vecSpinBoxesSample = { spinRotPhi, spinRotTheta, spinRotPsi };
	m_vecCheckBoxesSenses = { checkSenseM, checkSenseS, checkSenseA };


	m_vecEditNames_real =
	{
		"sample/a", "sample/b", "sample/c",
		"sample/alpha", "sample/beta", "sample/gamma"
	};
	m_vecEditNames_recip =
	{
		"sample/a_recip", "sample/b_recip", "sample/c_recip",
		"sample/alpha_recip", "sample/beta_recip", "sample/gamma_recip"
	};
	m_vecEditNames_plane =
	{
		"plane/x0", "plane/x1", "plane/x2",
		"plane/y0", "plane/y1", "plane/y2",

		"plane/real_x0", "plane/real_x1", "plane/real_x2",
		"plane/real_y0", "plane/real_y1", "plane/real_y2",
	};
	m_vecEditNames_monoana =
	{
		"tas/mono_d", "tas/ana_d"
	};

	m_vecSpinBoxNamesSample = {"sample/phi", "sample/theta", "sample/psi"};
	m_vecCheckBoxNamesSenses = {"tas/sense_m", "tas/sense_s", "tas/sense_a"};


	// recip
	m_pviewRecip = new ScatteringTriangleView(groupRecip);
	groupRecip->addTab(m_pviewRecip, "Reciprocal Lattice");

	m_pviewProjRecip = new ProjLatticeView(groupRecip);
	groupRecip->addTab(m_pviewProjRecip, "Projection");

	m_pviewRecip->setScene(&m_sceneRecip);
	m_pviewProjRecip->setScene(&m_sceneProjRecip);

	if(m_settings.contains("main/recip_tab"))
		groupRecip->setCurrentIndex(m_settings.value("main/recip_tab").value<int>());


	// real
	m_pviewRealLattice = new LatticeView(groupReal);
	groupReal->addTab(m_pviewRealLattice, "Real Lattice");

	m_pviewReal = new TasLayoutView(groupReal);
	groupReal->addTab(m_pviewReal, "TAS Instrument");

	m_pviewTof = new TofLayoutView(groupReal);
	groupReal->addTab(m_pviewTof, "TOF Instrument");

	m_pviewRealLattice->setScene(&m_sceneRealLattice);
	m_pviewReal->setScene(&m_sceneReal);
	m_pviewTof->setScene(&m_sceneTof);

	if(m_settings.contains("main/real_tab"))
		groupReal->setCurrentIndex(m_settings.value("main/real_tab").value<int>());



	QObject::connect(m_pSettingsDlg, SIGNAL(SettingsChanged()), this, SLOT(SettingsChanged()));

	QObject::connect(&m_sceneReal, SIGNAL(nodeEvent(bool)), this, SLOT(RealNodeEvent(bool)));
	QObject::connect(&m_sceneRecip, SIGNAL(nodeEvent(bool)), this, SLOT(RecipNodeEvent(bool)));
	QObject::connect(&m_sceneTof, SIGNAL(nodeEvent(bool)), this, SLOT(TofNodeEvent(bool)));

	// TAS
	QObject::connect(&m_sceneRecip, SIGNAL(triangleChanged(const TriangleOptions&)),
		&m_sceneReal, SLOT(triangleChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneReal, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneRecip, SLOT(tasChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		&m_sceneReal, SLOT(recipParamsChanged(const RecipParams&)));

	// TOF
	QObject::connect(&m_sceneRecip, SIGNAL(triangleChanged(const TriangleOptions&)),
		&m_sceneTof, SLOT(triangleChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneTof, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneRecip, SLOT(tasChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		&m_sceneTof, SLOT(recipParamsChanged(const RecipParams&)));

	// connections between instruments
	QObject::connect(&m_sceneTof, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneReal, SLOT(triangleChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneReal, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneTof, SLOT(triangleChanged(const TriangleOptions&)));

	// scale factor
	if(m_pviewRecip)
		QObject::connect(m_pviewRecip, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneRecip, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewProjRecip)
		QObject::connect(m_pviewProjRecip, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneProjRecip, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewRealLattice)
		QObject::connect(m_pviewRealLattice, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneRealLattice, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewReal)
		QObject::connect(m_pviewReal, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneReal, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewTof)
		QObject::connect(m_pviewTof, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneTof, SLOT(scaleChanged(t_real_glob)));

	// parameter dialogs
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		&m_dlgRecipParam, SLOT(paramsChanged(const RecipParams&)));
	QObject::connect(&m_sceneReal, SIGNAL(paramsChanged(const RealParams&)),
		&m_dlgRealParam, SLOT(paramsChanged(const RealParams&)));

	// cursor position
	QObject::connect(&m_sceneRecip, SIGNAL(coordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)),
		this, SLOT(RecipCoordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)));
	QObject::connect(&m_sceneProjRecip, SIGNAL(coordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)),
		this, SLOT(RecipCoordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)));
	QObject::connect(&m_sceneRealLattice, SIGNAL(coordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)),
		this, SLOT(RealCoordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)));

	QObject::connect(&m_sceneRecip, SIGNAL(spurionInfo(const tl::ElasticSpurion&, const std::vector<tl::InelasticSpurion<t_real_glob>>&, const std::vector<tl::InelasticSpurion<t_real_glob>>&)),
		this, SLOT(spurionInfo(const tl::ElasticSpurion&, const std::vector<tl::InelasticSpurion<t_real_glob>>&, const std::vector<tl::InelasticSpurion<t_real_glob>>&)));

	QObject::connect(m_pGotoDlg, SIGNAL(vars_changed(const CrystalOptions&, const TriangleOptions&)),
		this, SLOT(VarsChanged(const CrystalOptions&, const TriangleOptions&)));
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		m_pGotoDlg, SLOT(RecipParamsChanged(const RecipParams&)));

	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		this, SLOT(recipParamsChanged(const RecipParams&)));


	for(QLineEdit* pEdit : m_vecEdits_monoana)
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(UpdateDs()));

	for(QLineEdit* pEdit : m_vecEdits_real)
	{
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CheckCrystalType()));
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CalcPeaks()));
	}

	for(QLineEdit* pEdit : m_vecEdits_plane)
	{
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CalcPeaks()));
	}

	//for(QDoubleSpinBox* pSpin : m_vecSpinBoxesSample)
	//	QObject::connect(pSpin, SIGNAL(valueChanged(t_real)), this, SLOT(CalcPeaks()));

	for(QLineEdit* pEdit : m_vecEdits_recip)
	{
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CheckCrystalType()));
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CalcPeaksRecip()));
	}

	QObject::connect(checkSenseM, SIGNAL(stateChanged(int)), this, SLOT(UpdateMonoSense()));
	QObject::connect(checkSenseS, SIGNAL(stateChanged(int)), this, SLOT(UpdateSampleSense()));
	QObject::connect(checkSenseA, SIGNAL(stateChanged(int)), this, SLOT(UpdateAnaSense()));

	QObject::connect(editSpaceGroupsFilter, SIGNAL(textEdited(const QString&)), this, SLOT(RepopulateSpaceGroups()));
	QObject::connect(comboSpaceGroups, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCrystalType()));
	QObject::connect(comboSpaceGroups, SIGNAL(currentIndexChanged(int)), this, SLOT(CalcPeaks()));
	QObject::connect(checkPowder, SIGNAL(stateChanged(int)), this, SLOT(CalcPeaks()));

	QObject::connect(btnAtoms, SIGNAL(clicked(bool)), this, SLOT(ShowAtomsDlg()));



	// --------------------------------------------------------------------------------
	// file menu
	QMenu *pMenuFile = new QMenu("File", this);

	QAction *pNew = new QAction("New", this);
	pNew->setIcon(load_icon("res/icons/document-new.svg"));
	pMenuFile->addAction(pNew);

	pMenuFile->addSeparator();

	QAction *pLoad = new QAction("Load...", this);
	pLoad->setIcon(load_icon("res/icons/document-open.svg"));
	pMenuFile->addAction(pLoad);

	m_pMenuRecent = new QMenu("Recently Loaded", this);
	tl::RecentFiles recent(&m_settings, "main/recent");
	m_pMapperRecent = new QSignalMapper(m_pMenuRecent);
	QObject::connect(m_pMapperRecent, SIGNAL(mapped(const QString&)),
		this, SLOT(LoadFile(const QString&)));
	recent.FillMenu(m_pMenuRecent, m_pMapperRecent);
	pMenuFile->addMenu(m_pMenuRecent);

	QAction *pSave = new QAction("Save", this);
	pSave->setIcon(load_icon("res/icons/document-save.svg"));
	pMenuFile->addAction(pSave);

	QAction *pSaveAs = new QAction("Save as...", this);
	pSaveAs->setIcon(load_icon("res/icons/document-save-as.svg"));
	pMenuFile->addAction(pSaveAs);

	pMenuFile->addSeparator();

	QAction *pImport = new QAction("Import...", this);
	pImport->setIcon(load_icon("res/icons/drive-harddisk.svg"));
	pMenuFile->addAction(pImport);

	m_pMenuRecentImport = new QMenu("Recently Imported", this);
	tl::RecentFiles recentimport(&m_settings, "main/recent_import");
	m_pMapperRecentImport = new QSignalMapper(m_pMenuRecentImport);
	QObject::connect(m_pMapperRecentImport, SIGNAL(mapped(const QString&)),
		this, SLOT(ImportFile(const QString&)));
	recentimport.FillMenu(m_pMenuRecentImport, m_pMapperRecentImport);
	pMenuFile->addMenu(m_pMenuRecentImport);

	pMenuFile->addSeparator();

	QAction *pSettings = new QAction("Settings...", this);
	pSettings->setIcon(load_icon("res/icons/preferences-system.svg"));
	pMenuFile->addAction(pSettings);

	pMenuFile->addSeparator();

	QAction *pExit = new QAction("Exit", this);
	pExit->setIcon(load_icon("res/icons/system-log-out.svg"));
	pMenuFile->addAction(pExit);


	// --------------------------------------------------------------------------------
	// recip menu
	m_pMenuViewRecip = new QMenu("Reciprocal Space", this);

	m_pGoto = new QAction("Go to Position...", this);
	m_pGoto->setIcon(load_icon("res/icons/goto.svg"));
	m_pMenuViewRecip->addAction(m_pGoto);

	QAction *pRecipParams = new QAction("Information...", this);
	m_pMenuViewRecip->addAction(pRecipParams);
	m_pMenuViewRecip->addSeparator();

	m_pSmallq = new QAction("Show Reduced Scattering Vector q", this);
	m_pSmallq->setIcon(load_icon("res/icons/q.svg"));
	m_pSmallq->setCheckable(1);
	m_pSmallq->setChecked(bSmallqVisible);
	m_pMenuViewRecip->addAction(m_pSmallq);

	m_pSnapSmallq = new QAction("Snap G to Bragg Peak", this);
	m_pSnapSmallq->setCheckable(1);
	m_pSnapSmallq->setChecked(m_sceneRecip.getSnapq());
	m_pMenuViewRecip->addAction(m_pSnapSmallq);

	QAction *pKeepAbsKiKf = new QAction("Keep |ki| and |kf| Fixed", this);
	pKeepAbsKiKf->setCheckable(1);
	pKeepAbsKiKf->setChecked(m_sceneRecip.getKeepAbsKiKf());
	m_pMenuViewRecip->addAction(pKeepAbsKiKf);

	m_pBZ = new QAction("Show First Brillouin Zone", this);
	m_pBZ->setIcon(load_icon("res/icons/brillouin.svg"));
	m_pBZ->setCheckable(1);
	m_pBZ->setChecked(bBZVisible);
	m_pMenuViewRecip->addAction(m_pBZ);


	QMenu *pMenuEwald = new QMenu("Ewald Sphere", this);
	QActionGroup *pGroupEwald = new QActionGroup(this);
	m_pEwaldSphereNone = new QAction("Disabled", this);
	m_pEwaldSphereKi = new QAction("Around ki", this);
	m_pEwaldSphereKf = new QAction("Around kf", this);
	for(QAction* pAct : {m_pEwaldSphereNone, m_pEwaldSphereKi, m_pEwaldSphereKf})
	{
		pAct->setCheckable(1);
		pGroupEwald->addAction(pAct);
	}

	m_pEwaldSphereKf->setChecked(1);
	pMenuEwald->addActions(pGroupEwald->actions());
	m_pMenuViewRecip->addMenu(pMenuEwald);


	m_pMenuViewRecip->addSeparator();

	QMenu *pMenuProj = new QMenu("Projection", this);
	pMenuProj->setTearOffEnabled(1);
	QActionGroup *pGroupProj = new QActionGroup(this);

	m_pProjGnom = new QAction("Gnomonic", this);
	m_pProjStereo = new QAction("Stereographic", this);
	m_pProjPara = new QAction("Parallel", this);
	m_pProjPersp = new QAction("Perspectivic", this);

	for(QAction *pAct : {m_pProjGnom, m_pProjStereo, m_pProjPara, m_pProjPersp})
	{
		pAct->setCheckable(1);
		pGroupProj->addAction(pAct);
	}

	m_pProjStereo->setChecked(1);
	pMenuProj->addActions(pGroupProj->actions());

	m_pMenuViewRecip->addMenu(pMenuProj);

#if !defined NO_3D
	QAction *pView3D = new QAction("3D View...", this);
	//pView3D->setIcon(QIcon::fromTheme("applications-graphics"));
	m_pMenuViewRecip->addAction(pView3D);
#endif

	m_pMenuViewRecip->addSeparator();

	QAction *pRecipExport = new QAction("Export Lattice Graphics...", this);
	pRecipExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewRecip->addAction(pRecipExport);

	QAction *pProjExport = new QAction("Export Projection Graphics...", this);
	pProjExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewRecip->addAction(pProjExport);

#ifdef USE_GIL
	QAction *pBZExport = new QAction("Export Brillouin Zone Image...", this);
	pBZExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewRecip->addAction(pBZExport);
#endif


	// --------------------------------------------------------------------------------
	// real menu
	m_pMenuViewReal = new QMenu("Real Space", this);
	m_pMenuViewReal->addAction(m_pGoto);

	QAction *pRealParams = new QAction("Information...", this);
	m_pMenuViewReal->addAction(pRealParams);

	m_pMenuViewReal->addSeparator();

	m_pShowRealQDir = new QAction("Show Q Direction", this);
	m_pShowRealQDir->setCheckable(1);
	m_pShowRealQDir->setChecked(m_sceneReal.GetTasLayout()->GetRealQVisible());
	m_pMenuViewReal->addAction(m_pShowRealQDir);

	m_pWS = new QAction("Show Wigner-Seitz Cell", this);
	m_pWS->setIcon(load_icon("res/icons/brillouin.svg"));
	m_pWS->setCheckable(1);
	m_pWS->setChecked(bWSVisible);
	m_pMenuViewReal->addAction(m_pWS);

	m_pMenuViewReal->addSeparator();

#if !defined NO_3D
	QAction *pView3DReal = new QAction("3D View...", this);
	//pView3DReal->setIcon(QIcon::fromTheme("applications-graphics"));
	m_pMenuViewReal->addAction(pView3DReal);
	m_pMenuViewReal->addSeparator();
#endif

	QAction *pRealLatticeExport = new QAction("Export Lattice Graphics...", this);
	pRealLatticeExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pRealLatticeExport);

	QAction *pRealExport = new QAction("Export TAS Layout...", this);
	pRealExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pRealExport);

	QAction *pTofExport = new QAction("Export TOF Layout...", this);
	pTofExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pTofExport);

#ifdef USE_GIL
	QAction *pWSExport = new QAction("Export Wigner-Seitz Cell Image...", this);
	pWSExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pWSExport);
#endif

	QAction *pExportUC = new QAction("Export Unit Cell Model...", this);
	pExportUC->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pExportUC);


	// --------------------------------------------------------------------------------
	// resolution menu
	QMenu *pMenuReso = new QMenu("Resolution", this);

	QAction *pResoParams = new QAction("Parameters...", this);
	pResoParams->setIcon(load_icon("res/icons/accessories-calculator.svg"));
	pMenuReso->addAction(pResoParams);

	pMenuReso->addSeparator();

	QAction *pResoEllipses = new QAction("Ellipses...", this);
	pResoEllipses->setIcon(load_icon("res/icons/ellipses.svg"));
	pMenuReso->addAction(pResoEllipses);

#if !defined NO_3D
	QAction *pResoEllipses3D = new QAction("3D Ellipsoids...", this);
	pMenuReso->addAction(pResoEllipses3D);
#endif

	pMenuReso->addSeparator();

	QAction *pResoConv = new QAction("Convolution...", this);
	pMenuReso->addAction(pResoConv);


	// --------------------------------------------------------------------------------
	// calc menu
	QMenu *pMenuCalc = new QMenu("Calculation", this);

	QAction *pNeutronProps = new QAction("Neutron Properties...", this);
	pNeutronProps->setIcon(load_icon("res/icons/x-office-spreadsheet-template.svg"));
	pMenuCalc->addAction(pNeutronProps);

	pMenuCalc->addSeparator();

	QAction *pPowder = new QAction("Powder Lines...", this);
	pPowder->setIcon(load_icon("res/icons/weather-snow.svg"));
	pMenuCalc->addAction(pPowder);

	QAction *pDW = new QAction("Scattering Factors...", this);
	pMenuCalc->addAction(pDW);

	QAction *pFormfactor = nullptr;
	if(g_bHasFormfacts && g_bHasScatlens)
	{
		pFormfactor = new QAction("Form Factors...", this);
		pMenuCalc->addAction(pFormfactor);
	}

	QAction *pSgList = new QAction("Space Group Types...", this);
	pMenuCalc->addAction(pSgList);

	QAction *pDisp = new QAction("Dispersions...", this);
	//pDisp->setIcon(load_icon("disp.svg"));
	pMenuCalc->addAction(pDisp);

	pMenuCalc->addSeparator();

	QAction *pDynPlane = new QAction("Kinematic Plane...", this);
	pMenuCalc->addAction(pDynPlane);

	QAction *pSpuri = new QAction("Spurious Scattering...", this);
	pMenuCalc->addAction(pSpuri);


#if !defined NO_NET
	// --------------------------------------------------------------------------------
	// network menu
	QMenu *pMenuNet = new QMenu("Network", this);

	QAction *pConn = new QAction("Connect to Instrument...", this);
	pConn->setIcon(load_icon("res/icons/network-transmit-receive.svg"));
	pMenuNet->addAction(pConn);

	QAction *pDisconn = new QAction("Disconnect", this);
	pDisconn->setIcon(load_icon("res/icons/network-offline.svg"));
	pMenuNet->addAction(pDisconn);

	pMenuNet->addSeparator();

	QAction *pNetScanMon = new QAction("Scan Monitor...", this);
	pMenuNet->addAction(pNetScanMon);

	QAction *pNetCache = new QAction("Network Cache...", this);
	pMenuNet->addAction(pNetCache);

	QAction *pNetRefresh = new QAction("Refresh", this);
	pNetRefresh->setIcon(load_icon("res/icons/view-refresh.svg"));
	pMenuNet->addSeparator();
	pMenuNet->addAction(pNetRefresh);
#endif


	// --------------------------------------------------------------------------------
	// tools menu
	QMenu *pMenuTools = new QMenu("Tools", this);

	QAction *pScanViewer = new QAction("Scan Viewer...", this);
	pMenuTools->addAction(pScanViewer);



	// --------------------------------------------------------------------------------
	// help menu
	QMenu *pMenuHelp = new QMenu("Help", this);

	QAction *pHelp = new QAction("Show Help...", this);
	pHelp->setIcon(load_icon("res/icons/help-browser.svg"));
	pMenuHelp->addAction(pHelp);

	QAction *pDevelDoc = new QAction("Show Developer Help...", this);
	if(find_resource("doc/devel/html/index.html", 0) == "")
		pDevelDoc->setEnabled(0);
	pDevelDoc->setIcon(load_icon("res/icons/help-browser.svg"));
	pMenuHelp->addAction(pDevelDoc);

	pMenuHelp->addSeparator();

	QAction *pAboutQt = new QAction("About Qt...", this);
	//pAboutQt->setIcon(QIcon::fromTheme("help-about"));
	pMenuHelp->addAction(pAboutQt);

	//pMenuHelp->addSeparator();
	QAction *pAbout = new QAction("About Takin...", this);
	pAbout->setIcon(load_icon("res/icons/dialog-information.svg"));
	pMenuHelp->addAction(pAbout);



	// --------------------------------------------------------------------------------
	QMenuBar *pMenuBar = new QMenuBar(this);
	pMenuBar->addMenu(pMenuFile);
	pMenuBar->addMenu(m_pMenuViewRecip);
	pMenuBar->addMenu(m_pMenuViewReal);
	pMenuBar->addMenu(pMenuReso);
	pMenuBar->addMenu(pMenuCalc);
	pMenuBar->addMenu(pMenuTools);
#if !defined NO_NET
	pMenuBar->addMenu(pMenuNet);
#endif
	pMenuBar->addMenu(pMenuHelp);


	QObject::connect(pNew, SIGNAL(triggered()), this, SLOT(New()));
	QObject::connect(pLoad, SIGNAL(triggered()), this, SLOT(Load()));
	QObject::connect(pSave, SIGNAL(triggered()), this, SLOT(Save()));
	QObject::connect(pSaveAs, SIGNAL(triggered()), this, SLOT(SaveAs()));
	QObject::connect(pImport, SIGNAL(triggered()), this, SLOT(Import()));
	QObject::connect(pScanViewer, SIGNAL(triggered()), this, SLOT(ShowScanViewer()));
	QObject::connect(pSettings, SIGNAL(triggered()), this, SLOT(ShowSettingsDlg()));
	QObject::connect(pExit, SIGNAL(triggered()), this, SLOT(close()));

	QObject::connect(m_pSmallq, SIGNAL(toggled(bool)), this, SLOT(EnableSmallq(bool)));
	QObject::connect(m_pBZ, SIGNAL(toggled(bool)), this, SLOT(EnableBZ(bool)));
	QObject::connect(m_pWS, SIGNAL(toggled(bool)), this, SLOT(EnableWS(bool)));

	for(QAction* pAct : {m_pEwaldSphereNone, m_pEwaldSphereKi, m_pEwaldSphereKf})
		QObject::connect(pAct, SIGNAL(triggered()), this, SLOT(ShowEwaldSphere()));

	QObject::connect(m_pShowRealQDir, SIGNAL(toggled(bool)), this, SLOT(EnableRealQDir(bool)));

	QObject::connect(m_pSnapSmallq, SIGNAL(toggled(bool)), &m_sceneRecip, SLOT(setSnapq(bool)));
	QObject::connect(pKeepAbsKiKf, SIGNAL(toggled(bool)), &m_sceneRecip, SLOT(setKeepAbsKiKf(bool)));

	QObject::connect(pRecipParams, SIGNAL(triggered()), this, SLOT(ShowRecipParams()));
	QObject::connect(pRealParams, SIGNAL(triggered()), this, SLOT(ShowRealParams()));

	for(QAction *pProj : {m_pProjGnom, m_pProjStereo, m_pProjPara, m_pProjPersp})
		QObject::connect(pProj, SIGNAL(triggered()), this, SLOT(RecipProjChanged()));

#if !defined NO_3D
	QObject::connect(pView3D, SIGNAL(triggered()), this, SLOT(Show3D()));
	QObject::connect(pView3DReal, SIGNAL(triggered()), this, SLOT(Show3DReal()));
	QObject::connect(pResoEllipses3D, SIGNAL(triggered()), this, SLOT(ShowResoEllipses3D()));
#endif

	QObject::connect(pRecipExport, SIGNAL(triggered()), this, SLOT(ExportRecip()));
	QObject::connect(pProjExport, SIGNAL(triggered()), this, SLOT(ExportProj()));
	QObject::connect(pRealExport, SIGNAL(triggered()), this, SLOT(ExportReal()));
	QObject::connect(pTofExport, SIGNAL(triggered()), this, SLOT(ExportTof()));
	QObject::connect(pRealLatticeExport, SIGNAL(triggered()), this, SLOT(ExportRealLattice()));

	QObject::connect(pExportUC, SIGNAL(triggered()), this, SLOT(ExportUCModel()));

#ifdef USE_GIL
	QObject::connect(pBZExport, SIGNAL(triggered()), this, SLOT(ExportBZImage()));
	QObject::connect(pWSExport, SIGNAL(triggered()), this, SLOT(ExportWSImage()));
#endif

	QObject::connect(pResoParams, SIGNAL(triggered()), this, SLOT(ShowResoParams()));
	QObject::connect(pResoEllipses, SIGNAL(triggered()), this, SLOT(ShowResoEllipses()));
	QObject::connect(pResoConv, SIGNAL(triggered()), this, SLOT(ShowResoConv()));

	QObject::connect(pNeutronProps, SIGNAL(triggered()), this, SLOT(ShowNeutronDlg()));
	QObject::connect(m_pGoto, SIGNAL(triggered()), this, SLOT(ShowGotoDlg()));
	QObject::connect(pPowder, SIGNAL(triggered()), this, SLOT(ShowPowderDlg()));
	QObject::connect(pDisp, SIGNAL(triggered()), this, SLOT(ShowDispDlg()));
	QObject::connect(pSpuri, SIGNAL(triggered()), this, SLOT(ShowSpurions()));
	QObject::connect(pDW, SIGNAL(triggered()), this, SLOT(ShowDWDlg()));
	QObject::connect(pDynPlane, SIGNAL(triggered()), this, SLOT(ShowDynPlaneDlg()));

#if !defined NO_NET
	QObject::connect(pConn, SIGNAL(triggered()), this, SLOT(ShowConnectDlg()));
	QObject::connect(pDisconn, SIGNAL(triggered()), this, SLOT(Disconnect()));
	QObject::connect(pNetRefresh, SIGNAL(triggered()), this, SLOT(NetRefresh()));
	QObject::connect(pNetCache, SIGNAL(triggered()), this, SLOT(ShowNetCache()));
	QObject::connect(pNetScanMon, SIGNAL(triggered()), this, SLOT(ShowNetScanMonitor()));
#endif

	QObject::connect(pSgList, SIGNAL(triggered()), this, SLOT(ShowSgListDlg()));

	if(pFormfactor)
		QObject::connect(pFormfactor, SIGNAL(triggered()), this, SLOT(ShowFormfactorDlg()));

	QObject::connect(pHelp, SIGNAL(triggered()), this, SLOT(ShowHelp()));
	QObject::connect(pDevelDoc, SIGNAL(triggered()), this, SLOT(ShowDevelDoc()));
	QObject::connect(pAbout, SIGNAL(triggered()), this, SLOT(ShowAbout()));
	QObject::connect(pAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));


	setMenuBar(pMenuBar);
	// --------------------------------------------------------------------------------


	// --------------------------------------------------------------------------------
	// context menus
	if(m_pviewRecip) m_pviewRecip->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewProjRecip) m_pviewProjRecip->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewRealLattice) m_pviewRealLattice->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewReal) m_pviewReal->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewTof) m_pviewTof->setContextMenuPolicy(Qt::CustomContextMenu);

	if(m_pviewRecip)
		QObject::connect(m_pviewRecip, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RecipContextMenu(const QPoint&)));
	if(m_pviewProjRecip)
		QObject::connect(m_pviewProjRecip, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RecipContextMenu(const QPoint&)));
	if(m_pviewRealLattice)
		QObject::connect(m_pviewRealLattice, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RealContextMenu(const QPoint&)));
	if(m_pviewReal)
		QObject::connect(m_pviewReal, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RealContextMenu(const QPoint&)));
	if(m_pviewTof)
		QObject::connect(m_pviewTof, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RealContextMenu(const QPoint&)));


	// --------------------------------------------------------------------------------
	// tool bars
	QToolBar *pFileTools = new QToolBar(this);
	pFileTools->setWindowTitle("File");
	pFileTools->addAction(pNew);
	pFileTools->addAction(pLoad);
	pFileTools->addAction(pImport);
	pFileTools->addAction(pSave);
	pFileTools->addAction(pSaveAs);
	addToolBar(pFileTools);

	QToolBar *pRecipTools = new QToolBar(this);
	pRecipTools->setWindowTitle("Reciprocal Space");
	pRecipTools->addAction(m_pGoto);
	pRecipTools->addAction(m_pSmallq);
	pRecipTools->addAction(m_pBZ);
	//pRecipTools->addAction(m_pEwaldSphere);
	addToolBar(pRecipTools);

	QToolBar *pResoTools = new QToolBar(this);
	pResoTools->setWindowTitle("Resolution");
	pResoTools->addAction(pResoParams);
	pResoTools->addAction(pResoEllipses);
	addToolBar(pResoTools);

	QToolBar *pCalcTools = new QToolBar(this);
	pCalcTools->setWindowTitle("Calculation");
	pCalcTools->addAction(pNeutronProps);
	pCalcTools->addAction(pPowder);
	addToolBar(pCalcTools);

#if !defined NO_NET
	QToolBar *pNetTools = new QToolBar(this);
	pNetTools->setWindowTitle("Network");
	pNetTools->addAction(pConn);
	pNetTools->addAction(pDisconn);
	pNetTools->addAction(pNetRefresh);
	addToolBar(pNetTools);
#endif

	// --------------------------------------------------------------------------------


	RepopulateSpaceGroups();

	unsigned int iMaxPeaks = m_settings.value("main/max_peaks", 10).toUInt();

	m_sceneRecip.GetTriangle()->SetMaxPeaks(iMaxPeaks);
	m_sceneRecip.GetTriangle()->SetPlaneDistTolerance(s_dPlaneDistTolerance);

	m_sceneProjRecip.GetLattice()->SetMaxPeaks(iMaxPeaks/2);

	m_sceneRealLattice.GetLattice()->SetMaxPeaks(iMaxPeaks);
	m_sceneRealLattice.GetLattice()->SetPlaneDistTolerance(s_dPlaneDistTolerance);

#if !defined NO_3D
	if(m_pRecip3d)
	{
		m_pRecip3d->SetMaxPeaks((t_real)iMaxPeaks);
		m_pRecip3d->SetPlaneDistTolerance(s_dPlaneDistTolerance);
	}
#endif

	m_bReady = 1;
	UpdateDs();
	CalcPeaks();


	m_sceneRecip.GetTriangle()->SetqVisible(bSmallqVisible);
	m_sceneRecip.GetTriangle()->SetBZVisible(bBZVisible);
	m_sceneRecip.GetTriangle()->SetEwaldSphereVisible(EWALD_KF);
	m_sceneRealLattice.GetLattice()->SetWSVisible(bWSVisible);
	m_sceneRecip.emitUpdate();
	//m_sceneRecip.emitAllParams();

	setAcceptDrops(1);
}
void QmitkCorrespondingPointSetsWidget::SetupUi()
{
  QBoxLayout* lay1 = new QVBoxLayout(this);

  // add status bar buttons
  if (QTPropShowButtonBar)
  {
    QBoxLayout* lay2 = new QHBoxLayout();
    lay1->addLayout(lay2);
    lay2->stretch(true);

    QStatusBar* statusBar = new QStatusBar(this);
    statusBar->setMaximumHeight(25);

    m_CreatePointSetBtn = new QToolButton();
    m_CreatePointSetBtn->setAutoRaise(true);
    m_CreatePointSetBtn->setIcon(QIcon(":/QtWidgetsExt/btnAddPointSet.png"));
    m_CreatePointSetBtn->setToolTip(QString("Create new point set"));
    connect(this->m_CreatePointSetBtn, SIGNAL(clicked()), this, SLOT(AddPointSet()));
    statusBar->addWidget(m_CreatePointSetBtn);

    m_AddPointsBtn = new QToolButton();
    m_AddPointsBtn->setAutoRaise(true);
    m_AddPointsBtn->setIcon(QIcon(":/QtWidgetsExt/btnSetPoints.png"));
    m_AddPointsBtn->setToolTip(QString("Check to add new points (shift-click)"));
    m_AddPointsBtn->setCheckable(true);
    connect(this->m_AddPointsBtn, SIGNAL(clicked(bool)), this, SLOT(AddPointsMode(bool)));
    statusBar->addWidget(m_AddPointsBtn);

    m_MovePointUpBtn = new QToolButton();
    m_MovePointUpBtn->setAutoRaise(true);
    m_MovePointUpBtn->setIcon(QIcon(":/QtWidgetsExt/btnMoveUp.png"));
    m_MovePointUpBtn->setToolTip(QString("Move selected point up"));
    connect(this->m_MovePointUpBtn, SIGNAL(clicked()), this, SLOT(MoveSelectedPointUp()));
    statusBar->addWidget(m_MovePointUpBtn);

    m_MovePointDownBtn = new QToolButton();
    m_MovePointDownBtn->setAutoRaise(true);
    m_MovePointDownBtn->setIcon(QIcon(":/QtWidgetsExt/btnMoveDown.png"));
    m_MovePointDownBtn->setToolTip(QString("Move selected point down"));
    connect(this->m_MovePointDownBtn, SIGNAL(clicked()), this, SLOT(MoveSelectedPointDown()));
    statusBar->addWidget(m_MovePointDownBtn);

    m_RemovePointBtn = new QToolButton();
    m_RemovePointBtn->setAutoRaise(true);
    m_RemovePointBtn->setIcon(QIcon(":/QtWidgetsExt/btnRemovePoint.png"));
    m_RemovePointBtn->setToolTip(QString("Remove selected point"));
    connect(this->m_RemovePointBtn, SIGNAL(clicked()), this, SLOT(RemoveSelectedPoint()));
    statusBar->addWidget(m_RemovePointBtn);

    m_SwapSetsBtn = new QToolButton();
    m_SwapSetsBtn->setAutoRaise(true);
    m_SwapSetsBtn->setIcon(QIcon(":/QtWidgetsExt/btnSwapSets.png"));
    m_SwapSetsBtn->setToolTip(QString("Swap the two selected point sets"));
    m_SwapSetsBtn->setCheckable(true);
    connect(this->m_SwapSetsBtn, SIGNAL(clicked(bool)), this, SLOT(SwapPointSets(bool)));
    statusBar->addWidget(m_SwapSetsBtn);

    // disable buttons
    m_MovePointUpBtn->setEnabled(false);
    m_MovePointDownBtn->setEnabled(false);
    m_RemovePointBtn->setEnabled(false);
    m_SwapSetsBtn->setEnabled(false);
    m_AddPointsBtn->setEnabled(false);

    lay2->addWidget(statusBar);
  }

  lay1->insertWidget(0,m_CorrespondingPointSetsView);
  this->setLayout(lay1);
}
Example #17
0
MainWindow::MainWindow(QWidget *parent) : QWidget(parent){
    setWindowTitle("Babylon");

    //create button
    open=new QPushButton("Open");
    save1=new QPushButton("Save to TIFF");
    save2=new QPushButton("Save to JPG");
    quit=new QPushButton("Quit");
    zoomIn=new QPushButton("ZoomIn");
    zoomOut=new QPushButton("ZoomOut");
    webView=new QPushButton("GoogleMaps");
    reset=new QPushButton("Reset");
    submit=new QPushButton("Submit");
    
    //create checkBox
    movable=new QCheckBox("movable");
    movable->setChecked(true); //default
    
    //create layout
    QVBoxLayout *layout1=new QVBoxLayout;
    QGridLayout *layout=new QGridLayout;
    
    //create label & textline
    scaleLabel=new QLabel("scale");
    xlabel=new QLabel("longitude(°)");
    ylabel=new QLabel("latitude(°)");
    valueLabel=new QLabel("Value");
    minlabel=new QLabel("min");
    maxlabel=new QLabel("Max");
    scaleLine=new QLineEdit;
    xline=new QLineEdit;
    yline=new QLineEdit;
    valueLine=new QLineEdit;
    minline=new QLineEdit;
    maxline=new QLineEdit;
    
    
    //layout button
    layout1->addWidget(open);
    layout1->addWidget(quit);
    layout1->addWidget(save1);
    layout1->addWidget(save2);
    layout1->addWidget(zoomIn);
    layout1->addWidget(zoomOut);
    layout1->addWidget(webView);
    layout1->addWidget(reset);
    layout1->addWidget(movable);

    save1->setEnabled(false);
    save2->setEnabled(false);
    
    //layout textline
    layout1->addWidget(scaleLabel);
    layout1->addWidget(scaleLine);
    layout1->addWidget(ylabel);
    layout1->addWidget(yline);
    layout1->addWidget(xlabel);
    layout1->addWidget(xline);
    layout1->addWidget(valueLabel);
    layout1->addWidget(valueLine);
    
    layout1->addWidget(minlabel);
    layout1->addWidget(minline);
    layout1->addWidget(maxlabel);
    layout1->addWidget(maxline);
    layout1->addWidget(submit);
    
    layout1->addStretch();
    
    //connect button & checkBox
    connect(open,SIGNAL(clicked()),this,SLOT(open_clicked()));
    connect(quit,SIGNAL(clicked()),this,SLOT(quit_clicked()));
    connect(save1,SIGNAL(clicked()),this,SLOT(save1_clicked()));
    connect(save2,SIGNAL(clicked()),this,SLOT(save2_clicked()));
    connect(zoomIn,SIGNAL(clicked()),this,SLOT(zoomIn_clicked()));
    connect(zoomOut,SIGNAL(clicked()),this,SLOT(zoomOut_clicked()));
    connect(webView,SIGNAL(clicked()),this,SLOT(webView_clicked()));
    connect(reset,SIGNAL(clicked()),this,SLOT(reset_clicked()));
    connect(movable,SIGNAL(stateChanged(int)),this,SLOT(move_checked(int)));
    connect(submit,SIGNAL(clicked()),this,SLOT(submit_clicked()));
    
    //create Pixmap & Painter
    pixmap=new QPixmap(QSize(YOKO,TATE));
    pixmap2=new QPixmap(QSize(720,20));
    painter=new QPainter(pixmap);
    painter2=new QPainter(pixmap2);

    //create_ColorBar
     first_color_bar();


    item=new Item(); //BinaryPicture
    item->setPixmap(*pixmap);
    item->setScale(scale);
    item->setFlag(QGraphicsItem::ItemIsMovable,true);

    item2=new QGraphicsPixmapItem(*pixmap2); //ColorBar
    item2->setScale(1.3);

    scene=new QGraphicsScene(QRect(0, 0, 1440, 720)); //BinaryPicture
    scene->addItem(item);

    scene2=new QGraphicsScene(QRect(0, 0, 720, 20));  //ColorBar
    scene2->addItem(item2);

    view=new QGraphicsView(scene);
    view->setBackgroundBrush(QBrush(Qt::gray));
    view2=new QGraphicsView(scene2);
    view2->setBackgroundBrush(QBrush(Qt::black));

    layout->addLayout(layout1,0,1); //Button etc.
    layout->addWidget(view,0,0); //BinaryPicture
    layout->addWidget(view2,1,0); //ColorBar

    //statusBar(FileName)
    lb=new QLabel();
    QStatusBar *statusBar = new QStatusBar();
    statusBar->addWidget(lb);

    //setLayout
    layout->addWidget(statusBar,2,0);
    setLayout(layout);
}
Example #18
0
/** Preprocess the whole sound file,
   by looping through and processing every chunk in the file.
   A progress bar is displayed in the toolbar, because this can
   be time consuming.
*/
void SoundFile::preProcess()
{
    //jumpToChunk(0);
    gdata->setDoingActiveAnalysis(true);
    myassert(firstTimeThrough == true);
    readChunk(bufferSize() - offset());
    //readChunk(framesPerChunk());
    //processNewChunk();
    //printf("preProcessing\n");
    //for(int j=0; j<numChannels(); j++)
    //  channels(j)->setframesPerChunk(toRead);

    // Create a progress bar in the status bar to tell the user we're preprocessing
    MainWindow *theMainWindow = (MainWindow*) qApp->mainWidget();
    QStatusBar *theStatusBar = theMainWindow->statusBar();
    QLabel *message = new QLabel("Preprocessing data:", theStatusBar, "message");
    //QLabel *message = new QLabel("Preprocessing data:", theMainWindow, "message");

    //QProgressBar *progress = new QProgressBar(stream->totalFrames() / framesPerChunk(), theMainWindow, "progress bar");
    Q3ProgressBar *progress = new Q3ProgressBar(stream->totalFrames() / framesPerChunk(), theStatusBar, "progress bar");
    progress->setProgress(0);
    progress->setMaximumHeight(16);


    theStatusBar->addWidget(message);
    theStatusBar->addWidget(progress);

    message->show();
    progress->show();

    int frameCount = 1;
    int updateInterval = MAX(1, progress->totalSteps() / 50); // We'll update 50 times only

    //while(read_n(toRead, stream) == toRead) { // put data in channels
    while(readChunk(framesPerChunk()) == framesPerChunk()) { // put data in channels
        //printf("pos = %d\n", stream->pos);
        //processNewChunk();
        //incrementChunkNum();
        frameCount++;

        if (frameCount % updateInterval == 0) {
            progress->setProgress(progress->progress() + updateInterval);
            qApp->processEvents();
            frameCount = 1;
        }
    }
    //printf("totalChunks=%d\n", totalChunks());
    //printf("currentChunks=%d\n", currentChunk());
    filteredStream->close();
    filteredStream->open_read(filteredFilename);
    jumpToChunk(0);


    progress->setProgress(progress->totalSteps());
    theStatusBar->removeWidget(progress);
    theStatusBar->removeWidget(message);
    delete progress;
    delete message;

    gdata->setDoingActiveAnalysis(false);
    firstTimeThrough = false;
    //printf("freqLookup.size()=%d\n", channels(0)->freqLookup.size());
}
Example #19
0
LuaAVConsole :: LuaAVConsole()
:	mScriptsLoaded(0),
	mScrolling(true),
	mLogging(false),
	mScriptModel(0),
	mSplitter(0),
	mScriptSplitter(0),
	mTableView(0),
	mCodeEdit(0),
	mTextEdit(0),
	mOpenButton(0),
	mNewButton(0),
	mStatusLabel(0),
	mClearButton(0),
	mScrollButton(0),
	mSelectedScript(-1),
	mStdoutLog(0),
	mStderrLog(0)
{
	// main window properties
	setWindowTitle(QString("LuaAV"));
	setGeometry(300, 600, 650, 375);

	setWindowIcon(QIcon(QPixmap(LUAAV_ICON_PATH)));

	// data model
	mScriptModel = new ScriptModel(this);


	// split scripts and text
	mSplitter = new QSplitter(this);
	mSplitter->setFrameShadow(QFrame::Plain);
	mSplitter->setLineWidth(0);

	setCentralWidget(mSplitter);


	// script splitter
	mScriptSplitter = new QSplitter(this);
	mScriptSplitter->setOrientation(Qt::Vertical);

		// script view
		mTableView = new QTableView(this);
		mTableView->setModel(mScriptModel);
		mTableView->setSortingEnabled(false);
		mTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
		mTableView->horizontalHeader()->hide();
		mTableView->verticalHeader()->hide();
		mTableView->setSelectionMode(QAbstractItemView::SingleSelection);
		mTableView->setWordWrap(true);
		mTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
		QPalette pp(mTableView->palette());
		pp.setColor(QPalette::Highlight, QColor(130, 130, 130));
		mTableView->setPalette(pp);
		QFont font(mTableView->font());
		font.setPointSize(8);
		mTableView->setFont(font);
		mScriptSplitter->addWidget(mTableView);

		// code input
		mCodeEdit = new QLineEdit(this);
		QPalette codePalette(mCodeEdit->palette());
		codePalette.setColor(QPalette::Base, QColor(200, 200, 200));
		mCodeEdit->setPalette(codePalette);
	//	mCodeEdit->setFrameShadow(QFrame::Plain);
	//	mCodeEdit->setFrameStyle(QFrame::NoFrame);
	//	mCodeEdit->setLineWidth(0);
		mCodeEdit->insert(QString("print('hello world')"));
		mCodeEdit->setMinimumHeight(MIN_CODE_HEIGHT);
	//	mCodeEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
		mScriptSplitter->addWidget(mCodeEdit);

	mSplitter->addWidget(mScriptSplitter);


	// text window
	mTextEdit = new QTextEdit(this);
	QPalette palette(mTextEdit->palette());
	palette.setColor(QPalette::Base, QColor(140, 140, 140));
	mTextEdit->setPalette(palette);
	mTextEdit->setFrameShadow(QFrame::Plain);
	mTextEdit->setFrameStyle(QFrame::NoFrame);
	mTextEdit->setReadOnly(true);
	mTextEdit->setLineWidth(0);
	mTextEdit->setTabStopWidth(45);
	mSplitter->addWidget(mTextEdit);

	// status buttons and label
	mOpenButton = new QPushButton(this);
	mOpenButton->setText(QString("Open"));

	mNewButton = new QPushButton(this);
	mNewButton->setText(QString("New"));

	mStatusLabel = new QLabel(this);
	mStatusLabel->setAlignment(Qt::AlignCenter);

	mClearButton = new QPushButton(this);
	mClearButton->setText(QString("Clear"));

	QAction *clearAction = new QAction(this);
	clearAction->setShortcut(QKeySequence(tr("Ctrl+x")));
	addAction(clearAction);
	connect(clearAction, SIGNAL(triggered()), mClearButton, SLOT(click()));

	mScrollButton = new QPushButton(this);
	mScrollButton->setText(QString("Scroll"));
	mScrollButton->setCheckable(true);


	QStatusBar *status = statusBar();
	status->addWidget(mOpenButton);
	status->addWidget(mNewButton);
	status->addWidget(mStatusLabel, 20);
	status->addWidget(mClearButton);
	status->addWidget(mScrollButton);

	// signal/slot connections
	connect(mTextEdit->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(scroll()));
	connect(mSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(resizeTable(int,int)));
	connect(mTableView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(tableViewClicked(const QModelIndex&)));

	connect(mOpenButton, SIGNAL(clicked()), this, SLOT(openFile()));
	connect(mNewButton, SIGNAL(clicked()), this, SLOT(newFile()));
	connect(mClearButton, SIGNAL(clicked()), mTextEdit, SLOT(clear()));
	connect(mScrollButton, SIGNAL(clicked(bool)), this, SLOT(setScrolling(bool)));
	connect(this, SIGNAL(clearConsole()), mTextEdit, SLOT(clear()));
	connect(mCodeEdit, SIGNAL(returnPressed()), this, SLOT(evalCode()));
}
Example #20
0
QAPEWindow::QAPEWindow()
{
  resize(QSize(800, 500).expandedTo(minimumSizeHint()));
  
  actFileNew=new QAction(QIcon(":/images/filenew.png"), tr("&New"), this);
  actFileNew->setStatusTip(tr("Create new file"));
  actFileOpen=new QAction(QIcon(":/images/fileopen.png"), tr("&Open..."), this);
  actFileOpen->setShortcut(tr("Ctrl+O"));
  actFileOpen->setStatusTip(tr("Open an existing file"));
  actFileSave=new QAction(QIcon(":/images/filesave.png"), tr("&Save"), this);
  actFileSave->setShortcut(tr("Ctrl+S"));
  actFileSave->setStatusTip(tr("Save file"));
  actFileSaveAs=new QAction(QIcon(":/images/filesaveas.png"), tr("Save &as..."), this);
  actFileSaveAs->setStatusTip(tr("Save file with another name"));
  actFileGenerate=new QAction(QIcon(":/images/filegenerate.png"), tr("&Generate ~/.asoundrc directly"), this);
  actFileGenerate->setStatusTip(tr("Generate config file for ALSA from current file  to ~/.asoundrc directly"));
  actFileGeneratePart=new QAction(QIcon(":/images/filegeneratepart.png"), tr("&Generate config..."), this);
  actFileGeneratePart->setStatusTip(tr("Generate config file for ALSA from current file"));
  actFileExit=new QAction(QIcon(":/images/fileexit.png"), tr("E&xit"), this);
  actFileExit->setStatusTip(tr("Close program"));
  
  actEditHW=new QAction(QIcon(":/images/hw.png"), tr("&HW output"), this);
  actEditHW->setStatusTip(tr("Add HW output block"));
  actEditInp=new QAction(QIcon(":/images/inp.png"), tr("DSP &input"), this);
  actEditInp->setStatusTip(tr("Add DSP input block"));
  actEditNull=new QAction(QIcon(":/images/null.png"), tr("Dummy &null output"), this);
  actEditNull->setStatusTip(tr("Add dummy null output block"));
  actEditFile=new QAction(QIcon(":/images/file.png"), tr("Write to &file"), this);
  actEditFile->setStatusTip(tr("Add block, that writes stream to file"));
  
  actEditRoute=new QAction(QIcon(":/images/route.png"), tr("&Route plugin"), this);
  actEditRoute->setStatusTip(tr("Add route block for routing and duplicating channels"));
  actEditRate=new QAction(QIcon(":/images/rate.png"), tr("R&ate plugin"), this);
  actEditRate->setStatusTip(tr("Add samplerate conversion block"));
  actEditDmix=new QAction(QIcon(":/images/dmix.png"), tr("D&mix pugin"), this);
  actEditDmix->setStatusTip(tr("Add dmix mixing and samplerate conversion block"));
  actEditLADSPA=new QAction(QIcon(":/images/ladspa.png"), tr("&LADSPA plugin thunk"), this);
  actEditLADSPA->setStatusTip(tr("Add some LADSPA effect block"));
  actEditMeter=new QAction(QIcon(":/images/meter.png"), tr("Me&ter plugin"), this);
  actEditMeter->setStatusTip(tr("Add volume meter plugin"));
  
  actEditLinear=new QAction(QIcon(":/images/linear.png"), tr("Li&near<->linear"), this);
  actEditLinear->setStatusTip(tr("Add linear<->linear format conversion block"));
  actEditFloat=new QAction(QIcon(":/images/float.png"), tr("Fl&oat<->linear"), this);
  actEditFloat->setStatusTip(tr("Add float<->linear format conversion block"));
  actEditIEC958=new QAction(QIcon(":/images/iec.png"), tr("IE&C-958<->linear"), this);
  actEditIEC958->setStatusTip(tr("Add IEC-958<->linear frames format conversion block"));
  actEditMuLaw=new QAction(QIcon(":/images/mulaw.png"), tr("M&u-Law<->linear"), this);
  actEditMuLaw->setStatusTip(tr("Add mu-Law<->linear format conversion block"));
  actEditALaw=new QAction(QIcon(":/images/alaw.png"), tr("A-La&w<->linear"), this);
  actEditALaw->setStatusTip(tr("Add A-Law<->linear format conversion block"));
  actEditImaADPCM=new QAction(QIcon(":/images/ima.png"), tr("IMA ADP&CM<->linear"), this);
  actEditImaADPCM->setStatusTip(tr("Add IMA ADPCM<->linear format conversion block"));
  
  actToolAllocate=new QAction(tr("&Scroll-in lost components"), this);
  actToolAllocate->setStatusTip(tr("Move lost components (accidentally moved beyond workspace) in your sight"));
  
  actHelpAbout=new QAction(tr("&About..."), this);
  actHelpAbout->setStatusTip(tr("About ALSA Plugin editor"));
  
  QToolBar *tbMain = new QToolBar(this);
  addToolBar(Qt::TopToolBarArea, tbMain);
  
  QToolBar *tbTools = new QToolBar(this);
  addToolBar(Qt::LeftToolBarArea, tbTools);

  QMenu *mFile,*mEdit,*mTools,*mHelp;
  
  mFile=menuBar()->addMenu(tr("&File"));
  mFile->addAction(actFileNew);
  mFile->addAction(actFileOpen);
  mFile->addAction(actFileSave);
  mFile->addAction(actFileSaveAs);
  mFile->addSeparator();
  mFile->addAction(actFileExit);
  
  mEdit=menuBar()->addMenu(tr("&Edit"));
  mEdit->addAction(actEditHW);
  mEdit->addAction(actEditInp);
  mEdit->addAction(actEditNull);
  mEdit->addAction(actEditFile);
  mEdit->addSeparator()->setText(tr("Routing, mixing, effects"));
  mEdit->addAction(actEditRoute);
  mEdit->addAction(actEditRate);
  mEdit->addAction(actEditDmix);
  mEdit->addAction(actEditLADSPA);
  mEdit->addAction(actEditMeter);
  mEdit->addSeparator()->setText(tr("Format conversion"));
  mEdit->addAction(actEditLinear);
  mEdit->addAction(actEditFloat);
  mEdit->addAction(actEditIEC958);
  mEdit->addAction(actEditMuLaw);
  mEdit->addAction(actEditALaw);
  mEdit->addAction(actEditImaADPCM);
  
  mTools=menuBar()->addMenu(tr("&Tools"));
  mTools->addAction(actFileGenerate);
  mTools->addAction(actFileGeneratePart);
  mTools->addSeparator();
  mTools->addAction(actToolAllocate);
  
  mHelp=menuBar()->addMenu(tr("&Help"));
  mHelp->addAction(actHelpAbout);
  
  tbMain->addAction(actFileNew);
  tbMain->addAction(actFileOpen);
  tbMain->addAction(actFileSave);
  tbMain->addSeparator();
  tbMain->addAction(actFileGenerate);
  tbMain->addAction(actFileGeneratePart);
  tbMain->addSeparator();
  tbMain->addAction(actFileExit);
  
  tbTools->addAction(actEditHW);
  tbTools->addAction(actEditInp);
  tbTools->addAction(actEditNull);
  tbTools->addAction(actEditFile);
  tbTools->addSeparator();
  tbTools->addAction(actEditRoute);
  tbTools->addAction(actEditRate);
  tbTools->addAction(actEditDmix);
  tbTools->addAction(actEditLADSPA);
  tbTools->addAction(actEditMeter);
  tbTools->addSeparator();
  tbTools->addAction(actEditLinear);
  tbTools->addAction(actEditFloat);
  tbTools->addAction(actEditIEC958);
  tbTools->addAction(actEditMuLaw);
  tbTools->addAction(actEditALaw);
  tbTools->addAction(actEditImaADPCM);

  QStatusBar* statusbar = new QStatusBar(this);
  statusbar->setObjectName("statusbar");
  setStatusBar(statusbar);
  statusLabel=new QLabel(statusbar);
  statusbar->addWidget(statusLabel,100);

  scrollArea = new QScrollArea(this);
  scrollArea->setWidgetResizable(true);

  setCentralWidget(scrollArea);

  renderArea = new QRenderArea(scrollArea,scrollArea);
  scrollArea->setWidget(renderArea);

  programTitle=tr("ALSA Plugin Editor");
  workFile="";
  
  repaintTimer=0;
  deletedTimer=0;
  
  connect(actFileNew,SIGNAL(triggered()),this,SLOT(fileNew()));
  connect(actFileOpen,SIGNAL(triggered()),this,SLOT(fileOpen()));
  connect(actFileSave,SIGNAL(triggered()),this,SLOT(fileSave()));
  connect(actFileSaveAs,SIGNAL(triggered()),this,SLOT(fileSaveAs()));
  connect(actFileGenerate,SIGNAL(triggered()),this,SLOT(fileGenerate()));
  connect(actFileGeneratePart,SIGNAL(triggered()),this,SLOT(fileGeneratePart()));
  connect(actFileExit,SIGNAL(triggered()),this,SLOT(fileExit()));
  
  connect(actEditHW,SIGNAL(triggered()),this,SLOT(editHW()));
  connect(actEditInp,SIGNAL(triggered()),this,SLOT(editInp()));
  connect(actEditNull,SIGNAL(triggered()),this,SLOT(editNull()));
  connect(actEditFile,SIGNAL(triggered()),this,SLOT(editFile()));
  connect(actEditDmix,SIGNAL(triggered()),this,SLOT(editDmix()));
  connect(actEditRoute,SIGNAL(triggered()),this,SLOT(editRoute()));
  connect(actEditRate,SIGNAL(triggered()),this,SLOT(editRate()));
  connect(actEditLADSPA,SIGNAL(triggered()),this,SLOT(editLADSPA()));
  connect(actEditMeter,SIGNAL(triggered()),this,SLOT(editMeter()));
  connect(actEditLinear,SIGNAL(triggered()),this,SLOT(editLinear()));
  connect(actEditFloat,SIGNAL(triggered()),this,SLOT(editFloat()));
  connect(actEditIEC958,SIGNAL(triggered()),this,SLOT(editIEC958()));
  connect(actEditALaw,SIGNAL(triggered()),this,SLOT(editALaw()));
  connect(actEditMuLaw,SIGNAL(triggered()),this,SLOT(editMuLaw()));
  connect(actEditImaADPCM,SIGNAL(triggered()),this,SLOT(editImaADPCM()));
  
  connect(actToolAllocate,SIGNAL(triggered()),this,SLOT(toolAllocate()));
  connect(actHelpAbout,SIGNAL(triggered()),this,SLOT(helpAbout()));
  
  modified=false;
  updateStatus();
  
  srand(clock());
}
Example #21
0
HPicSync::HPicSync(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::HPicSync),mOptionWidget(NULL),mThreadManager(this),mDirManager(mThreadManager,mDatabaseHandler,mOption),
      mThumbManager(mDatabaseHandler, mOption),mMoreThanOneSelected(false)

{
    ui->setupUi(this);

    ui->listWidgetNew->setItemDelegate(new HPSListViewDelegate(mOption.getThumbSize(),&mMoreThanOneSelected,this));
    ui->listWidgetOld->setItemDelegate(new HPSOldListDelegate(mOption.getThumbSize(),this));

    mDirManager.setModel( ui->comboBox->standardModel());
    initCBOrdner(mOption.getComboBoxView(),mOption.getComboBoxCurrentDir());


    QStatusBar *bar = ui->statusbar;
    mConnectLabel = new QLabel(tr("nicht verbunden"));
    mConnectPixGruenLabel = new QLabel();
    mConnectPixGruenLabel->setPixmap(QPixmap(":/knopfGruen").scaled(QSize(17,17),Qt::KeepAspectRatio));
    mConnectPixRotLabel = new QLabel();
    mConnectPixRotLabel->setPixmap(QPixmap(":/knopfRot").scaled(QSize(17,17),Qt::KeepAspectRatio));
    mBar = new HPSProgressBar;
    // this->mPixOldLoadCountLabel = new QLabel("");
    //this->mPixOldLoadCountLabel->setVisible(false);
    mBar->setVisible(false);
    mBar->setValue(0);
    mBar->setTextVisible(false);
    bar->addWidget(this->mConnectPixGruenLabel);
    bar->addWidget(this->mConnectPixRotLabel);
    bar->addWidget(this->mConnectLabel);
    bar->addPermanentWidget( mBar);
ui->progressBar->hide();
    /*
    this->connect(this->mCloseButton,SIGNAL(clicked()),this,SLOT(close()));
    this->connect(this->mOptionButton,SIGNAL(clicked()),this,SLOT(showOption()));
    this->connect(this->mRefreshButton,SIGNAL(clicked()),this,SLOT(test()));
    this->connect(this->mCopyButton,SIGNAL(clicked()),this,SLOT(test2()));

    connect(mPlusButton,SIGNAL(clicked()),this,SLOT(clickedPlus()));
    connect( &mThumbManager,SIGNAL(thumbsReady(int)),this,SLOT(refreshBar(int)));
    connect( &mThumbManager,SIGNAL(startThumbCreation(QString,int)),this,SLOT(initBar(QString,int)));
    connect( &mThumbManager,SIGNAL(dirCreationReady(QString)),&mDirManager,SLOT(finishAddDir(QString)));
    //connect( &mThumbManager,SIGNAL(startCreation()),this,SLOT(startBar()));
    connect( &mThumbManager,SIGNAL(creationReady()),this,SLOT(finishBar()));
    connect( mMinusButton,SIGNAL(clicked()),this,SLOT(clickedMinus()));

*/
    connect( ui->comboBox,SIGNAL(dirChanged(QString)),this,SLOT(comboBoxDirClicked(QString)));
    setGeometry(mOption.getGeometry());
    if(!mDatabaseHandler.openDatabase("picsync.db"))
        QMessageBox::critical(this, trUtf8("Fehler"), trUtf8("Verbindeung mit der Datenbank konnte nicht hergestellt werden."),QMessageBox::Ok);

    QDir dir( QApplication::applicationDirPath());
    if(!dir.exists(".thumbs")){
        dir.mkdir(".thumbs");
    }

    initThumbManager();
    qDebug() << Q_FUNC_INFO << mOption.dirFromDirlister();
    if(!mOption.dirFromDirlister().isEmpty()){
        mDirManager.startAddDir(mOption.dirFromDirlister(),true);
    }
    mThreadManager.initDirWatcher(mOption,mDirManager,mDatabaseHandler);
   HPSDirWatcher *dirWatcher =  mThreadManager.dirWatcher();
   connect(this,SIGNAL(startFirstRun()),dirWatcher,SLOT(startFirstRun()));
   emit startFirstRun();

}