PanelPage::PanelPage(QGraphicsItem *parent): MApplicationPage(parent)
{
    m_panelmgr = new McaPanelManager(this);
    m_panelmgr->setCategories(QStringList() << "email" << "social" << "im");
    m_panelmgr->initialize("sample");

    m_frozen = false;
    m_hiding = false;

    QGraphicsLinearLayout *linear = new QGraphicsLinearLayout(Qt::Vertical, centralWidget());

    QGraphicsLinearLayout *toolbar = new QGraphicsLinearLayout(Qt::Horizontal);
    linear->addItem(toolbar);

    MButton *button = new MButton("Search");
    connect(button, SIGNAL(clicked()), this, SLOT(openSearch()));
    toolbar->addItem(button);

    button = new MButton("Settings");
    connect(button, SIGNAL(clicked()), this, SLOT(openSettings()));
    toolbar->addItem(button);

    m_freezeButton = new MButton("Freeze");
    connect(m_freezeButton, SIGNAL(clicked()), this, SLOT(toggleFreeze()));
    toolbar->addItem(m_freezeButton);

    m_hideButton = new MButton("Mode: Default");
    connect(m_hideButton, SIGNAL(clicked()), this, SLOT(toggleHide()));
    toolbar->addItem(m_hideButton);

    MList *list = new MList;
    linear->addItem(list);
    list->setPreferredWidth(800);
    list->setItemModel(m_panelmgr->feedModel());
    PanelCellCreator *cellCreator = new PanelCellCreator;
    cellCreator->m_page = this;
    list->setCellCreator(cellCreator);
}
Exemple #2
0
MainWindow::MainWindow(AmViewerState *state) : _state(state) {
    _state->recon_tree = NULL;
    _state->amEvent = NULL;
    _state->show_dBm = false;
    _state->filtered = true;
    _state->sumpols = false;
    _state->resetSearch(); // couldn't hurt?

    setWindowTitle("AmViewer");

    // creat dialogs
    _searchWindow = new SearchWindow(this,_state);
    _visWindow = new VisWindow(this,_state);
    _fovWindow = new FovWindow(this,_state);
    _filterWindow = NULL;
    _infoWindow = NULL;

    QWidget *centralWidget = new QWidget();
    setCentralWidget(centralWidget);
    QVBoxLayout *bigLayout = new QVBoxLayout(centralWidget);

    // File menu
    QAction *quitMenu = new QAction("&Exit",this);
    quitMenu->setShortcut(tr("Ctrl+Q"));
    connect(quitMenu,SIGNAL(triggered()),qApp,SLOT(quit()));

    QAction *openMenu = new QAction("&Open ROOT file...",this);
    openMenu->setShortcut(tr("Ctrl+O"));
    connect(openMenu,SIGNAL(triggered()),this,SLOT(openFile()));

    _saveMenu = new QAction("&Save event candidates...",this);
    connect(_saveMenu,SIGNAL(triggered()),this,SLOT(saveFile()));

    QMenu *fileDrop;
    fileDrop = menuBar()->addMenu("&File");
    fileDrop->addAction(openMenu);
    fileDrop->addAction(_saveMenu);
    fileDrop->addAction(quitMenu);

    _saveMenu->setEnabled(false);

    // View menu
    _unitsMenu = new QAction("&Display dBm",this);
    _unitsMenu->setCheckable(true);
    _unitsMenu->setChecked(false);
    connect(_unitsMenu,SIGNAL(triggered()),this,SLOT(applyUnits()));

    // Filter dialog
    _filterMenu = new QAction("&Filter Settings",this);
    connect(_filterMenu,SIGNAL(triggered()),this,SLOT(openFilter()));

    // Polarization checkbox
    _polMenu = new QAction("&Sum Polarizations",this);
    _polMenu->setCheckable(true);
    _polMenu->setChecked(false);
    _polMenu->setEnabled(false);
    connect(_polMenu,SIGNAL(triggered()),this,SLOT(applySumPol()));

    QMenu *viewDrop;
    viewDrop = menuBar()->addMenu("&View");
    viewDrop->addAction(_unitsMenu);
    viewDrop->addAction(_polMenu);
    viewDrop->addAction(_filterMenu);
    _filterMenu->setEnabled(false);

    // Analysis menu
    QAction *infoMenu = new QAction("&Event Info",this);
    connect(infoMenu,SIGNAL(triggered()),this,SLOT(openInfo()));

    _analysisDrop = menuBar()->addMenu("&Analysis");
    _analysisDrop->addAction(infoMenu);

    QAction *searchMenu = new QAction("&Search Parameters",this);
    connect(searchMenu,SIGNAL(triggered()),this,SLOT(openSearch()));

    _analysisDrop->addAction(searchMenu);
    _analysisDrop->setEnabled(false);

    QAction *visMenu = new QAction("&Event Visualization",this);
    connect(visMenu,SIGNAL(triggered()),this,SLOT(openVis()));
    _analysisDrop->addAction(visMenu);

    QAction*fovMenu = new QAction("&AMBER Field of View",this);
    connect(fovMenu,SIGNAL(triggered()),this,SLOT(openFov()));
    _analysisDrop->addAction(fovMenu);

    // Set up layout for event browser, pixel windows, graphs
    QHBoxLayout *hbox = new QHBoxLayout();
    bigLayout->addLayout(hbox);

    // Event list stuff
    _eventList = new QTreeWidget(this);
    _eventList->setColumnCount(2);
    _eventList->setColumnHidden(1,true); //'true' valid in C++?

    QTreeWidgetItem *_source0 = new QTreeWidgetItem(_eventList);
    _source0->setText(0,"Source:0 (LTRIG)");

    QTreeWidgetItem *_source1 = new QTreeWidgetItem(_eventList);
    _source1->setText(0,"Source:1 (PPS)");

    QTreeWidgetItem *_source2 = new QTreeWidgetItem(_eventList);
    _source2->setText(0,"Source:2 (Auger)");

    _eventList->setHeaderLabel("Events");

    hbox->addWidget(_eventList);

    // Some gross stuff concerning the clickable horns
    _hornDisplay = new HornDisplay(this,1);

    CenterHorns *centerLegend = new CenterHorns("center",true);
    QGraphicsProxyWidget *centerLegendProxy = new QGraphicsProxyWidget();
    centerLegendProxy->setWidget(centerLegend->widget);

    _hornDisplay->hornScene->addItem(centerLegendProxy);

    centerLegendProxy->rotate(45);
    centerLegendProxy->setPos(0,-50);
    centerLegendProxy->setZValue(0.0);

    AmHorn *ppsHorn[4];

    int i;
    stringstream out;

    QToolButton *b;

    for(i=0; i<4; i++) {
        b = new QToolButton();
        b->setFixedSize(25,25);
        out.str("");
        out << (i+1);
        ppsHorn[i] = new AmHorn(b,"PPS" + out.str());
        ppsHorn[i]->proxyWidget = new QGraphicsProxyWidget();
        ppsHorn[i]->proxyWidget->setWidget(ppsHorn[i]->_button);
        _hornDisplay->hornScene->addItem(ppsHorn[i]->proxyWidget);
        ppsHorn[i]->proxyWidget->setPos(25*i-145,375);

        // probably stupid, delete
        //ppsHorn[i]->trigger_color = "blue";
        //ppsHorn[i]->updateStyle();

        //delete b;
    }

    QGraphicsSimpleTextItem *item;

    for(i=0; i<4; i++) {
        item = new QGraphicsSimpleTextItem();
        _hornDisplay->hornScene->addItem(item);
        if(i==0) {
            item->setText("CH");
            item->setPos(-7,-31);
            item->setZValue(1.0);
        }
        if(i==1) {
            item->setText("CV");
            item->setPos(-7,5);
            item->setZValue(1.0);
        }
        if(i==2) {
            item->setText("KH");
            item->setPos(-24,-15);
            item->setZValue(1.0);
        }
        if(i==3) {
            item->setText("KV");
            item->setPos(12,-15);
            item->setZValue(1.0);
        }
        //delete item;
    }

    // CRUFT ALERT
    // THIS WHOLE NEXT LOOP IS HIGHLY SUSPECT, I DOUBT IT DOES ANYTHING
    QString qstr;
    for(i=0; i<16; i++) {
        out.str("");
        out << (i+1);
        qstr = QString::fromStdString(out.str());
        item = new QGraphicsSimpleTextItem(qstr);
        _hornDisplay->hornScene->addItem(item);
        if(i==0)
            item->setPos(-2.5,75.0);
        else if(i==1)
            item->setPos(-105.0,177.5);
        else if(i==2)
            item->setPos(-2.5,280.0);
        else if(i==3)
            item->setPos(102.5,177.5);
        else if(i==4)
            item->setPos(-70.0,55.0);
        else if(i==5)
            item->setPos(-95.0,80.0);
        else if(i==6)
            item->setPos(-120.0,105.0);
        else if(i==7)
            item->setPos(-125.0,250.0);
        else if(i==8)
            item->setPos(-100.0,275.5);
        else if(i==9)
            item->setPos(-75.0,300.0);
        else if(i==10)
            item->setPos(60.0,300.0);
        else if(i==11)
            item->setPos(85.0,275.0);
        else if(i==12)
            item->setPos(110.0,250.0);
        else if(i==13)
            item->setPos(120.0,110.0);
        else if(i==14)
            item->setPos(95.0,85.0);
        else if(i==15)
            item->setPos(70.0,60.0);
    }

    QVBoxLayout *evVbox = new QVBoxLayout();
    hbox->addLayout(evVbox);

    QGridLayout *evInfoGrid = new QGridLayout();
    evVbox->addLayout(evInfoGrid);

    _evIdLabel = new QLabel("");
    _evSourceLabel = new QLabel("");
    _evSecLabel = new QLabel("");
    _evNsLabel = new QLabel("");
    _evInfoLabel = new QLabel("");

    evInfoGrid->addWidget(_evIdLabel,0,0);
    evInfoGrid->addWidget(_evSourceLabel,0,1);
    evInfoGrid->addWidget(_evSecLabel,1,0);
    evInfoGrid->addWidget(_evNsLabel,1,1);
    evInfoGrid->addWidget(_evInfoLabel,2,0);

    evVbox->addWidget(_hornDisplay);

    QVBoxLayout *pixelVbox = new QVBoxLayout();
    hbox->addLayout(pixelVbox);

    for(i=0; i<4; i++) {
        pixelWindow[i] = new PixelWindow(this,i);
        pixelWindow[i]->setMinimumHeight(100);
        pixelWindow[i]->setMinimumWidth(300);
        pixelVbox->addWidget(pixelWindow[i]);
    }

    for(i=0; i<28; i++) {
        _hornDisplay->channel[i]->setHornClickFunction(this);
        connect(_hornDisplay->channel[i]->_button,SIGNAL(clicked()),_hornDisplay->channel[i],SLOT(hornClick()));
    }

    for(i=0; i<4; i++) {
        //ppsHorn[i]->setHornClickFunction(clickHornSetPixel);
        ppsHorn[i]->setHornClickFunction(this);
        connect(ppsHorn[i]->_button,SIGNAL(clicked()),ppsHorn[i],SLOT(hornClick()));
    }
}
Exemple #3
0
MainUI::MainUI(bool debugmode) : QMainWindow(){
  //Setup UI
  DEBUG = debugmode;
  AUTHCOMPLETE = false; //not performed yet
  this->setWindowTitle(tr("AppCafe"));
  //Need 1024 wide if possible
  this->resize(1024,600);
  this->setWindowIcon( QIcon(":icons/appcafe.png") );
  if(this->centralWidget()==0){ this->setCentralWidget( new QWidget(this) ); }
  this->centralWidget()->setLayout( new QVBoxLayout() );
  this->centralWidget()->layout()->setContentsMargins(0,0,0,0);
  this->setStatusBar(new QStatusBar());
  //Setup the ToolBar
  QToolBar *tb = this->addToolBar("");
    tb->setMovable(false);
    tb->setFloatable(false);
    tb->setContextMenuPolicy(Qt::CustomContextMenu); //disable the built-in visibility context menu
    backA = tb->addAction(QIcon(":icons/back.png"), tr("Back"), this, SLOT(GoBack()) );
    forA = tb->addAction(QIcon(":icons/forward.png"), tr("Forward"), this, SLOT(GoForward()) );
    refA = tb->addAction(QIcon(":icons/refresh.png"), tr("Refresh"), this, SLOT(GoRefresh()) );
    stopA = tb->addAction(QIcon(":icons/stop.png"), tr("Stop"), this, SLOT(GoStop()) );
  // - toolbar spacer
    QWidget *spacer = new QWidget(this);
      spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      tb->addWidget(spacer);
  // - Progress bar
    progressBar = new QProgressBar(this);
    progressBar->setRange(0,100);
    progA = tb->addWidget(progressBar); //add it to the end of the toolbar
    progA->setVisible(false); //start off invisible
  // - List Button
    listB = new QToolButton(this);
      listB->setIcon( QIcon(":icons/list.png") );
      listB->setToolTip( tr("AppCafe Options") );
      listB->setStyleSheet( "QToolButton::menu-indicator{ image: none; }" );
      listB->setPopupMode(QToolButton::InstantPopup);
    tb->addWidget(listB);
    //Setup the menu for this button
    listMenu = new QMenu();
      listMenu->addAction(QIcon(":icons/configure.png"), tr("Configure"), this, SLOT(GoConfigure() ) );
      listMenu->addAction(QIcon(":icons/list.png"), tr("Save Pkg List"), this, SLOT(Save_pkglist() ) );
      listMenu->addSeparator();
      listMenu->addAction(QIcon(":icons/search.png"), tr("Search For Text"), this, SLOT(openSearch() ) );
      listMenu->addSeparator();
      listMenu->addAction(QIcon(":icons/close.png"), tr("Close AppCafe"), this, SLOT(GoClose() ) );
    listB->setMenu(listMenu);
    //Setup the search options
    group_search = new QFrame(this);
      group_search->setLayout( new QHBoxLayout() );
      group_search->layout()->setContentsMargins(2,2,2,2);
    line_search = new QLineEdit(this);
      group_search->layout()->addWidget(line_search);
    tool_search = new QToolButton(this);
      group_search->layout()->addWidget(tool_search);
      tool_search->setIcon( QIcon(":icons/search.png") );
      group_search->layout()->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding, QSizePolicy::Minimum) );
  //Setup the Main Interface
    webview = new QWebView(this);
    this->centralWidget()->layout()->addWidget(webview);
    if(webview->page()==0){ webview->setPage(new QWebPage(webview)); }
    webview->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->centralWidget()->layout()->addWidget(group_search);
  
  //Make sure the search bar is hidden to start with    
  group_search->setVisible(false);
    
  //Create the special keyboard shortcuts
  QKeySequence key(QKeySequence::Find);
  ctrlF = new QShortcut( key, this );
  key = QKeySequence(Qt::Key_Escape);
  esc = new QShortcut( key, this );
    
  //Connect signals/slots
  connect(webview, SIGNAL(linkClicked(const QUrl&)), this, SLOT(LinkClicked(const QUrl&)) );
  connect(webview, SIGNAL(loadStarted()), this, SLOT(PageStartLoading()) );
  connect(webview, SIGNAL(loadProgress(int)), this, SLOT(PageLoadProgress(int)) );
  connect(webview, SIGNAL(loadFinished(bool)), this, SLOT(PageDoneLoading(bool)) );
  connect(webview->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT( authenticate(QNetworkReply*) ) );
  connect(tool_search, SIGNAL(clicked()), this, SLOT(GoSearch()) );
  connect(line_search, SIGNAL(returnPressed()), this, SLOT(GoSearch()) );
  connect(ctrlF, SIGNAL(activated()), this, SLOT(openSearch()) );
  connect(esc, SIGNAL(activated()), this, SLOT(closeSearch()) );
  if(DEBUG){
    //connect(webview, SIGNAL(statusBarMessage(const QString&)), this, SLOT(StatusTextChanged(const QString&)) );
    connect(webview->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SLOT(StatusTextChanged(const QString&)) );
  }
  this->statusBar()->setVisible(DEBUG);
  loadHomePage();
  webview->show();
}
Exemple #4
0
MainUI::MainUI(bool debugmode, QString fileURL, QString title, QString iconpath) : QMainWindow(){
  //Setup UI
  DEBUG = debugmode;
  baseURL = fileURL;
  AUTHCOMPLETE = false; //not performed yet
  if(title.isEmpty()){
    if(baseURL.contains("://")){
      this->setWindowTitle(baseURL);
    }else{
      this->setWindowTitle(baseURL.section("/",-1));
    }
  }else{
    this->setWindowTitle(title);	    
  }
  this->resize(1024,600);
  //Check the given icon
  QIcon ico;
  if(!iconpath.isEmpty()){
    //qDebug() << "Checking icon:" << iconpath;
    if(iconpath.startsWith("/") && QFile::exists(iconpath)){ico = QIcon(iconpath); }
    else if( QFile::exists("/usr/local/share/pixmaps/"+iconpath)){ ico = QIcon("/usr/local/share/pixmaps/"+iconpath); }
    else if( QFile::exists("/usr/local/share/pixmaps/"+iconpath+".png")){ ico = QIcon("/usr/local/share/pixmaps/"+iconpath+".png"); }
    else{ ico = QIcon::fromTheme(iconpath); }
  }
  if(ico.isNull()){ico = QIcon(":icons/webview.png"); }
  this->setWindowIcon( ico);
  if(this->centralWidget()==0){ this->setCentralWidget( new QWidget(this) ); }
  this->centralWidget()->setLayout( new QVBoxLayout() );
  this->centralWidget()->layout()->setContentsMargins(0,0,0,0);
  this->setStatusBar(new QStatusBar());
  //Setup the ToolBar
  QToolBar *tb = this->addToolBar("");
    tb->setMovable(false);
    tb->setFloatable(false);
    backA = tb->addAction(QIcon(":icons/back.png"), tr("Back"), this, SLOT(GoBack()) );
    forA = tb->addAction(QIcon(":icons/forward.png"), tr("Forward"), this, SLOT(GoForward()) );
    refA = tb->addAction(QIcon(":icons/refresh.png"), tr("Refresh"), this, SLOT(GoRefresh()) );
    stopA = tb->addAction(QIcon(":icons/stop.png"), tr("Stop"), this, SLOT(GoStop()) );
  // - toolbar spacer
    QWidget *spacer = new QWidget(this);
      spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      tb->addWidget(spacer);
  // - Progress bar
    progressBar = new QProgressBar(this);
    progressBar->setRange(0,100);
    progA = tb->addWidget(progressBar); //add it to the end of the toolbar
    progA->setVisible(false); //start off invisible
    //Setup the search options
    group_search = new QFrame(this);
      group_search->setLayout( new QHBoxLayout() );
      group_search->layout()->setContentsMargins(2,2,2,2);
    line_search = new QLineEdit(this);
      group_search->layout()->addWidget(line_search);
    tool_search = new QToolButton(this);
      group_search->layout()->addWidget(tool_search);
      tool_search->setIcon( QIcon(":icons/search.png") );
      group_search->layout()->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding, QSizePolicy::Minimum) );
  //Setup the Main Interface
    webview = new QWebView(this);
    this->centralWidget()->layout()->addWidget(webview);
    if(webview->page()==0){ webview->setPage(new QWebPage(webview)); }
    webview->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->centralWidget()->layout()->addWidget(group_search);
  
  //Make sure the search bar is hidden to start with    
  group_search->setVisible(false);
    
  //Create the special keyboard shortcuts
  QKeySequence key(QKeySequence::Find);
  ctrlF = new QShortcut( key, this );
  key = QKeySequence(Qt::Key_Escape);
  esc = new QShortcut( key, this );
    
  //Connect signals/slots
  connect(webview, SIGNAL(linkClicked(const QUrl&)), this, SLOT(LinkClicked(const QUrl&)) );
  connect(webview, SIGNAL(urlChanged(const QUrl&)), this, SLOT(LinkClicked(const QUrl&)) );
  connect(webview, SIGNAL(loadStarted()), this, SLOT(PageStartLoading()) );
  connect(webview, SIGNAL(loadProgress(int)), this, SLOT(PageLoadProgress(int)) );
  connect(webview, SIGNAL(loadFinished(bool)), this, SLOT(PageDoneLoading(bool)) );
  connect(webview->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT( authenticate(QNetworkReply*) ) );
  connect(tool_search, SIGNAL(clicked()), this, SLOT(GoSearch()) );
  connect(line_search, SIGNAL(returnPressed()), this, SLOT(GoSearch()) );
  connect(ctrlF, SIGNAL(activated()), this, SLOT(openSearch()) );
  connect(esc, SIGNAL(activated()), this, SLOT(closeSearch()) );
  if(DEBUG){
    //connect(webview, SIGNAL(statusBarMessage(const QString&)), this, SLOT(StatusTextChanged(const QString&)) );
    connect(webview->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SLOT(StatusTextChanged(const QString&)) );
  }
  this->statusBar()->setVisible(DEBUG);
  loadHomePage();
  webview->show();
}