Changeset 18023


Ignore:
Timestamp:
11/24/14 09:12:27 (10 years ago)
Author:
daqct3
Message:
Added copy/paste for time scale in Evidence GUI history plots
Location:
fact/Evidence
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fact/Evidence/GUI.cc

    r18017 r18023  
    341341 
    342342  // Additonal context menu items
    343   QAction* Action = Menu->addAction("Paste service", this, SLOT(MenuPasteService()));
     343  QAction* Action = Menu->addAction("Paste", this, SLOT(MenuPaste()));
    344344  Menu->removeAction(Action);
     345  Menu->insertAction(Menu->actions().value(1), Action);
     346  Action = Menu->addAction("Copy time scale", this, SLOT(MenuCopyTimeScale()));
    345347  Menu->insertAction(Menu->actions().value(1), Action);
    346348
     
    437439}
    438440
    439 // Add new service by pasting name
    440 void EddPlot::MenuPasteService() {
     441// Menu: Copy time scale
     442void EddPlot::MenuCopyTimeScale() {
     443
     444  double Min = axisInterval(QwtPlot::xBottom).minValue(), Max = axisInterval(QwtPlot::xBottom).maxValue();     
     445  QMimeData *MimeData = new QMimeData;
     446  QByteArray Data;
     447
     448  Data.append((char *) &Min, sizeof(double));
     449  Data.append((char *) &Max, sizeof(double));
     450  MimeData->setData("Edd/TimeScale", Data);
     451
     452  QApplication::clipboard()->setMimeData(MimeData);
     453}
     454
     455// Add new service by pasting name or paste time scale
     456void EddPlot::MenuPaste() {
    441457
    442458  const QMimeData *D = QApplication::clipboard()->mimeData();
    443   if (!D->hasFormat("Edd/Service")) return;
    444  
    445   QByteArray E(D->data("Edd/Service"));
    446   AddService(E.left(E.lastIndexOf(' ')), E.right(E.size()-E.lastIndexOf(' ')).toInt());
     459
     460  if (D->data("Edd/TimeScale").size() == 2*sizeof(double)) {
     461        setAxisScale(QwtPlot::xBottom, *((double *) D->data("Edd/TimeScale").data()), *((double *) D->data("Edd/TimeScale").data() + 1));
     462        replot();
     463        return;
     464  }
     465
     466  if (D->hasFormat("Edd/Service")) {
     467        QByteArray E(D->data("Edd/Service"));
     468        AddService(E.left(E.lastIndexOf(' ')), E.right(E.size()-E.lastIndexOf(' ')).toInt());
     469  }
    447470}
    448471
  • fact/Evidence/GUI.h

    r17039 r18023  
    187187   
    188188  private slots:
    189     void MenuPasteService();
     189    void MenuPaste();
     190    void MenuCopyTimeScale();
    190191        void MenuShowLastHour();
    191192        void MenuShowLastDay();
Note: See TracChangeset for help on using the changeset viewer.