Example #1
0
LoginForm::LoginForm(QUrl url, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LoginForm)
{
    url.addEncodedQueryItem(OAUTH_CALLBACK,QByteArray(REDIRECT_URL).toPercentEncoding());
    qDebug() << url;

#ifdef Q_WS_MAEMO_5
        setAttribute(Qt::WA_Maemo5AutoOrientation);
        setAttribute(Qt::WA_Maemo5StackedWindow);
#endif

        QWebSettings* defaultSettings = QWebSettings::globalSettings();
        defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, true);
        defaultSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);

    ui->setupUi(this);


    //    defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled,true);

    page = new JsConsoleWebPage(this);
    ui->webView->setPage(page);
    QWebViewSelectionSuppressor *suppressor = new QWebViewSelectionSuppressor(ui->webView);
    suppressor->enable();
    ui->webView->setInputMethodHints(Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText);
    connect(page,SIGNAL(consoleMessage(QString)),this,SLOT(consoleMessage(QString)));
    connect(ui->webView, SIGNAL(urlChanged(QUrl)), this, SLOT(handleChange(QUrl)));


    ui->webView->load(url);

}
 bool FFigure::setScreenDpi(int newScreenDpi) {
   if (newScreenDpi>0) {
     screen_dpi = newScreenDpi;
     scale_fact = file_dpi/screen_dpi;
     handleChange(0);
     return true;
   } else return false;
 }
Example #3
0
LinkInput::LinkInput(ConfigHandler* c, QWidget* parent)
{
	setParent(parent);
	setWindowFlags(Qt::Dialog);
	setWindowTitle(tr("manage links"));
	setModal(1);

	config = c;

	links = new QList<Link>;
	c->loadLink(links);

	typeSelect = new QComboBox (this);
	QStringList list;
	list << "generic" << "NmsWidget" << "NagVisWidget";
	typeSelect->addItems(list);

	nameSelect = new QComboBox(this);
	foreach (Link l, *links)
		nameSelect->addItem(l.name);

	connect(nameSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(onNameSelectChange()));

	lUserName = new QLabel(tr("userName"), this);
	lPass = new QLabel(tr("password"), this);
	lUrl = new QLabel(tr("Url"), this);
	lType = new QLabel(tr("widgetType"), this);
	lWidgetName = new QLabel(tr("widgetName"), this);

        name = new QLineEdit(this);
        pass = new QLineEdit(this);
        pass->setEchoMode(QLineEdit::Password);
        urlEdit = new QLineEdit();

	connect(typeSelect, SIGNAL(activated(int)),this,SLOT(handleChange()));
	connect(urlEdit, SIGNAL(textEdited(QString)),this,SLOT(handleChange()));
	connect(name, SIGNAL(textEdited(QString)),this,SLOT(handleChange()));
	connect(pass,SIGNAL(textEdited(QString)),this,SLOT(handleChange()));

	newButton = new QPushButton(tr("&new"), this);
	delButton = new QPushButton(tr("&del"), this);
	savButton = new QPushButton(tr("&save"), this);
	finButton = new QPushButton(tr("&finish"), this);

	defFont = new QFont();

	connect(newButton, SIGNAL(clicked()), this, SLOT(onNewClick()));
	connect(delButton, SIGNAL(clicked()), this, SLOT(onDelClick()));  
	connect(savButton, SIGNAL(clicked()), this, SLOT(onSavClick()));
	connect(finButton, SIGNAL(clicked()), this, SLOT(onFinClick()));

	layout = new QGridLayout(this);

	layout->addWidget(lWidgetName,	0, 0);
	layout->addWidget(lType,	2, 0);
	layout->addWidget(lUrl,		3, 0);
	layout->addWidget(lUserName,	4, 0);
	layout->addWidget(lPass,	5, 0);

	layout->addWidget(nameSelect, 0, 1);
	layout->addWidget(typeSelect, 2, 1);
	layout->addWidget(urlEdit   , 3, 1);
	layout->addWidget(name	    , 4, 1);
	layout->addWidget(pass	    , 5, 1);

	layout->addWidget(newButton, 1, 2);
	layout->addWidget(delButton, 2, 2);
	layout->addWidget(savButton, 3, 2);
	layout->addWidget(finButton, 4, 2);

	setMinimumWidth(500);
}