Exemple #1
0
LegendWidget::LegendWidget(Plot *plot):QWidget(plot),
	d_plot(plot),
	d_frame (0),
	d_angle(0),
	d_fixed_coordinates(false)
{
	setAttribute(Qt::WA_DeleteOnClose);

	d_text = new QwtText(QString::null, QwtText::RichText);
	d_text->setFont(QFont("Arial", 12, QFont::Normal, false));
	d_text->setRenderFlags(Qt::AlignTop|Qt::AlignLeft);
	d_text->setBackgroundBrush(QBrush(Qt::NoBrush));
	d_text->setColor(Qt::black);
	d_text->setBackgroundPen (QPen(Qt::NoPen));
	d_text->setPaintAttribute(QwtText::PaintBackground);

	h_space = 5;
	left_margin = 10;
	top_margin = 5;
	line_length = 20;

	QPoint pos = plot->canvas()->pos();
	pos = QPoint(pos.x() + 10, pos.y() + 10);
	move(pos);

    d_selector = NULL;

	connect (this, SIGNAL(showDialog()), plot->parent(), SIGNAL(viewTextDialog()));
	connect (this, SIGNAL(showMenu()), plot->parent(), SIGNAL(showMarkerPopupMenu()));
	connect (this, SIGNAL(enableEditor()), plot->parent(), SLOT(enableTextEditor()));

	setMouseTracking(true);
	show();
	setFocus();
}
Exemple #2
0
WorkspaceWidget::WorkspaceWidget(QWidget *parent) :
    QTreeWidget(parent)
{
    this->actionNewMaterial = new QAction("New Material", this);
    connect(actionNewMaterial,SIGNAL(triggered()),
            this, SLOT(showDialog()));
}
Exemple #3
0
void NSISUpdater::versionInfoArrived(const UpdateInfo &info)
{
    ConfigFile cfg;
    QSettings settings(cfg.configFile(), QSettings::IniFormat);
    qint64 infoVersion = Helper::stringVersionToInt(info.version());
    qint64 seenVersion = Helper::stringVersionToInt(settings.value(seenVersionC).toString());
    qint64 currVersion = Helper::currentVersionToInt();
    if (info.version().isEmpty()
        || infoVersion <= currVersion
        || infoVersion <= seenVersion) {
        qCInfo(lcUpdater) << "Client is on latest version!";
        setDownloadState(UpToDate);
    } else {
        QString url = info.downloadUrl();
        qint64 autoUpdateFailedVersion =
            Helper::stringVersionToInt(settings.value(autoUpdateFailedVersionC).toString());
        if (url.isEmpty() || _showFallbackMessage || infoVersion == autoUpdateFailedVersion) {
            showDialog(info);
        }
        if (!url.isEmpty()) {
            _targetFile = cfg.configPath() + url.mid(url.lastIndexOf('/'));
            if (QFile(_targetFile).exists()) {
                setDownloadState(DownloadComplete);
            } else {
                QNetworkReply *reply = qnam()->get(QNetworkRequest(QUrl(url)));
                connect(reply, &QIODevice::readyRead, this, &NSISUpdater::slotWriteFile);
                connect(reply, &QNetworkReply::finished, this, &NSISUpdater::slotDownloadFinished);
                setDownloadState(Downloading);
                _file.reset(new QTemporaryFile);
                _file->setAutoRemove(true);
                _file->open();
            }
        }
    }
}
Exemple #4
0
QgsEffectStackCompactWidget::QgsEffectStackCompactWidget( QWidget *parent , QgsPaintEffect *effect )
    : QgsPanelWidget( parent )
    , mEnabledCheckBox( nullptr )
    , mButton( nullptr )
    , mPreviewPicture( nullptr )
{
  QHBoxLayout* layout = new QHBoxLayout();
  layout->setContentsMargins( 0, 0, 0, 0 );
  layout->setSpacing( 0 );
  setLayout( layout );

  mEnabledCheckBox = new QCheckBox( this );
  mEnabledCheckBox->setText( tr( "Draw effects" ) );
  layout->addWidget( mEnabledCheckBox );

  mButton = new QToolButton( this );
  mButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mIconPaintEffects.svg" ) ) );
  mButton->setToolTip( tr( "Customise effects" ) );
  layout->addWidget( mButton );

  setFocusPolicy( Qt::StrongFocus );
  setFocusProxy( mEnabledCheckBox );

  connect( mButton, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
  connect( mEnabledCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( enableToggled( bool ) ) );

  setPaintEffect( effect );
}
Exemple #5
0
void Server::onClientDisconnected(QString message)
{
    clients->removeOne((Client*)sender());
    onSaveHistory(message);
    sendMessageToAll(message);
    emit showDialog(message);
}
int MainWindowImpl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: frameSignal(); break;
        case 1: resetTxSignal(); break;
        case 2: showDialog(); break;
        case 3: deleteItem(); break;
        case 4: uploadItem(); break;
        case 5: saveItem(); break;
        case 6: setPathDialog(); break;
        case 7: startAnimation(); break;
        case 8: setanimationtime(); break;
        case 9: animationFinished(); break;
        case 10: showAddCursorDialog(); break;
        case 11: showAddEllipseDialog(); break;
        case 12: animationslidertime((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 13: opacitySliderImpl((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 14: showConfigureDialog(); break;
        case 15: startTx(); break;
        case 16: restartPacketTimer(); break;
        case 17: resetTx(); break;
        case 18: showDebugWindow(); break;
        case 19: showAboutQMTSim(); break;
        case 20: showReadme(); break;
        case 21: viewButtonSlot(); break;
        case 22: showResizeDialog(); break;
        }
        _id -= 23;
    }
    return _id;
}
DragValueCtrl* grid_text(wxWindow* parent,
  wxSizer* sizer,
  winvec_t& showhide,
  const Art& art,
  StatusInterface& statusInfo,
  const DialogFunc& showDialog)
{
  // Create the drag-adjustable grid spacing text

  auto text = make_wx<DragValueCtrl>(parent,
    IntRange(min_t(1)),
    Description(
     "Grid: Drag to adjust spacing. "
     "Right-Click to disable. "
     "Double-click for dialog"),
    DragCursor(art.Get(Cursor::DRAG_SCALE)),
    HoverCursor(art.Get(Cursor::MOVE_POINT)),
    statusInfo);
  showhide.push_back(text);
  text->Hide();

  events::on_mouse_left_double_click(text,
    [=](const IntPoint&){
      showDialog();
    });

  sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL);
  return text;
}
void AdBlockIcon::createMenu(QMenu* menu) {
  if (!menu) {
    menu = qobject_cast<QMenu*>(sender());

    if (!menu) {
      return;
    }
  }

  menu->clear();
  AdBlockCustomList* customList = m_manager->customList();
  WebPage* page = qApp->mainForm()->tabWidget()->currentWidget()->webBrowser()->viewer()->page();
  const QUrl pageUrl = page->url();

  menu->addAction(tr("Show AdBlock &settings"), m_manager, SLOT(showDialog()));
  menu->addSeparator();

  if (!pageUrl.host().isEmpty() && m_enabled && m_manager->canRunOnScheme(pageUrl.scheme())) {
    const QString host = page->url().host().contains(QLatin1String("www.")) ? pageUrl.host().mid(4) : pageUrl.host();
    const QString hostFilter = QString("@@||%1^$document").arg(host);
    const QString pageFilter = QString("@@|%1|$document").arg(pageUrl.toString());
    QAction* act = menu->addAction(tr("Disable on %1").arg(host));

    act->setCheckable(true);
    act->setChecked(customList->containsFilter(hostFilter));
    act->setData(hostFilter);
    connect(act, SIGNAL(triggered()), this, SLOT(toggleCustomFilter()));
    act = menu->addAction(tr("Disable only on this page"));
    act->setCheckable(true);
    act->setChecked(customList->containsFilter(pageFilter));
    act->setData(pageFilter);
    connect(act, SIGNAL(triggered()), this, SLOT(toggleCustomFilter()));
    menu->addSeparator();
  }
}
bool FileChooser::browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComp)
{
    return showDialog (FileBrowserComponent::openMode
                        | FileBrowserComponent::canSelectFiles
                        | FileBrowserComponent::canSelectDirectories
                        | FileBrowserComponent::canSelectMultipleItems,
                       previewComp);
}
Exemple #10
0
void SearchController::findNext()
{
    if( mTool->searchData().isEmpty() )
        showDialog( FindForward );
    else
        mTool->search( FindForward, true, false );
;
}
Exemple #11
0
void TownSprite::onTouchEnded(Touch* pTouch, Event* pEvent)
{
    this->setScale(1.0f);
    
    if (_delta <= LIMIT_DELTA) {
        moveToCenter();
        showDialog();
    }
}
MolecularProperties::MolecularProperties(QObject *parent_) :
  Avogadro::QtGui::ExtensionPlugin(parent_),
  m_action(new QAction(this)),
  m_dialog(NULL),
  m_molecule(NULL)
{
  m_action->setEnabled(true);
  m_action->setText("&Molecular Properties...");
  connect(m_action, SIGNAL(triggered()), SLOT(showDialog()));
}
Exemple #13
0
Options::Options(QWidget *parent) :
    QDialog(parent),ui(new Ui::Options)
{
    ui->setupUi(this);
    connect(ui->buttonBox,SIGNAL(rejected()),this,SLOT(reject()));
    connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(accept()));
    connect(ui->p2cRadio,SIGNAL(toggled(bool)),this,SLOT(changeTitles(bool)));

    showDialog();
}
Exemple #14
0
bool LabDialog::init()
{
    if ( !Layer::init() ) {
        return false;
    }
    
    this->setScale(0.0f);
    showDialog();

    return true;
}
Exemple #15
0
		void CSimple3DView::deleteVisualObjectCB()
		{
			gint l_i32Response = showDialog(m_pDeleteObjectTable, "Delete an object");

			if(l_i32Response == GTK_RESPONSE_ACCEPT)
			{
				const gchar* l_pDeleteObjectName = gtk_entry_get_text(m_pDeleteObjectName);

				m_rSimple3DDatabase.deleteVisualObject(l_pDeleteObjectName);
			}
		}
Exemple #16
0
void Server::incomingConnection(qintptr socketDescriptor)
{
    Client *client = new Client(socketDescriptor);
    clients->push_back(client);
    QObject::connect(client,SIGNAL(sendMessageToAll(QString)),this,SLOT(sendMessageToAll(QString)));
    QObject::connect(client,SIGNAL(showDialog(QString)),this,SLOT(onShowDialog(QString)));
    QObject::connect(client,SIGNAL(signalDisconnected(QString)),this,SLOT(onClientDisconnected(QString)));
    QObject::connect(client,SIGNAL(signalConnected(QString)),this,SLOT(onClientConnected(QString)));
    QObject::connect(client,SIGNAL(saveHistory(QString)),this,SLOT(onSaveHistory(QString)));
    QObject::connect(client,SIGNAL(getHistory()),this,SLOT(onGetHistory(Client*)));
    onGetHistory(client);
}
Exemple #17
0
void ChannelsView::addRoom()
{
  AddRoomDialog *dialog = new AddRoomDialog(this);

# if QT_VERSION >= 0x050000
  connect(dialog, &AddRoomDialog::create, this, &ChannelsView::create);
# else
  connect(dialog, SIGNAL(create(QString,QString,bool)), SLOT(create(QString,QString,bool)));
# endif

  showDialog(dialog);
}
QgsUnitSelectionWidget::QgsUnitSelectionWidget( QWidget *parent )
    : QWidget( parent )
{
  mMapUnitIdx = -1;
  mUnitScaleDialog = new QgsMapUnitScaleDialog( this );

  setupUi( this );
  mMapScaleButton->setVisible( false );

  connect( mUnitCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( toggleUnitRangeButton() ) );
  connect( mMapScaleButton, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
  connect( mUnitCombo, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
}
Color_Selector::Color_Selector(QWidget *parent) :
    Color_Preview(parent), p(new Private(this))
{
    setUpdateMode(Continuous);
    p->old_color = color();

    connect(this,SIGNAL(clicked()),this,SLOT(showDialog()));
    connect(this,SIGNAL(colorChanged(QColor)),this,SLOT(update_old_color(QColor)));
    connect(p->dialog,SIGNAL(rejected()),this,SLOT(reject_dialog()));
    connect(p->dialog,SIGNAL(colorSelected(QColor)), this, SLOT(accept_dialog()));

    setAcceptDrops(true);
}
Exemple #20
0
void MenuFolder::loadOrOpen() {
    if (mCursor == 0) {
        if (initialize(mapFolder->getParent().getPath()) != 0) {
            showDialog("Error reading parent folder!", "OK", "");
        }
    } else if ((mCursor - 1) < mapFolder->folderCount()) {
        if (initialize(mapFolder->getFolder(mCursor - 1).getPath()) != 0) {
            showDialog("Error reading subfolder!", "OK", "");
        }
    } else {
        std::string tmp = "load ";
        tmp += mapFolder->getFile((unsigned long)mCursor - 1 - mapFolder->folderCount()).getPath();
        int error = getOpenRaider().command(tmp.c_str());
        if (error == 0) {
            setVisible(false);
        } else {
            std::ostringstream err;
            err << "Error loading map: " << error << "!";
            showDialog(err.str(), "OK", "");
        }
    }
}
void LegendWidget::showTextEditor()
{
    ApplicationWindow *app = d_plot->multiLayer()->applicationWindow();
    if (!app)
        return;

	d_plot->deselect(this);

	if (app->d_in_place_editing)
        enableEditor();
    else
        showDialog();
}
Exemple #22
0
QString IconDialog::openDialog()
{
    auto dialog = d->dialog.instance();

    dialog->setup(KIconLoader::Desktop);
    dialog->setProperty("DoNotCloseController", true);

    KWindowSystem::setOnAllDesktops(dialog->winId(), true);

    dialog->showDialog();
    KWindowSystem::forceActiveWindow(dialog->winId());

    return dialog->openDialog();
}
Exemple #23
0
void Menu::ackDialog() {
    dialogText = "";
    dialogButton1 = "";
    dialogButton2 = "";

    if (dialogFunction) {
        int error = dialogFunction(dialogState);
        if (error != 0) {
            showDialog("Error processing dialog callback!", "OK", "");
        }
    }

    dialogState = false;
}
Exemple #24
0
void SVNHandler::execSVNCommand( QWidget* parent, SVN::Command cmd, const QStringList& files, bool templates, KSharedConfig* config )
{
  if ( !_isPORepository ) {
    // This message box should never be visible but who knows... ;-)
    KMessageBox::sorry( parent, i18n( "This is not a valid SVN repository. "
      "The SVN commands cannot be executed." ) );
    return;
  }

  // ### TODO: instead of making a QString, use KProcess directly, so that it cares about quoting.
  // ### TODO: use KProcess::setWorkingDirectory instead of using "cd" (therefore allowing to use KProcess without a shell.)
  QString command("cd " + (templates ? _potBaseDir : _poBaseDir) + " && svn ");
  switch ( cmd ) {
    case SVN::Update:
      command += "update --non-interactive";
      break;
    case SVN::Commit:
      // The svn client allows to choose the encoding, so we select UTF-8
      command += "commit -F @[email protected]@ --encoding UTF-8 --non-interactive";
      checkToAdd( files );
      break;
    case SVN::StatusRemote:
      command += "status -u --non-interactive";
      break;
    case SVN::StatusLocal:
      command += "status --non-interactive";
      break;
    case SVN::Diff:
      command += "diff --non-interactive";
      break;
    case SVN::Info:
      command += "info"; // Does not allow  --non-interactive (at least svn 1.1.4).
  }

  QRegExp rx;
  if (templates)
    rx.setPattern(_potBaseDir + "/?");
  else
    rx.setPattern(_poBaseDir + "/?");

  QStringList::ConstIterator it;
  for ( it = files.begin( ); it != files.end( ); ++it ) {
    QString temp = *it;
    temp.remove(rx);
    command += " \'" + temp + "\'";
  }

  showDialog( parent, cmd, files, command, config );
}
AndroidGdbServerKitInformationWidget::AndroidGdbServerKitInformationWidget(Kit *kit, const KitInformation *ki)
    : KitConfigWidget(kit, ki),
      m_label(new ElidingLabel),
      m_button(new QPushButton(tr("Manage...")))
{
    // ToolButton with Menu, defaulting to 'Autodetect'.
    QMenu *buttonMenu = new QMenu(m_button);
    QAction *autoDetectAction = buttonMenu->addAction(tr("Auto-detect"));
    connect(autoDetectAction, SIGNAL(triggered()), this, SLOT(autoDetectDebugger()));
    QAction *changeAction = buttonMenu->addAction(tr("Edit..."));
    connect(changeAction, SIGNAL(triggered()), this, SLOT(showDialog()));
    m_button->setMenu(buttonMenu);

    refresh();
}
void DialogTestModel::callBasicDialog(bool modal)
{
	assert(context_ != nullptr);
	auto uiFramework = context_->queryInterface<IUIFramework>();
	assert(uiFramework != nullptr);

	IDialog::ClosedCallback callback = [this](IDialog& dialog) {
		assert(definition_ != nullptr);
		PropertyAccessor accessor = definition_->bindProperty("basicDialogResult", this);
		accessor.setValue(dialog.result());
	};

	const IDialog::Mode mode = modal ? IDialog::Mode::MODAL : IDialog::Mode::MODELESS;
	uiFramework->showDialog("plg_dialog_test/basic_dialog.qml", mode, callback);
}
bool SoilderInfoDialog::init(int ID)
{
    if ( !Layer::init() ) {
        return false;
    }

    _id = ID;

    this->setScale(0.0f);
    showDialog();

    schedule(schedule_selector(SoilderInfoDialog::update), 3.0f);

    return true;
}
bool QtWebKitCookieJar::deleteCookie(const QNetworkCookie &cookie)
{
	if (!canModifyCookie(cookie))
	{
		return false;
	}

	if (m_keepMode == CookieJar::AskIfKeepMode)
	{
		showDialog(cookie, CookieJar::RemoveCookie);

		return false;
	}

	return m_cookieJar->forceDeleteCookie(cookie);
}
QgsUnitSelectionWidget::QgsUnitSelectionWidget( QWidget *parent )
    : QWidget( parent )
{
  mMapUnitIdx = -1;
  mUnitScaleDialog = new QgsMapUnitScaleDialog( this );

  setupUi( this );
  mMapScaleButton->setVisible( false );
  mMapScaleButton->setToolTip( tr( "Adjust scaling range" ) );

  setFocusPolicy( Qt::StrongFocus );
  setFocusProxy( mUnitCombo );

  connect( mUnitCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( toggleUnitRangeButton() ) );
  connect( mMapScaleButton, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
  connect( mUnitCombo, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
}
Exemple #30
0
void AdBlockIcon::showMenu(const QPoint &pos)
{
    AdBlockManager* manager = AdBlockManager::instance();

    QMenu menu;
    menu.addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog()));
    menu.addSeparator();
    QList<WebPage::AdBlockedEntry> entries = p_QupZilla->weView()->webPage()->adBlockedEntries();
    if (entries.isEmpty()) {
        menu.addAction(tr("No content blocked"))->setEnabled(false);
    }
    else {
        menu.addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false);
        foreach(WebPage::AdBlockedEntry entry, entries) {
            QString address = entry.url.toString().right(55);
            menu.addAction(tr("%1 with (%2)").arg(address, entry.rule), manager, SLOT(showRule()))->setData(entry.rule);
        }
    }