MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_progBarDial(new ProgressBarDialog(this))
{
    ui->setupUi(this);
    this->prepareGUI();
    this->selectedPlace = nullptr;
    QMap<int, QString> pluginIndexNameMap;
    pluginManager.loadPlugin(pluginIndexNameMap);
    for(auto e: pluginIndexNameMap.toStdMap())
    {
        this->list.addItemToBox(e.second, QVariant(e.first));
        pluginManager.getPluginByIndex(e.first)->setMap(this);
    }
    placesListChanged = false;
}
示例#2
0
bool FxSelection::insertPasteSelection() {
  QClipboard *clipboard  = QApplication::clipboard();
  const FxsData *fxsData = dynamic_cast<const FxsData *>(clipboard->mimeData());

  m_pastePosition = TConst::nowhere;

  if (!fxsData || !fxsData->isConnected()) return false;

  if (m_selectedLinks.isEmpty()) return true;

  // Start an undo block and ensure it is appropriately destroyed
  struct Auto {
    bool m_destruct;
    ~Auto() {
      if (m_destruct) TUndoManager::manager()->endBlock();
    }
  } auto_ = {false};

  // Need to make a temporary copy of selected links. It's necessary since the
  // selection will
  // be updated (cleared) after each insertion.
  QList<TFxCommand::Link> selectedLinks(m_selectedLinks);

  int i, size = selectedLinks.size();
  for (i = 0; i < size; ++i) {
    // Clone the fxs to be inserted
    QList<TFxP> fxs;
    QMap<TFx *, int> zeraryFxColumnSize;
    QList<TXshColumnP> columns;

    fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
    if (fxs.empty() && columns.empty()) return true;

    if (!auto_.m_destruct)
      auto_.m_destruct = true, TUndoManager::manager()->beginBlock();

    TFxCommand::insertPasteFxs(selectedLinks[i], fxs.toStdList(),
                               zeraryFxColumnSize.toStdMap(),
                               columns.toStdList(), m_xshHandle, m_fxHandle);
  }

  return true;
}
示例#3
0
QString ApplicationHelper::getFlash(const QMap<QString, QString>& flash)
{
    if(flash.empty())
        return "";
    QMap<QString, QString> classes;
    classes.insert("notice", "info");
    classes.insert("alert", "danger");
    classes.insert("success", "success");
    classes.insert("warning", "warning");

    QString result = "";

    for(const auto& msg: flash.toStdMap())
    {
        if(!classes.contains(msg.first) || msg.second.trimmed().isEmpty())
            continue;
        result += QString("<div class=\"alert alert-%1\">%2</div>\n").arg(classes[msg.first], msg.second);
    }
    return result;
}
示例#4
0
void FxSelection::pasteSelection() {
  /*--- Fxノードを1つだけ選択していた場合、Replace paste ---*/
  if (m_selectedFxs.size() >= 1 && m_selectedLinks.size() == 0 &&
      m_selectedColIndexes.isEmpty())
    replacePasteSelection();
  /*--- Linkを1つだけ選択していた場合、Insert paste ---*/
  else if (m_selectedFxs.size() == 0 && m_selectedLinks.size() >= 1 &&
           m_selectedColIndexes.isEmpty())
    insertPasteSelection();
  else {
    QClipboard *clipboard = QApplication::clipboard();
    const FxsData *fxsData =
        dynamic_cast<const FxsData *>(clipboard->mimeData());
    if (!fxsData) return;
    QList<TFxP> fxs;
    QMap<TFx *, int> zeraryFxColumnSize;
    QList<TXshColumnP> columns;
    fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
    if (fxs.isEmpty() && columns.isEmpty()) return;

    // in case of the paste command triggered from short cut key
    if (m_pastePosition == TConst::nowhere && m_schematicScene) {
      SchematicSceneViewer *ssv =
          dynamic_cast<SchematicSceneViewer *>(m_schematicScene->views().at(0));
      if (ssv)
        m_pastePosition =
            TPointD(ssv->getOldScenePos().x(), ssv->getOldScenePos().y());
    }

    TFxCommand::pasteFxs(fxs.toStdList(), zeraryFxColumnSize.toStdMap(),
                         columns.toStdList(), m_pastePosition, m_xshHandle,
                         m_fxHandle);

    if (m_schematicScene) {
      selectNone();
      for (int i = 0; i < (int)fxs.size(); i++) select(fxs[i]);
      m_schematicScene->selectNodes(fxs);
    }
  }
  m_pastePosition = TConst::nowhere;
}
示例#5
0
bool FxSelection::replacePasteSelection() {
  QClipboard *clipboard  = QApplication::clipboard();
  const FxsData *fxsData = dynamic_cast<const FxsData *>(clipboard->mimeData());

  m_pastePosition = TConst::nowhere;

  if (!fxsData || !fxsData->isConnected()) return false;

  if (m_selectedFxs.isEmpty()) return true;

  struct Auto {
    bool m_destruct;
    ~Auto() {
      if (m_destruct) TUndoManager::manager()->endBlock();
    }
  } auto_ = {false};

  QList<TFxP> selectedFxs(m_selectedFxs);

  int i, size = selectedFxs.size();
  for (i = 0; i < size; ++i) {
    // Clone the fxs to be inserted
    QList<TFxP> fxs;
    QMap<TFx *, int> zeraryFxColumnSize;
    QList<TXshColumnP> columns;

    fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
    if (fxs.empty() && columns.empty()) return true;

    if (!auto_.m_destruct)
      auto_.m_destruct = true, TUndoManager::manager()->beginBlock();

    TFx *inFx = m_selectedFxs[i].getPointer();
    TFxCommand::replacePasteFxs(inFx, fxs.toStdList(),
                                zeraryFxColumnSize.toStdMap(),
                                columns.toStdList(), m_xshHandle, m_fxHandle);
  }

  return true;
}
示例#6
0
    afficherImage();
}

using namespace std;
void MultiCanalDisplay::afficherImage()
{
    foreach(CanalDisplay * display, widgetsList)
    {
        Glayout->removeWidget(display);
        delete display;
    }
    widgetsList.clear();
    imagesMap.clear();

    QMap<QString, Image *> map = MultiCanalController::getImagesList(dossier, finF);
    imagesMap = map.toStdMap();
    std::map<QString, Image *>::iterator it;
    int j = 0;
    for(it = imagesMap.begin() ; it != imagesMap.end() ; ++it)
    {
        QString s = it->first;
        Image * img = it->second;
        CanalDisplay * display = new CanalDisplay(s, img);
        widgetsList.push_back(display);
        Glayout->addWidget(display, j/3, j%3);
        display->setOffsetX(offsetX);
        display->setOffsetY(offsetY);
        QObject::connect(display, SIGNAL(PixelSelected(int,int)), this, SLOT(ChangeCoordinate(int,int)));
        QObject::connect(display, SIGNAL(decouper(int,int,int,int,bool)), this, SLOT(decoupeImages(int,int,int,int,bool)));
        QObject::connect(locationWidget, SIGNAL(coordinateChanged(int,int)), this, SLOT(ChangeCoordinate(int,int)));
        QObject::connect(communeSelection, SIGNAL(communeSelected(double,double)), locationWidget, SLOT(ChangeLatLong(double,double)));
示例#7
0
//SLOT
void Gui_AdminWindow::addUser() {
    bool inserted = true;
    QString name = edt[0]->text();
    QString surn = edt[1]->text();
    QString uname = edt[2]->text();
    QString passw = edt[3]->text();
    int level = _level->itemData(_level->currentIndex()).toInt();
    QMap<string, string> map;
    map.insert("name", name.toStdString());
    map.insert("surname", surn.toStdString());
    map.insert("birthdate", QDate::currentDate().toString("dd.MM.yyyy").toStdString());
    try {
        _admin->insertUser(uname.toStdString(), passw.toStdString(), (privLevel) level, map.toStdMap(), 1);
    }catch(Error e) {
        QMessageBox::critical(this, "Error", QString::fromStdString(e.errorMessage()));
        inserted = false;
    }
    if(inserted) {
        QMessageBox::information(this, "Operation complete", "User successfully created");
        emit modified();
    }
}