예제 #1
0
TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QWidget *parent)
    : AbstractItemEditor(form, parent), m_updatingBrowser(false)
{
    m_columnEditor = new ItemListEditor(form, this);
    m_columnEditor->setObjectName(QLatin1String("columnEditor"));
    m_columnEditor->setNewItemText(tr("New Column"));
    ui.setupUi(this);

    injectPropertyBrowser(ui.itemsTab, ui.widget);
    connect(ui.showPropertiesButton, SIGNAL(clicked()),
            this, SLOT(togglePropertyBrowser()));
    togglePropertyBrowser();

    ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns"));
    ui.tabWidget->setCurrentIndex(0);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    ui.newItemButton->setIcon(createIconSet(QString::fromUtf8("plus.png")));
    ui.newSubItemButton->setIcon(createIconSet(QString::fromUtf8("downplus.png")));
    ui.deleteItemButton->setIcon(createIconSet(QString::fromUtf8("minus.png")));
    ui.moveItemUpButton->setIcon(createIconSet(QString::fromUtf8("up.png")));
    ui.moveItemDownButton->setIcon(createIconSet(QString::fromUtf8("down.png")));
    ui.moveItemRightButton->setIcon(createIconSet(QString::fromUtf8("leveldown.png")));
    ui.moveItemLeftButton->setIcon(createIconSet(QString::fromUtf8("levelup.png")));

    ui.treeWidget->header()->setMovable(false);

    connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded()));
}
예제 #2
0
KateAutoIndent::KateAutoIndent (KateDocument *_doc)
  : QObject(_doc), doc(_doc), m_script (0)
{
  // don't call updateConfig() here, document might is not ready for that....

  // on script reload, the script pointer is invalid -> force reload
  connect(KateGlobal::self()->scriptManager(), SIGNAL(reloaded()),
          this, SLOT(reloadScript()));
}
예제 #3
0
void DownloadModel::sort(int column, Qt::SortOrder order){
    qDebug() << QString("sort(%1,%2)").arg(column).arg(order);
    sortColumnOrder.removeAll(column);
    sortColumnOrder.prepend(column);
    sortIsAscending[column] = (order == Qt::AscendingOrder);
    beginResetModel();
    sortSelection();
    endResetModel();
    reloaded();
}
예제 #4
0
TableWidgetEditor::TableWidgetEditor(QDesignerFormWindowInterface *form, QDialog *dialog)
    : AbstractItemEditor(form, 0), m_updatingBrowser(false)
{
    m_columnEditor = new ItemListEditor(form, this);
    m_columnEditor->setObjectName(QLatin1String("columnEditor"));
    m_columnEditor->setNewItemText(tr("New Column"));
    m_rowEditor = new ItemListEditor(form, this);
    m_rowEditor->setObjectName(QLatin1String("rowEditor"));
    m_rowEditor->setNewItemText(tr("New Row"));
    ui.setupUi(dialog);

    injectPropertyBrowser(ui.itemsTab, ui.widget);
    connect(ui.showPropertiesButton, SIGNAL(clicked()),
            this, SLOT(togglePropertyBrowser()));
    setPropertyBrowserVisible(false);

    ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns"));
    ui.tabWidget->insertTab(1, m_rowEditor, tr("&Rows"));
    ui.tabWidget->setCurrentIndex(0);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    ui.tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);

    connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded()));

    connect(ui.tableWidget, SIGNAL(currentCellChanged(int,int,int,int)),
            this, SLOT(on_tableWidget_currentCellChanged(int,int,int,int)));
    connect(ui.tableWidget, SIGNAL(itemChanged(QTableWidgetItem*)),
            this, SLOT(on_tableWidget_itemChanged(QTableWidgetItem*)));
    connect(m_columnEditor, SIGNAL(indexChanged(int)),
            this, SLOT(on_columnEditor_indexChanged(int)));
    connect(m_columnEditor, SIGNAL(itemChanged(int,int,QVariant)),
            this, SLOT(on_columnEditor_itemChanged(int,int,QVariant)));
    connect(m_columnEditor, SIGNAL(itemInserted(int)),
            this, SLOT(on_columnEditor_itemInserted(int)));
    connect(m_columnEditor, SIGNAL(itemDeleted(int)),
            this, SLOT(on_columnEditor_itemDeleted(int)));
    connect(m_columnEditor, SIGNAL(itemMovedUp(int)),
            this, SLOT(on_columnEditor_itemMovedUp(int)));
    connect(m_columnEditor, SIGNAL(itemMovedDown(int)),
            this, SLOT(on_columnEditor_itemMovedDown(int)));

    connect(m_rowEditor, SIGNAL(indexChanged(int)),
            this, SLOT(on_rowEditor_indexChanged(int)));
    connect(m_rowEditor, SIGNAL(itemChanged(int,int,QVariant)),
            this, SLOT(on_rowEditor_itemChanged(int,int,QVariant)));
    connect(m_rowEditor, SIGNAL(itemInserted(int)),
            this, SLOT(on_rowEditor_itemInserted(int)));
    connect(m_rowEditor, SIGNAL(itemDeleted(int)),
            this, SLOT(on_rowEditor_itemDeleted(int)));
    connect(m_rowEditor, SIGNAL(itemMovedUp(int)),
            this, SLOT(on_rowEditor_itemMovedUp(int)));
    connect(m_rowEditor, SIGNAL(itemMovedDown(int)),
            this, SLOT(on_rowEditor_itemMovedDown(int)));
}
예제 #5
0
TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QDialog *dialog)
    : AbstractItemEditor(form, 0), m_updatingBrowser(false)
{
    m_columnEditor = new ItemListEditor(form, this);
    m_columnEditor->setObjectName(QStringLiteral("columnEditor"));
    m_columnEditor->setNewItemText(tr("New Column"));
    ui.setupUi(dialog);

    injectPropertyBrowser(ui.itemsTab, ui.widget);
    connect(ui.showPropertiesButton, SIGNAL(clicked()),
            this, SLOT(togglePropertyBrowser()));
    setPropertyBrowserVisible(false);

    ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns"));
    ui.tabWidget->setCurrentIndex(0);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    ui.newItemButton->setIcon(createIconSet(QString::fromUtf8("plus.png")));
    ui.newSubItemButton->setIcon(createIconSet(QString::fromUtf8("downplus.png")));
    ui.deleteItemButton->setIcon(createIconSet(QString::fromUtf8("minus.png")));
    ui.moveItemUpButton->setIcon(createIconSet(QString::fromUtf8("up.png")));
    ui.moveItemDownButton->setIcon(createIconSet(QString::fromUtf8("down.png")));
    ui.moveItemRightButton->setIcon(createIconSet(QString::fromUtf8("leveldown.png")));
    ui.moveItemLeftButton->setIcon(createIconSet(QString::fromUtf8("levelup.png")));

    ui.treeWidget->header()->setSectionsMovable(false);

    connect(ui.newItemButton, SIGNAL(clicked()), this, SLOT(on_newItemButton_clicked()));
    connect(ui.newSubItemButton, SIGNAL(clicked()), this, SLOT(on_newSubItemButton_clicked()));
    connect(ui.moveItemUpButton, SIGNAL(clicked()), this, SLOT(on_moveItemUpButton_clicked()));
    connect(ui.moveItemDownButton, SIGNAL(clicked()), this, SLOT(on_moveItemDownButton_clicked()));
    connect(ui.moveItemRightButton, SIGNAL(clicked()), this, SLOT(on_moveItemRightButton_clicked()));
    connect(ui.moveItemLeftButton, SIGNAL(clicked()), this, SLOT(on_moveItemLeftButton_clicked()));
    connect(ui.deleteItemButton, SIGNAL(clicked()), this, SLOT(on_deleteItemButton_clicked()));
    connect(ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            this, SLOT(on_treeWidget_currentItemChanged()));
    connect(ui.treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
            this, SLOT(on_treeWidget_itemChanged(QTreeWidgetItem*,int)));

    connect(m_columnEditor, SIGNAL(indexChanged(int)),
            this, SLOT(on_columnEditor_indexChanged(int)));
    connect(m_columnEditor, SIGNAL(itemChanged(int,int,QVariant)),
            this, SLOT(on_columnEditor_itemChanged(int,int,QVariant)));
    connect(m_columnEditor, SIGNAL(itemInserted(int)),
            this, SLOT(on_columnEditor_itemInserted(int)));
    connect(m_columnEditor, SIGNAL(itemDeleted(int)),
            this, SLOT(on_columnEditor_itemDeleted(int)));
    connect(m_columnEditor, SIGNAL(itemMovedUp(int)),
            this, SLOT(on_columnEditor_itemMovedUp(int)));
    connect(m_columnEditor, SIGNAL(itemMovedDown(int)),
            this, SLOT(on_columnEditor_itemMovedDown(int)));

    connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded()));
}
예제 #6
0
bool TextFile::reload()
{
    if (m_document->isModified()) {
        QString text = QString(tr("Cancel file %1 modify and reload ?")).arg(m_fileName);
        int ret = QMessageBox::question(0,"Question",text,QMessageBox::Yes|QMessageBox::No);
        if (ret != QMessageBox::Ok) {
            return false;
        }
    }
    bool ret = open(m_fileName,m_mimeType);
    if (ret) {
        emit reloaded();
    }
    return ret;
}
예제 #7
0
void ModelProjectImpl::editorSaved(LiteApi::IEditor *editor)
{
    if (!editor) {
        return;
    }

    if (FileUtil::compareFile(editor->filePath(),m_file->filePath())) {
        bool success = m_file->reload();
        if (success) {
            m_file->updateModel();
            m_tree->expandAll();
            emit reloaded();
        }
    }
}
예제 #8
0
bool ResourceEditorFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
{
    if (flag == FlagIgnore)
        return true;
    if (type == TypePermissions) {
        emit changed();
    } else {
        emit aboutToReload();
        QString fn = m_parent->m_resourceEditor->fileName();
        if (!m_parent->open(errorString, fn, fn))
            return false;
        emit reloaded();
    }
    return true;
}
ClasticGrainSizeView::ClasticGrainSizeView(QWidget* p, ClasticGrainSizeItemModel* model)
: GrainSizeView(p),
_project(0) {
    setModel(model);
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(model, SIGNAL(reloaded()), this, SLOT(slotReloaded()));

    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotCustomContextMenuRequested(const QPoint&)));
    connect(static_cast<ProfileLogger*> (QApplication::instance()), SIGNAL(currentProjectChanged(Project*)), this, SLOT(slotCurrentProjectChanged(Project*)));
    connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&)));
    connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&)));
    connect(this, SIGNAL(reloadRequest()), model, SLOT(reload()));

    connect(model, SIGNAL(selectItemRequest(const QModelIndex&)), this, SLOT(slotSelectItemRequested(const QModelIndex&)));
}
예제 #10
0
void DJGameUser::reload( const NormalUserDes *userDsc )
{
	quint8 oldTableId	= m_tableId;
	quint8 oldSeatId	= m_seatId;
	quint8 oldGameStatus	= m_gameStatus;
	
	initWithUser( userDsc );
	
	m_selfSetup	= DJGameSetup( userDsc );
	
	emit reloaded( this );
	if ( m_tableId != oldTableId || m_seatId != oldSeatId || m_gameStatus != oldGameStatus ) {
		djDebug() << "emit trinityChanged reload" << oldTableId << oldSeatId << oldGameStatus << "-->" << m_tableId << m_seatId << m_gameStatus;
		emit trinityChanged( this, oldTableId, oldSeatId, oldGameStatus );
	}
}
예제 #11
0
void NotesWidget::switchNotebook(TreeItem::noteListType type, QStringList id, QString currentNote)
{
    listType = type;
    signalsDisabled = true;
    bool active = true;

    clear();

    QSqlQuery result;
    if (type == TreeItem::allNotes) {
        result.prepare("SELECT title, guid, notebookGuid, created, updated FROM notes WHERE active=:active");
        result.bindValue(":active", true);
    } else if ((type == TreeItem::noteBook) || (type == TreeItem::stack)) {
        result.prepare(QString("SELECT title, guid, notebookGuid, created, updated FROM notes WHERE notebookGuid IN (%1) AND active=:active").arg(AddSQLArray(id.count())));
        BindSQLArray(result, id);
        result.bindValue(":active", true);
    } else if (type == TreeItem::trashBin) {
        result.prepare("SELECT title, guid, notebookGuid, created, updated FROM notes WHERE active=:active");
        result.bindValue(":active", false);
        active = false;
    } else if (type == TreeItem::conflict) {
        result.prepare("SELECT notes.title, conflictingNotes.guid, notes.notebookGuid, notes.created, conflictingNotes.updated FROM conflictingNotes LEFT JOIN notes ON notes.guid = conflictingNotes.guid");
    }
    if (!result.exec())
        LOG_ERROR("SQL: " + result.lastError().text());

    while (result.next()) {
        ListItem* item = new ListItem(this);
        item->setText(result.value(0).toString());
        item->setGUID(result.value(1).toString());
        item->setNoteBookGUID(result.value(2).toString());
        item->setCreated(result.value(3).toLongLong());
        item->setModified(result.value(4).toLongLong());
        item->setIcon(QIcon::fromTheme("basket"));
        item->setActive(active);
        item->setSortType(sortType);
    }

    if (!currentNote.isEmpty())
        selectNoteWithGuid(currentNote);

    sortItems();

    signalsDisabled = false;
    emit reloaded();
}
예제 #12
0
SendButton::SendButton(QWidget *parent)
  : QToolButton(parent)
{
  m_history = new QMenu(this);

  setAutoRaise(true);
  setIcon(SCHAT_ICON(Send));
  setPopupMode(QToolButton::MenuButtonPopup);
  setMenu(m_history);

  connect(m_history, SIGNAL(aboutToShow()), SLOT(showMenu()));
  connect(this, SIGNAL(clicked()), SendWidget::i()->input(), SLOT(send()));
  connect(SendWidget::i()->input(), SIGNAL(send(QString)), SLOT(clear()));
  connect(SendWidget::i()->input(), SIGNAL(reloaded()), SLOT(clear()));

  retranslateUi();
}
예제 #13
0
void QmlToolsClient::messageReceived(const QByteArray &message)
{
    QDataStream ds(message);

    QByteArray type;
    int requestId;
    ds >> type >> requestId;

    if (type == QByteArray(RESPONSE)) {
        bool success = false;
        ds >> success;

        if ((m_reloadQueryId != -1) && (m_reloadQueryId == requestId) && success)
            emit reloaded();

        log(LogReceive, type, QString::fromLatin1("requestId: %1 success: %2")
            .arg(QString::number(requestId)).arg(QString::number(success)));
    } else if (type == QByteArray(EVENT)) {
BedCorrelationItemView::BedCorrelationItemView(QWidget* p, BedCorrelationItemModel* model)
: TreeView(p),
_profileCorrelation(0) {
    // setSortingEnabled(true);
    setEnabled(false);

    setModel(model);
    connect(model, SIGNAL(reloaded()), this, SLOT(slotReloaded()));

    setContextMenuPolicy(Qt::CustomContextMenu);

    connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&)));
    connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&)));

    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotCustomContextMenuRequested(const QPoint&)));
    connect(this, SIGNAL(reloadRequest()), model, SLOT(reload()));
    connect(this, SIGNAL(createBedCorrelationRequest()), model, SLOT(slotCreate()));
    connect(this, SIGNAL(editRequest(const QModelIndex&)), model, SLOT(slotEdit(const QModelIndex&)));
    connect(this, SIGNAL(deleteRequest(QModelIndexList)), model, SLOT(slotDelete(QModelIndexList)));
}
void LithologicalUnitItemModel::reload() {
    clear();

    QStringList hh;
    hh << tr("Lithological Unit");
    setHorizontalHeaderLabels(hh);

    if (!_project) {
        return;
    }

    QList<LithologicalUnit*>::iterator it = _project->getFirstLithologicalUnit();
    QList<LithologicalUnit*>::iterator last = _project->getLastLithologicalUnit();

    while (it != last) {
        appendItem(*it);
        it++;
    }

    emit reloaded();
}
예제 #16
0
void QmlToolsClient::messageReceived(const QByteArray &message)
{
    QDataStream ds(message);

    QByteArray type;
    int requestId;
    ds >> type >> requestId;

    if (type == QByteArray(RESPONSE)) {
        bool success = false;
        ds >> success;

        if ((m_reloadQueryId != -1) && (m_reloadQueryId == requestId) && success)
            emit reloaded();

        if ((m_destroyObjectQueryId != -1) && (m_destroyObjectQueryId == requestId)
                && success && !ds.atEnd()) {
            int objectDebugId;
            ds >> objectDebugId;
            emit destroyedObject(objectDebugId);
        }
void ClasticGrainSizeItemModel::reload() {
    clear();

    QStringList hh;
    hh << tr("Clastic Grain Size");
    setHorizontalHeaderLabels(hh);

    if (!_project) {
        return;
    }
    
    QList<ClasticGrainSize*>::iterator it = _project->getFirstClasticGrainSize();
    QList<ClasticGrainSize*>::iterator last = _project->getLastClasticGrainSize();

    while (it != last) {
        appendItem(*it);
        it++;
    }

    emit reloaded();
}
void OutcropQualityItemModel::reload() {
    clear();

    QStringList hh;
    hh << tr("Outcrop Quality");
    setHorizontalHeaderLabels(hh);

    if (!_project) {
        return;
    }
    
    QList<OutcropQuality*>::iterator it = _project->getFirstOutcropQuality();
    QList<OutcropQuality*>::iterator last = _project->getLastOutcropQuality();

    while (it != last) {
        appendItem(*it);
        it++;
    }

    emit reloaded();
}
void BedItemModel::reload() {
    _currentBed = 0;
    clear();

    QStringList hh;
    hh << tr("Beds");
    setHorizontalHeaderLabels(hh);

    if (!_profile) {
        return;
    }

    int bedCnt = _profile->getBedCount();

    for (int pos = 0; pos < bedCnt; pos++) {
        appendItem(_profile->getBedByPosition(pos));
    }

    emit reloaded();
    reset();
}
예제 #20
0
void BaseTextMark::editorOpened(Core::IEditor *editor)
{
#ifdef Q_OS_WIN
    if (m_fileName.compare(editor->file()->fileName(), Qt::CaseInsensitive))
        return;
#else
    if (editor->file()->fileName() != m_fileName)
        return;
#endif
    if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) {
        if (m_markableInterface == 0) { // We aren't added to something
            m_markableInterface = textEditor->markableInterface();
            if (m_markableInterface->addMark(this, m_line)) {
                // Handle reload of text documents, readding the mark as necessary
                connect(textEditor->file(), SIGNAL(reloaded()),
                        this, SLOT(documentReloaded()), Qt::UniqueConnection);
            } else {
                removeInternalMark();
            }
        }
    }
}
예제 #21
0
TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QWidget *parent)
    : QDialog(parent), m_updating(false)
{
    ui.setupUi(this);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    m_form = qobject_cast<FormWindowBase *>(form);
    ui.itemIconSelector->setFormEditor(form->core());
    ui.itemIconSelector->setEnabled(false);
    ui.itemIconSelector->setPixmapCache(m_form->pixmapCache());
    ui.itemIconSelector->setIconCache(m_form->iconCache());

    ui.columnIconSelector->setFormEditor(form->core());
    ui.columnIconSelector->setEnabled(false);
    ui.columnIconSelector->setPixmapCache(m_form->pixmapCache());
    ui.columnIconSelector->setIconCache(m_form->iconCache());

    QIcon upIcon = createIconSet(QString::fromUtf8("up.png"));
    QIcon downIcon = createIconSet(QString::fromUtf8("down.png"));
    QIcon backIcon = createIconSet(QString::fromUtf8("back.png"));
    QIcon forwardIcon = createIconSet(QString::fromUtf8("forward.png"));
    QIcon minusIcon = createIconSet(QString::fromUtf8("minus.png"));
    QIcon plusIcon = createIconSet(QString::fromUtf8("plus.png"));
    ui.newColumnButton->setIcon(plusIcon);
    ui.deleteColumnButton->setIcon(minusIcon);
    ui.moveColumnUpButton->setIcon(upIcon);
    ui.moveColumnDownButton->setIcon(downIcon);
    ui.newItemButton->setIcon(plusIcon);
    ui.deleteItemButton->setIcon(minusIcon);
    ui.moveItemUpButton->setIcon(upIcon);
    ui.moveItemDownButton->setIcon(downIcon);
    ui.moveItemRightButton->setIcon(forwardIcon);
    ui.moveItemLeftButton->setIcon(backIcon);

    ui.treeWidget->header()->setMovable(false);

    connect(m_form->iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded()));
}
예제 #22
0
void NotesWidget::switchTag(QStringList id, QString currentNote)
{
    signalsDisabled = true;
    clear();

    if (id.isEmpty()) {
        signalsDisabled = false;
        return;
    }

    QSqlQuery result;

    result.prepare(QString("SELECT notes.title, notes.guid, notes.created, notes.updated FROM notesTags LEFT OUTER JOIN notes ON notesTags.noteGuid = notes.guid WHERE notesTags.guid IN (%1) AND notes.active=:active GROUP BY notesTags.noteGuid").arg(AddSQLArray(id.count())));
    BindSQLArray(result, id);

    result.bindValue(":active", true);
    if (!result.exec())
        LOG_ERROR("SQL: " + result.lastError().text());

    while (result.next()) {
        ListItem* item = new ListItem(this);
        item->setText(result.value(0).toString());
        item->setGUID(result.value(1).toString());
        item->setCreated(result.value(2).toLongLong());
        item->setModified(result.value(3).toLongLong());
        item->setIcon(QIcon::fromTheme("basket"));
        item->setSortType(sortType);
    }

    if (!currentNote.isEmpty())
        selectNoteWithGuid(currentNote);

    sortItems();

    signalsDisabled = false;
    emit reloaded();
}
void FossilInBedItemModel::reload() {
    clear();

    QStringList hh;
    hh << tr("Fossil");
    setHorizontalHeaderLabels(hh);

    if (!_bed) {
        return;
    }

    QList<Fossil*>::iterator it = _bed->getFirstFossil();
    QList<Fossil*>::iterator last = _bed->getLastFossil();

    while (it != last) {
        Fossil* f = *it;
        if (f) {
            appendItem(*it);
        }
        it++;
    }

    emit reloaded();
}
예제 #24
0
void NotesWidget::switchSearch(QStringList guids, QString currentNote)
{
    signalsDisabled = true;
    clear();

    if (guids.isEmpty()) {
        signalsDisabled = false;
        return;
    }

    QSqlQuery result;
    result.prepare(QString("SELECT title, guid, created, updated FROM notes WHERE guid IN (%1)").arg(AddSQLArray(guids.count())));
    BindSQLArray(result, guids);

    if (!result.exec())
        LOG_ERROR("SQL: " + result.lastError().text());

    while (result.next()) {
        ListItem* item = new ListItem(this);
        item->setText(result.value(0).toString());
        item->setGUID(result.value(1).toString());
        item->setCreated(result.value(2).toLongLong());
        item->setModified(result.value(3).toLongLong());
        item->setIcon(QIcon::fromTheme("basket"));
        item->setSortType(sortType);
    }

    if (!currentNote.isEmpty())
        selectNoteWithGuid(currentNote);

    sortItems();

    signalsDisabled = false;
    emit reloaded();

}
예제 #25
0
ListLog::ListLog(LogPlay *log,RDCae *cae,int id,bool allow_pause,
                 QWidget *parent)
    : QWidget(parent)
{
    list_id=id;
    list_log=log;
    list_cae=cae;
    list_op_mode=RDAirPlayConf::LiveAssist;
    list_action_mode=RDAirPlayConf::Normal;
    list_time_mode=RDAirPlayConf::TwentyFourHour;
    list_scroll=true;
    list_pause_allowed=allow_pause;
    list_playbutton_mode=ListLog::ButtonDisabled;
    list_audition_head_playing=false;
    list_audition_tail_playing=false;

    //
    // Create Fonts
    //
    QFont list_font=QFont("Helvetica",12,QFont::Normal);
    list_font.setPixelSize(12);
    setFont(list_font);
    QFont label_font=QFont("Helvetica",12,QFont::Bold);
    label_font.setPixelSize(12);
    QFont font=QFont("Helvetica",14,QFont::Bold);
    font.setPixelSize(14);
    QFont name_font=QFont("Helvetica",18,QFont::Bold);
    name_font.setPixelSize(18);

    //
    // Create Icons
    //
    list_playout_map=new QPixmap(play_xpm);
    list_macro_map=new QPixmap(rml5_xpm);
    list_chain_map=new QPixmap(chain_xpm);
    list_track_cart_map=new QPixmap(track_cart_xpm);
    list_mic16_map=new QPixmap(mic16_xpm);
    list_notemarker_map=new QPixmap(notemarker_xpm);
    list_traffic_map=new QPixmap(traffic_xpm);
    list_music_map=new QPixmap(music_xpm);

    //
    // Create Palettes
    //
    QColor system_button_text_color = palette().active().buttonText();
    QColor system_button_color = palette().active().button();
    QColor system_mid_color = colorGroup().mid();
    list_from_color=
        QPalette(QColor(BUTTON_FROM_BACKGROUND_COLOR),QColor(system_mid_color));
    list_from_color.
    setColor(QColorGroup::ButtonText,QColor(BUTTON_FROM_TEXT_COLOR));

    list_to_color=
        QPalette(QColor(BUTTON_TO_BACKGROUND_COLOR),QColor(system_mid_color));
    list_to_color.
    setColor(QColorGroup::ButtonText,QColor(BUTTON_TO_TEXT_COLOR));
    list_list_to_color=palette();
    list_list_to_color.setColor(QPalette::Active,QColorGroup::Highlight,
                                BUTTON_TO_BACKGROUND_COLOR);
    list_list_to_color.setColor(QPalette::Active,QColorGroup::HighlightedText,
                                BUTTON_TO_TEXT_COLOR);
    list_list_to_color.setColor(QPalette::Inactive,QColorGroup::Highlight,
                                BUTTON_TO_BACKGROUND_COLOR);
    list_list_to_color.setColor(QPalette::Inactive,QColorGroup::HighlightedText,
                                BUTTON_TO_TEXT_COLOR);
    list_list_from_color=palette();
    list_list_from_color.setColor(QPalette::Active,QColorGroup::Highlight,
                                  BUTTON_FROM_BACKGROUND_COLOR);
    list_list_from_color.setColor(QPalette::Active,QColorGroup::HighlightedText,
                                  BUTTON_FROM_TEXT_COLOR);
    list_list_from_color.setColor(QPalette::Inactive,QColorGroup::Highlight,
                                  BUTTON_FROM_BACKGROUND_COLOR);
    list_list_from_color.
    setColor(QPalette::Inactive,QColorGroup::HighlightedText,
             BUTTON_FROM_TEXT_COLOR);
    list_scroll_color[0]=palette();
    list_scroll_color[0].setColor(QPalette::Active,QColorGroup::ButtonText,
                                  BUTTON_LOG_ACTIVE_TEXT_COLOR);
    list_scroll_color[0].setColor(QPalette::Active,QColorGroup::Button,
                                  BUTTON_LOG_ACTIVE_BACKGROUND_COLOR);
    list_scroll_color[0].setColor(QPalette::Active,QColorGroup::Background,
                                  system_mid_color);
    list_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::ButtonText,
                                  BUTTON_LOG_ACTIVE_TEXT_COLOR);
    list_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::Button,
                                  BUTTON_LOG_ACTIVE_BACKGROUND_COLOR);
    list_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::Background,
                                  system_mid_color);
    list_scroll_color[1]=palette();
    list_scroll_color[1].setColor(QPalette::Active,QColorGroup::ButtonText,
                                  system_button_text_color);
    list_scroll_color[1].setColor(QPalette::Active,QColorGroup::Button,
                                  system_button_color);
    list_scroll_color[1].setColor(QPalette::Active,QColorGroup::Background,
                                  system_mid_color);
    list_scroll_color[1].setColor(QPalette::Inactive,QColorGroup::ButtonText,
                                  system_button_text_color);
    list_scroll_color[1].setColor(QPalette::Inactive,QColorGroup::Button,
                                  system_button_color);
    list_scroll_color[1].setColor(QPalette::Inactive,QColorGroup::Background,
                                  system_mid_color);

    //
    // Hour Selector
    //
    list_hour_selector=new HourSelector(this);
    list_hour_selector->setTimeMode(list_time_mode);
    connect(list_hour_selector,SIGNAL(hourSelected(int)),
            this,SLOT(selectHour(int)));
    list_hour_selector->hide();

    //
    // Log List
    //
    list_log_list=new LibListView(this);
    list_log_list->setFont(list_font);
    int y=0;
    int h=sizeHint().height()-60;
    if(rda->airplayConf()->showCounters()) {
        h-=60;
    }
    if(rda->airplayConf()->hourSelectorEnabled()) {
        y+=80;
        h-=80;
        list_hour_selector->setGeometry(0,0,sizeHint().width(),80);
        list_hour_selector->show();
    }
    list_log_list->setGeometry(0,y,sizeHint().width(),h);
    list_log_list->setAllColumnsShowFocus(true);
    list_log_list->setSelectionMode(QListView::Extended);
    list_log_list->setItemMargin(5);
    list_log_list->addColumn("");
    list_log_list->setColumnAlignment(0,Qt::AlignHCenter);
    list_log_list->addColumn(tr("EST TIME"));
    list_log_list->setColumnAlignment(1,Qt::AlignRight);
    list_log_list->addColumn(tr("LEN"));
    list_log_list->setColumnAlignment(2,Qt::AlignRight);
    list_log_list->addColumn(tr("TRANS"));
    list_log_list->setColumnAlignment(3,Qt::AlignHCenter);
    list_log_list->addColumn(tr("CART"));
    list_log_list->setColumnAlignment(4,Qt::AlignHCenter);
    list_log_list->addColumn(tr("TITLE"));
    list_log_list->setColumnAlignment(5,Qt::AlignLeft);
    list_log_list->addColumn(tr("ARTIST"));
    list_log_list->setColumnAlignment(6,Qt::AlignLeft);
    list_log_list->addColumn(tr("GROUP"));
    list_log_list->setColumnAlignment(7,Qt::AlignHCenter);
    list_log_list->addColumn(tr("TIME"));
    list_log_list->setColumnAlignment(8,Qt::AlignHCenter);
    list_log_list->addColumn(tr("ALBUM"));
    list_log_list->setColumnAlignment(9,Qt::AlignLeft);
    list_log_list->addColumn(tr("LABEL"));
    list_log_list->setColumnAlignment(10,Qt::AlignLeft);
    list_log_list->addColumn(tr("CLIENT"));
    list_log_list->setColumnAlignment(11,Qt::AlignLeft);
    list_log_list->addColumn(tr("AGENCY"));
    list_log_list->setColumnAlignment(12,Qt::AlignLeft);
    list_log_list->addColumn(tr("MARKER"));
    list_log_list->setColumnAlignment(13,Qt::AlignHCenter);
    list_log_list->addColumn(tr("LINE ID"));
    list_log_list->setColumnAlignment(14,Qt::AlignHCenter);
    list_log_list->addColumn(tr("COUNT"));
    list_log_list->setColumnAlignment(15,Qt::AlignHCenter);
    list_log_list->addColumn(tr("STATUS"));
    list_log_list->setColumnAlignment(16,Qt::AlignHCenter);
    list_log_list->setHardSortColumn(15);
    list_log_list->setFocusPolicy(QWidget::NoFocus);
    connect(list_log_list,SIGNAL(selectionChanged()),
            this,SLOT(selectionChangedData()));
    connect(list_log_list,
            SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
            this,
            SLOT(doubleclickedData(QListViewItem *,const QPoint &,int)));
    connect(list_log_list,SIGNAL(cartDropped(int,RDLogLine *)),
            this,SLOT(cartDroppedData(int,RDLogLine *)));

    //
    // List Logs Dialog
    //
    list_logs_dialog=new ListLogs(list_log,this);

    //
    // Time Counter Section
    //
    QLabel *label=new QLabel(tr("Run Length"),this);
    label->setGeometry(372,sizeHint().height()-120,75,20);
    label->setFont(label_font);
    label->setAlignment(AlignCenter);
    label->setBackgroundColor(QColor(system_mid_color));
    if(!rda->airplayConf()->showCounters()) {
        label->hide();
    }

    //
    // Stop Time Counter
    //
    list_stoptime_edit=new QLineEdit(this);
    list_stoptime_edit->setGeometry(407,sizeHint().height()-100,70,18);
    list_stoptime_label=new QLabel(list_stoptime_edit,tr("Next Stop:"),this);
    list_stoptime_label->setGeometry(337,sizeHint().height()-100,65,18);
    list_stoptime_label->setFont(label_font);
    list_stoptime_label->setAlignment(AlignRight|AlignVCenter);
    list_stoptime_label->setBackgroundColor(QColor(system_mid_color));
    if(!rda->airplayConf()->showCounters()) {
        list_stoptime_edit->hide();
        list_stoptime_label->hide();
    }

    //
    // End Time Counter
    //
    list_endtime_edit=new QLineEdit(this);
    list_endtime_edit->setGeometry(407,sizeHint().height()-80,70,18);
    list_endtime_label=new QLabel(list_endtime_edit,tr("Log End:"),this);
    list_endtime_label->setGeometry(337,sizeHint().height()-80,65,18);
    list_endtime_label->setFont(label_font);
    list_endtime_label->setAlignment(AlignRight|AlignVCenter);
    list_endtime_label->setBackgroundColor(QColor(system_mid_color));
    if(!rda->airplayConf()->showCounters()) {
        list_endtime_edit->hide();
        list_endtime_label->hide();
    }

    //
    // Select Button
    //
    list_take_button=new QPushButton(this);
    list_take_button->setGeometry(10,sizeHint().height()-55,80,50);
    list_take_button->setFont(font);
    list_take_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_take_button->setText(tr("Select"));
    list_take_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_take_button,SIGNAL(clicked()),this,SLOT(takeButtonData()));
    list_take_button->hide();

    //
    // Audition Head Button
    //
    list_head_button=new QPushButton(this);
    list_head_button->setGeometry(10,sizeHint().height()-113,80,50);
    list_head_button->setFont(font);
    list_head_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_head_button->setText(tr("Audition\nHead"));
    list_head_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_head_button,SIGNAL(clicked()),this,SLOT(headButtonData()));
    if(!rda->airplayConf()->showCounters()) {
        list_head_button->hide();
    }

    //
    // Audition Tail Button
    //
    list_tail_button=new QPushButton(this);
    list_tail_button->setGeometry(90,sizeHint().height()-113,80,50);
    list_tail_button->setFont(font);
    list_tail_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_tail_button->setText(tr("Audition\nTail"));
    list_tail_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_tail_button,SIGNAL(clicked()),this,SLOT(tailButtonData()));
    if(!rda->airplayConf()->showCounters()) {
        list_tail_button->hide();
    }

    //
    // Play Button
    //
    list_play_button=new QPushButton(this);
    list_play_button->setGeometry(10,sizeHint().height()-55,80,50);
    list_play_button->setFont(font);
    list_play_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_play_button->setText(tr("Start"));
    list_play_button->setDisabled(true);
    list_play_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_play_button,SIGNAL(clicked()),this,SLOT(playButtonData()));

    //
    // Next Button
    //
    list_next_button=new QPushButton(this);
    list_next_button->setGeometry(90,sizeHint().height()-55,80,50);
    list_next_button->setFont(font);
    list_next_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_next_button->setText(tr("Make\nNext"));
    list_next_button->setDisabled(true);
    list_next_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_next_button,SIGNAL(clicked()),this,SLOT(nextButtonData()));

    //
    // Modify Button
    //
    list_modify_button=new QPushButton(this);
    list_modify_button->setGeometry(170,sizeHint().height()-55,80,50);
    list_modify_button->setFont(font);
    list_modify_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_modify_button->setText(tr("Modify"));
    list_modify_button->setDisabled(true);
    list_modify_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_modify_button,SIGNAL(clicked()),this,SLOT(modifyButtonData()));

    //
    // Scroll Button
    //
    list_scroll_button=new QPushButton(this);
    list_scroll_button->setGeometry(250,sizeHint().height()-55,80,50);
    list_scroll_button->setFont(font);
    list_scroll_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_scroll_button->setText(tr("Scroll"));
    list_scroll_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_scroll_button,SIGNAL(clicked()),this,SLOT(scrollButtonData()));
    list_scroll_button->setPalette(list_scroll_color[0]);

    //
    // Refresh Button
    //
    list_refresh_button=new QPushButton(this);
    list_refresh_button->setGeometry(330,sizeHint().height()-55,80,50);
    list_refresh_button->setFont(font);
    list_refresh_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_refresh_button->setText(tr("Refresh\nLog"));
    list_refresh_button->setDisabled(true);
    list_refresh_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_refresh_button,SIGNAL(clicked()),
            this,SLOT(refreshButtonData()));

    //
    // Log Load
    //
    list_load_button=new QPushButton(this);
    list_load_button->setGeometry(sizeHint().width()-90,sizeHint().height()-55,
                                  80,50);
    list_load_button->setFont(font);
    list_load_button->setPalette(QPalette(QColor(system_button_color),QColor(system_mid_color)));
    list_load_button->setText(tr("Select\nLog"));
    list_load_button->setFocusPolicy(QWidget::NoFocus);
    connect(list_load_button,SIGNAL(clicked()),this,SLOT(loadButtonData()));

    //
    // Edit Event Dialog
    //
    list_event_edit=new EditEvent(list_log,list_cae,this);

    //
    // Map Slots
    //
    connect(list_log,SIGNAL(reloaded()),this,SLOT(logReloadedData()));
    connect(list_log,SIGNAL(played(int)),this,SLOT(logPlayedData(int)));
    connect(list_log,SIGNAL(paused(int)),this,SLOT(logPausedData(int)));
    connect(list_log,SIGNAL(stopped(int)),this,SLOT(logStoppedData(int)));
    connect(list_log,SIGNAL(inserted(int)),this,SLOT(logInsertedData(int)));
    connect(list_log,SIGNAL(removed(int,int,bool)),
            this,SLOT(logRemovedData(int,int,bool)));
    connect(list_log,SIGNAL(transportChanged()),
            this,SLOT(transportChangedData()));
    connect(list_log,SIGNAL(modified(int)),this,SLOT(modifiedData(int)));
    connect(list_log,SIGNAL(refreshabilityChanged(bool)),
            this,SLOT(refreshabilityChangedData(bool)));
    connect(list_log,SIGNAL(auditionHeadPlayed(int)),
            this,SLOT(auditionHeadData(int)));
    connect(list_log,SIGNAL(auditionTailPlayed(int)),
            this,SLOT(auditionTailData(int)));
    connect(list_log,SIGNAL(auditionStopped(int)),
            this,SLOT(auditionStoppedData(int)));

    setBackgroundColor(QColor(system_mid_color));

    RefreshList();
    UpdateTimes();
}
예제 #26
0
void DJGameUser::avatarImageDone()
{
	djDebug() << "DJGameUser::avatarImageDone";
	emit reloaded( this );
}
예제 #27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    EdamProtocol *edam = EdamProtocol::GetInstance();

    ui->setupUi(this);

    pdfCache * pdf = new pdfCache(this);

    CustomNetworkAccessManager *nm = new CustomNetworkAccessManager(ui->editor->page()->networkAccessManager(), this, pdf);
    edam->setCNAM(nm);
    ui->editor->page()->setNetworkAccessManager(nm);

    Speller::setSettings(new DBSpellSettings(this, ui->editor));

    ui->editor->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->editor->load(QUrl("qrc:///html/noteajax.html"));

    jsB = new jsBridge(this, pdf);
    jsB->setWebView(ui->editor);
    enmlWritter = new enml2(this);

    connect(ui->editor->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject()));

    loaded = false;
    editingEnabled = false;


    tagsActions = new QActionGroup(this);
    newTag = new TagLabel(this);
    newTag->hide();
    ui->tagsBar->addWidget(newTag);

    appIcon = QIcon(":img/hippo64.png");

    trayIcon = NULL;

    bool sysTrayEnabled = sql::readSyncStatus("systemTray", true).toBool();

    if (QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled)
        enableSystemTrayIcon(true);

    connect(edam, SIGNAL(AuthenticateFailed()), this, SLOT(authentificationFailed()));
    connect(edam, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
    connect(edam, SIGNAL(syncStarted(int)), this, SLOT(syncStarted(int)));
    connect(edam, SIGNAL(noteGuidChanged(QString,QString)), this, SLOT(changeNoteGuid(QString,QString)));
    connect(ui->notebooks, SIGNAL(itemSelectionChanged()), this, SLOT(switchNotebook()));
    connect(ui->tags, SIGNAL(itemSelectionChanged()), this, SLOT(switchTag()));
    connect(ui->tags, SIGNAL(tagAdded(QString,QString)), this, SLOT(addTag(QString,QString)));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(updateTagsToolBar()));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(switchTag()));
    connect(ui->NotesList, SIGNAL(noteSwitched()), this, SLOT(switchNote()));
    connect(ui->action_Abaut, SIGNAL(triggered()), this, SLOT(loadAboutInfo()));
    connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow()));
    connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote()));
    connect(ui->actionSync, SIGNAL(triggered()), this, SLOT(sync()));
    connect(ui->noteTitle, SIGNAL(textEdited(QString)), this, SLOT(noteTitleChange(QString)));
    connect(ui->actionAccount_info, SIGNAL(triggered()), this, SLOT(showUserInfo()));
    connect(ui->editor->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openURL(QUrl)));
    connect(ui->editor->page(), SIGNAL(microFocusChanged()), this, SLOT(updateEditButtonsState()));
    connect(ui->editor, SIGNAL(selectionChanged()), this, SLOT(updateSelectionButtonsState()));
    connect(ui->editor->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
    connect(ui->editor, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorContextMenuRequested(QPoint)));
    connect(ui->editor, SIGNAL(fileInserted(QString)), this, SLOT(insertFile(QString)));
    connect(ui->notebooks, SIGNAL(noteMoved(QString,QString)), this, SLOT(moveNote(QString,QString)));
    connect(ui->notebooks, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->notebooks, SIGNAL(noteRestored(QString,QString)), this, SLOT(restoreNote(QString,QString)));
    connect(ui->NotesList, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->NotesList, SIGNAL(noteRestored(QString)), this, SLOT(restoreNote(QString)));
    connect(ui->NotesList, SIGNAL(noteCreated()), this, SLOT(newNote()));
    connect(ui->NotesList, SIGNAL(reloaded()), this, SLOT(updateCurrentNoteName()));
    connect(ui->editButton, SIGNAL(toggled(bool)), this, SLOT(setEditable(bool)));
    connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote()));
    connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));
    connect(ui->editor->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString)));
    connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int)));
    connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool)));
    connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString)));
    connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool)));
    connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool)));
    connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*)));
    connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString)));
    connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion()));
    connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
    connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString)));


    setWindowIcon(appIcon);
    setWindowTitle("Hippo Notes");

    setTabOrder(ui->noteTitle, ui->editor);

    ui->notebooks->setSortingEnabled(true);
    ui->notebooks->sortByColumn(0, Qt::AscendingOrder);
    ui->editBar->setVisible(false);

    ui->mainToolBar->addAction(ui->actionNew_Note);
    ui->mainToolBar->addAction(ui->actionSync);

    QFontComboBox *font = new QFontComboBox(this);
    font->setDisabled(true);
    font->setFontFilters(QFontComboBox::ScalableFonts);
    font->setEditable(false);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont)));
    connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString)));
    ui->editBar->addWidget(font);

    QComboBox *fontSize = new QComboBox(this);
    fontSize->setDisabled(true);
    fontSize->setEditable(false);
    for (int i = 1; i <= 7; i++)
        fontSize->addItem(QString::number(i));
    connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int)));
    connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString)));
    ui->editBar->addWidget(fontSize);

    QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold);
    boldIco->setIcon(QIcon::fromTheme("format-text-bold"));
    ui->editBar->addAction(boldIco);

    QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic);
    italicIco->setIcon(QIcon::fromTheme("format-text-italic"));
    ui->editBar->addAction(italicIco);

    QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline);
    underlineIco->setIcon(QIcon::fromTheme("format-text-underline"));
    ui->editBar->addAction(underlineIco);

    QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough);
    strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough"));
    ui->editBar->addAction(strikethroughIco);

    ui->editBar->addSeparator();

    QAction *undoIco = ui->editor->pageAction(QWebPage::Undo);
    undoIco->setIcon(QIcon::fromTheme("edit-undo"));
    undoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
    ui->editBar->addAction(undoIco);
    ui->menu_Edit->addAction(undoIco);

    QAction *redoIco = ui->editor->pageAction(QWebPage::Redo);
    redoIco->setIcon(QIcon::fromTheme("edit-redo"));
    redoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
    ui->editBar->addAction(redoIco);
    ui->menu_Edit->addAction(redoIco);

    ui->editBar->addSeparator();

    QAction *rformatIco = ui->editor->pageAction(QWebPage::RemoveFormat);
    rformatIco->setIcon(QIcon::fromTheme("edit-clear"));
    ui->editBar->addAction(rformatIco);

    ui->editBar->addSeparator();

    QAction *leftIco = ui->editor->pageAction(QWebPage::AlignLeft);
    leftIco->setIcon(QIcon::fromTheme("format-justify-left"));
    ui->editBar->addAction(leftIco);

    QAction *centerIco = ui->editor->pageAction(QWebPage::AlignCenter);
    centerIco->setIcon(QIcon::fromTheme("format-justify-center"));
    ui->editBar->addAction(centerIco);

    QAction *rightIco = ui->editor->pageAction(QWebPage::AlignRight);
    rightIco->setIcon(QIcon::fromTheme("format-justify-right"));
    ui->editBar->addAction(rightIco);

    QAction *fillIco = ui->editor->pageAction(QWebPage::AlignJustified);
    fillIco->setIcon(QIcon::fromTheme("format-justify-fill"));
    ui->editBar->addAction(fillIco);

    ui->editBar->addSeparator();

    QAction *indentIco = ui->editor->pageAction(QWebPage::Indent);
    indentIco->setIcon(QIcon::fromTheme("format-indent-more"));
    ui->editBar->addAction(indentIco);

    QAction *outdentIco = ui->editor->pageAction(QWebPage::Outdent);
    outdentIco->setIcon(QIcon::fromTheme("format-indent-less"));
    ui->editBar->addAction(outdentIco);

    QAction *superscriptIco = ui->editor->pageAction(QWebPage::ToggleSuperscript);
    superscriptIco->setIcon(QIcon::fromTheme("format-text-superscript"));
    ui->editBar->addAction(superscriptIco);

    QAction *subscriptIco = ui->editor->pageAction(QWebPage::ToggleSubscript);
    subscriptIco->setIcon(QIcon::fromTheme("format-text-subscript"));
    ui->editBar->addAction(subscriptIco);

    QAction *unorderedIco = ui->editor->pageAction(QWebPage::InsertUnorderedList);
    unorderedIco->setIcon(QIcon::fromTheme("format-list-unordered"));
    ui->editBar->addAction(unorderedIco);

    QAction *orderedIco = ui->editor->pageAction(QWebPage::InsertOrderedList);
    orderedIco->setIcon(QIcon::fromTheme("format-list-ordered"));
    ui->editBar->addAction(orderedIco);

    QAction *lineIco = new QAction("Insert horizontal line", this);
    lineIco->setIcon(QIcon::fromTheme("insert-horizontal-rule"));
    lineIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), lineIco, SLOT(setEnabled(bool)));
    connect(lineIco, SIGNAL(triggered()), this, SLOT(insertHorizontalLine()));
    ui->editBar->addAction(lineIco);

    ui->menu_Edit->addSeparator();

    QAction *cutIco = ui->editor->pageAction(QWebPage::Cut);
    cutIco->setIcon(QIcon::fromTheme("edit-cut"));
    cutIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
    ui->menu_Edit->addAction(cutIco);

    QAction *copyIco = ui->editor->pageAction(QWebPage::Copy);
    copyIco->setIcon(QIcon::fromTheme("edit-copy"));
    copyIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    ui->menu_Edit->addAction(copyIco);

    QAction *pasteIco = ui->editor->pageAction(QWebPage::Paste);
    pasteIco->setIcon(QIcon::fromTheme("edit-paste"));
    pasteIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
    ui->menu_Edit->addAction(pasteIco);

    QAction *pasteSpecialIco = ui->editor->pageAction(QWebPage::PasteAndMatchStyle);
    pasteSpecialIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
    ui->menu_Edit->addAction(pasteSpecialIco);

    ui->menu_Edit->addSeparator();

    QAction *insertUrlIco = new QAction("Create link", this);
    insertUrlIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
    insertUrlIco->setDisabled(true);
    insertUrlIco->setIcon(QIcon::fromTheme("insert-link"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), insertUrlIco, SLOT(setDisabled(bool)));
    connect(insertUrlIco, SIGNAL(triggered()), this, SLOT(insertUrl()));
    ui->menu_Edit->addAction(insertUrlIco);

    QAction *todoIco = new QAction("Insert To-do Checkbox", this);
    todoIco->setIcon(QIcon::fromTheme("checkbox"));
    todoIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), todoIco, SLOT(setEnabled(bool)));
    connect(todoIco, SIGNAL(triggered()), jsB, SIGNAL(insertToDo()));
    ui->menu_Edit->addAction(todoIco);

    QAction *insertImage = new QAction("Insert Image", this);
    insertImage->setIcon(QIcon::fromTheme("insert-image"));
    insertImage->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertImage, SLOT(setEnabled(bool)));
    connect(insertImage, SIGNAL(triggered()), this, SLOT(insertImg()));
    ui->menu_Edit->addAction(insertImage);

    QAction *insertFile = new QAction("Insert File", this);
    insertFile->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertFile, SLOT(setEnabled(bool)));
    connect(insertFile, SIGNAL(triggered()), this, SLOT(insertFile()));
    ui->menu_Edit->addAction(insertFile);

    QAction *encryptIco = new QAction("Encrypt Selected Text...", this);
    encryptIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X));
    encryptIco->setDisabled(true);
    encryptIco->setIcon(QIcon::fromTheme("document-edit-encrypt"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), encryptIco, SLOT(setDisabled(bool)));
    connect(encryptIco, SIGNAL(triggered()), jsB, SIGNAL(encryptText()));
    ui->menu_Edit->addAction(encryptIco);

    ui->menu_Edit->addSeparator();

    QAction *options = new QAction("&Options...", this);
    options->setIcon(QIcon::fromTheme("preferences-other"));
    connect(options, SIGNAL(triggered()), this, SLOT(showOptions()));
    ui->menu_Edit->addAction(options);


    clearConflictBar();
    connect(jsB, SIGNAL(showConflict()), ui->conflictBar, SLOT(show()));
    connect(jsB, SIGNAL(showConflict()), ui->conflictBarBottom, SLOT(show()));

    conflictsGroup = new QActionGroup(this);
    connect(conflictsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeNoteVersion(QAction*)));

    searchIndex = new SearchIndex(this);
    connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(search()));
    connect(edam, SIGNAL(syncFinished()), searchIndex, SLOT(buildSearchIndex()));
    connect(jsB, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(updateNoteIndex(QString)));
    connect(edam, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(dropNoteIndex(QString)));
    connect(ui->searchInput, SIGNAL(returnPressed()), this, SLOT(search()));

    QByteArray mainWindowGeometry = sql::readSyncStatus("mainWindowGeometry").toString().toLatin1();
    if (!mainWindowGeometry.isEmpty())
        restoreGeometry(QByteArray::fromBase64(mainWindowGeometry));

    QByteArray mainWidgetsSplitterState = sql::readSyncStatus("mainWidgetsSplitterState").toString().toLatin1();
    if (!mainWidgetsSplitterState.isEmpty())
        ui->mainWidgetsSplitter->restoreState(QByteArray::fromBase64(mainWidgetsSplitterState));

    //showWindow();
    edam->init();
}