void JabberEditAccountWidget::createGeneralTab(QTabWidget *tabWidget)
{
	QWidget *generalTab = new QWidget(this);

	QGridLayout *layout = new QGridLayout(generalTab);
	QWidget *form = new QWidget(generalTab);
	layout->addWidget(form, 0, 0);

	QFormLayout *formLayout = new QFormLayout(form);

	AccountId = new QLineEdit(this);
	connect(AccountId, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Username") + ':', AccountId);

	AccountPassword = new QLineEdit(this);
	AccountPassword->setEchoMode(QLineEdit::Password);
	connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Password") + ':', AccountPassword);

	RememberPassword = new QCheckBox(tr("Remember password"), this);
	RememberPassword->setChecked(true);
	connect(RememberPassword, SIGNAL(clicked()), this, SLOT(dataChanged()));
	formLayout->addRow(0, RememberPassword);

	QLabel *changePasswordLabel = new QLabel(QString("<a href='change'>%1</a>").arg(tr("Change your password")));
	changePasswordLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
	formLayout->addRow(0, changePasswordLabel);
	connect(changePasswordLabel, SIGNAL(linkActivated(QString)), this, SLOT(changePasssword()));

	Identities = new IdentitiesComboBox(false, this);
	connect(Identities, SIGNAL(identityChanged(Identity)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Account Identity") + ':', Identities);

	QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this);
	infoLabel->setWordWrap(true);
	infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
	infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
	formLayout->addRow(0, infoLabel);

	AccountAvatarWidget *avatarWidget = new AccountAvatarWidget(account(), this);
	layout->addWidget(avatarWidget, 0, 1, Qt::AlignTop);

	tabWidget->addTab(generalTab, tr("General"));
}
AboutDialog::AboutDialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::AboutDialog)
{
	ui->setupUi(this);

	ui->textLabel->setText(tr(
		"<h1>HaveClip</h1>"
		"<p>Version %1 (commit <a href=\"http://git.havefun.cz/haveclip/haveclip-desktop/tree/%2\">%3</a>)</p>"
		"<p>A simple clipboard synchronization tool.</p>"
		"<dl><dt>Homepage:</dt><dd><a href=\"http://www.havefun.cz/projects/haveclip\">http://www.havefun.cz/projects/haveclip</a></dd>"
		"</dl>"
		"<h2>Authors:</h2>"
		"<ul><li>Developed by Jakub Skokan &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;</li>"
		"<li>Icon created by Aleš Kocur &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;</li></ul>"
	).arg(VERSION).arg(GIT_CURRENT_SHA1).arg(QString(GIT_CURRENT_SHA1).left(7)));

	connect(ui->textLabel, SIGNAL(linkActivated(QString)), this, SLOT(openLink(QString)));
}
Example #3
0
int drv_label(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QLabel *self = (QLabel*)head->native;
    switch (drvid) {
    case LABEL_INIT: {
        drvNewObj(a0,new QLabel);
        break;
    }
    case LABEL_SETTEXT: {
        self->setText(drvGetString(a1));
        break;
    }
    case LABEL_TEXT: {
        drvSetString(a1,self->text());
        break;
    }
    case LABEL_SETWORDWRAP: {
        self->setWordWrap(drvGetBool(a1));
        break;
    }
    case LABEL_WORDWRAP: {
        drvSetBool(a1,self->wordWrap());
        break;
    }
    case LABEL_SETTEXTFORMAT: {
        self->setTextFormat((Qt::TextFormat)drvGetInt(a1));
        break;
    }
    case LABEL_TEXTFORMAT: {
        drvSetInt(a1,self->textFormat());
        break;
    }
    case LABEL_ONLINKACTIVATED: {
        QObject::connect(self,SIGNAL(linkActivated(QString)),drvNewSignal(self,a1,a2),SLOT(call(QString)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Example #4
0
/* TODO: rename _nonxTupleDB to _isxTupleDB internally and
         set it based on db contents, not command line parameter input
 */
login2::login2(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, modal ? (fl | Qt::Dialog) : fl)
{
  setObjectName(name);
  Q_INIT_RESOURCE(xTupleCommon);
  setupUi(this);

  _company->hide();
  _companyLit->hide();

  _options = _buttonBox->addButton(tr("Options..."), QDialogButtonBox::ActionRole);
  _recent = _buttonBox->addButton(tr("Recent"), QDialogButtonBox::ActionRole);
  _buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Login"));

  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sLogin()));
  connect(_options, SIGNAL(clicked()), this, SLOT(sOptions()));
  connect(_cloudLink, SIGNAL(linkActivated(QString)), this, SLOT(cloudLink(QString)));
  connect(_otherOption, SIGNAL(toggled(bool)), _options, SLOT(setEnabled(bool)));
  connect(_otherOption, SIGNAL(toggled(bool)), _recent, SLOT(setEnabled(bool)));

  _splash = 0;

  _captive = false; _nonxTupleDB = false;
  _multipleConnections = false;
  _evalDatabaseURL = "pgsql://demo.xtuple.com:5434/%1";
  _cloudDatabaseURL= "pgsql://cloud.xtuple.com:5432/%1";

  _password->setEchoMode(QLineEdit::Password);

  updateRecentOptionsActions();
  _databaseURL = xtsettingsValue("/xTuple/_databaseURL", "pgsql://:5432/").toString();
  _enhancedAuth = xtsettingsValue("/xTuple/_enhancedAuthentication", false).toBool();
  _requireSSL = xtsettingsValue("/xTuple/_requireSSL", false).toBool();
  if(xtsettingsValue("/xTuple/_demoOption", false).toBool())
    _demoOption->setChecked(true);
  else if(xtsettingsValue("/xTuple/_cloudOption", false).toBool())
    _cloudOption->setChecked(true);
  _company->setText(xtsettingsValue("/xTuple/cloud_company", "").toString());

  adjustSize();
}
Example #5
0
void RoutingPlugin::initialize()
{
    QWidget *widget = new QWidget;
    d->m_widget.setupUi( widget );
    d->m_widgetItem = new WidgetGraphicsItem( this );
    d->m_widgetItem->setWidget( widget );

    PositionProviderPlugin* activePlugin = marbleModel()->positionTracking()->positionProviderPlugin();
    d->updateGpsButton( activePlugin );
    connect( marbleModel()->positionTracking(),
             SIGNAL(positionProviderPluginChanged(PositionProviderPlugin*)),
             this, SLOT(updateGpsButton(PositionProviderPlugin*)) );

    d->m_widget.routingButton->setEnabled( false );
    connect( d->m_widget.instructionLabel, SIGNAL(linkActivated(QString)),
             this, SLOT(reverseRoute()) );

    MarbleGraphicsGridLayout *layout = new MarbleGraphicsGridLayout( 1, 1 );
    layout->addItem( d->m_widgetItem, 0, 0 );
    setLayout( layout );
    d->updateButtonVisibility();
}
UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const char *const updateUrl)
:
	QDialog(parent),
	ui(new Ui::UpdaterDialog()),
	m_sysinfo(sysinfo),
	m_updateUrl(updateUrl),
	m_status(MUtils::UpdateChecker::UpdateStatus_NotStartedYet),
	m_thread(NULL),
	m_updaterProcess(NULL),
	m_success(false),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));

	//Fix size
	setFixedSize(size());

	//Enable buttons
	connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->buttonDownload, SIGNAL(clicked()), this, SLOT(installUpdate()));
	connect(ui->buttonRetry, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
	
	//Enable info label
	connect(ui->labelUrl, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
	
	//Init animation
	m_animator.reset(new QMovie(":/images/loading.gif"));
	ui->labelLoadingCenter->setMovie(m_animator.data());

	//Init buttons
	ui->buttonCancel->setEnabled(false);
	ui->buttonRetry->hide();
	ui->buttonDownload->hide();

	//Start animation
	SHOW_ANIMATION(true);
}
Example #7
0
KeyWidget::KeyWidget( const CKey &key, int id, bool encrypted, QWidget *parent )
:	QWidget( parent )
,	m_id( id )
,	m_key( key )
{
	setToolTip( key.recipient );
	QLabel *label = new QLabel( key.recipient, this );
	label->setWordWrap( true );
	label->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );

	QString content;
	content += "<a href=\"details\">" + tr("Show details") + "</a>";
	if( !encrypted )
		content += "<br /><a href=\"remove\">" + tr("Remove") + "</a>";
	QLabel *btn = new QLabel( content, this );
	btn->setAlignment( Qt::AlignRight );
	connect( btn, SIGNAL(linkActivated(QString)), SLOT(link(QString)) );

	QVBoxLayout *l = new QVBoxLayout( this );
	l->addWidget( label );
	l->addWidget( btn );
}
Example #8
0
EnvelopeView::EnvelopeView(QWidget *parent, MessageView *messageView): QLabel(parent)
{
    // we create a dummy header, pass it through the style and the use it's color roles so we
    // know what headers in general look like in the system
    QHeaderView helpingHeader(Qt::Horizontal);
    helpingHeader.ensurePolished();

    setBackgroundRole(helpingHeader.backgroundRole());
    setForegroundRole(helpingHeader.foregroundRole());
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setIndent(5);
    setWordWrap(true);
    connect(this, SIGNAL(linkHovered(QString)), this, SLOT(onLinkHovered(QString)));

    QFontMetrics fm(font());
    int iconSize = fm.boundingRect(QLatin1Char('M')).height();
    contactKnownUrl = Gui::Util::resizedImageAsDataUrl(QLatin1String(":/icons/contact-known.png"), iconSize);
    contactUnknownUrl = Gui::Util::resizedImageAsDataUrl(QLatin1String(":/icons/contact-unknown.png"), iconSize);

    connect(this, SIGNAL(linkActivated(QString)), messageView, SLOT(headerLinkActivated(QString)));
    connect(this, SIGNAL(addressDetailsRequested(QString,QStringList&)),
            messageView, SIGNAL(addressDetailsRequested(QString,QStringList&)));
}
Example #9
0
void HelpIndexWidget::showLink(const QModelIndex &index)
{
  if (!index.isValid())
    return;

  QHelpIndexModel *indexModel = qobject_cast<QHelpIndexModel*>(model());
  if (!indexModel)
    return;
  QVariant v = indexModel->data(index, Qt::DisplayRole);
  QString name;
  if (v.isValid())
    name = v.toString();

  QMap<QString, QUrl> links = indexModel->linksForKeyword(name);
  if (links.count() == 1)
  {
    emit linkActivated(links.constBegin().value(), name);
  }
  else if (links.count() > 1)
  {
    emit linksActivated(links, name);
  }
}
ServiceInstaller::ServiceInstaller(QWidget *parent, Qt::WFlags flags)
	: QDialog(parent, flags)
{
	ui.setupUi(this);
	connect(ui.windowsServiceLink, SIGNAL(linkActivated(QString)), this, SLOT(openWindowsServices()));
	
	QString serviceSettings = QString("%1\\service.ini").arg(QDir::cleanPath(qApp->applicationDirPath()));

	if(QFile::exists(serviceSettings))
	{
		QSettings settings(serviceSettings, QSettings::IniFormat);
		serviceName = settings.value("ServiceName", QVariant()).toString();
		serviceExecutable = settings.value("ServiceExecutable", QVariant()).toString();
		dataFiles = settings.value("DataFiles", QVariant()).toString();
	}
	else {
		QMessageBox::critical(this, "Install Failed", "Service settings not found!");
		qApp->quit();
	}

	ui.path_widget->hide();
	checkServiceState();
}
Example #11
0
//! Connects the signals of widgets in the main layout to the appropriate slots.
//! @see createMainLayout()
void Window::mainLayoutCreateConnections() const
{
	connect(comboInfile, SIGNAL(editTextChanged(QString)), this,
			SLOT(updateDisplay()));
	connect(comboOutfile, SIGNAL(editTextChanged(QString)), this,
			SLOT(updateDisplay()));
	connect(spinColumns, SIGNAL(valueChanged(int)), this,
			SLOT(updateColumnList()));
	connect(spinColumns, SIGNAL(valueChanged(int)), this,
			SLOT(updateDisplay()));
	connect(buttonBrowseInput, SIGNAL(clicked()), this,
			SLOT(openFileDialog()));
	connect(buttonBrowseOutput, SIGNAL(clicked()), this,
			SLOT(saveFileDialog()));
	connect(buttonProcessData, SIGNAL(clicked()), this,
			SLOT(dataToCsv()));
	connect(comboRowLimit, SIGNAL(editTextChanged(const QString&)), this,
			SLOT(filterLimitRowsName(const QString&)));
	connect(comboRowLimit, SIGNAL(editTextChanged(const QString&)), this,
			SLOT(updateDisplay()));
	connect(statusBarMessage, SIGNAL(linkActivated(QString)), this,
			SLOT(openSystemWebBrowser(QString)));
}
Example #12
0
void SearchView::updateRecentKeywords() {

    // cleanup
    QLayoutItem *item;
    while ((item = recentKeywordsLayout->takeAt(1)) != 0) {
        item->widget()->close();
        delete item;
    }

    // load
    QSettings settings;
    QStringList keywords = settings.value(recentKeywordsKey).toStringList();
    recentKeywordsLabel->setVisible(!keywords.isEmpty());
    The::globalActions()->value("clearRecentKeywords")->setEnabled(!keywords.isEmpty());

    foreach (QString keyword, keywords) {
        QString link = keyword;
        QString display = keyword;
        if (keyword.startsWith("http://") || keyword.startsWith("https://")) {
            int separator = keyword.indexOf("|");
            if (separator > 0 && separator + 1 < keyword.length()) {
                link = keyword.left(separator);
                display = keyword.mid(separator+1);
            }
        }
        QLabel *itemLabel = new QLabel("<a href=\"" + link
                                       + "\" style=\"color:palette(text); text-decoration:none\">"
                                       + display + "</a>", this);

        itemLabel->setMaximumWidth(queryEdit->width() + watchButton->width());
        // itemLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        // Make links navigable with the keyboard too
        itemLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);

        connect(itemLabel, SIGNAL(linkActivated(QString)), this, SLOT(watchKeywords(QString)));
        recentKeywordsLayout->addWidget(itemLabel);
    }
Example #13
0
IdentityDialog::IdentityDialog(Kopete::Identity *identity, QWidget *parent)
: Kopete::UI::InfoDialog(parent, i18n("Identity Information"), "identity"), d(new Private())
{
	Q_ASSERT(identity);

	setTitle(identity->label());
	setWindowTitle(i18n("Identity Information"));

	d->identity = identity;
	d->props = Kopete::Global::Properties::self();
	
	// add the general page
	QWidget *w = new QWidget(this);
	d->general.setupUi(w);
	d->general.selectPhoto->setIcon(KIcon("view-preview"));
	d->general.clearPhoto->setIcon(KIcon("edit-clear-locationbar-rtl"));
	d->general.photo->setText( QString("<qt><a href=\"selectPhoto\">"
										"<p align=\"center\">%1</p>"
										"</a></qt>").arg( i18n("No Photo") ));

	connect(d->general.selectPhoto, SIGNAL(clicked(bool)),
			this, SLOT(slotSelectPhoto()));
	connect(d->general.photo, SIGNAL(linkActivated(QString)),
			this, SLOT(slotSelectPhoto()));
	connect(d->general.clearPhoto, SIGNAL(clicked(bool)),
			this, SLOT(slotClearPhoto()));
	addWidget(w, i18n("General Information"));

	// add the detailed page
	w = new QWidget(this);
	d->detailed.setupUi(w);
	addWidget(w, i18n("Detailed Information"));

	setIcon(KIcon(d->identity->customIcon()));

	load();
}
Example #14
0
void ContentWindow::showContextMenu(const QPoint &pos)
{
    if (!m_contentWidget->indexAt(pos).isValid())
        return;

    QHelpContentModel *contentModel =
        qobject_cast<QHelpContentModel*>(m_contentWidget->model());
    QHelpContentItem *itm =
        contentModel->contentItemAt(m_contentWidget->currentIndex());

    QMenu menu;
    QAction *curTab = menu.addAction(tr("Open Link"));
    QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
    if (isPdfFile(itm))
        newTab->setEnabled(false);
    
    menu.move(m_contentWidget->mapToGlobal(pos));

    QAction *action = menu.exec();
    if (curTab == action)
        emit linkActivated(itm->url());
    else if (newTab == action)
        CentralWidget::instance()->setSourceInNewTab(itm->url());
}
Example #15
0
void AboutDialog::setInfo(const QString info)
{
    label_Info->setText(info);
    connect(label_Info,SIGNAL(linkActivated(QString)),this,SLOT(openUrl(QString)));
}
Example #16
0
void RemoteHelpFilter::accept(Core::LocatorFilterEntry selection) const
{
    const QString &url = selection.displayName;
    if (!url.isEmpty())
        emit linkActivated(url);
}
/*!
    \internal
    this function will only be ever called once
*/
void QDeclarativeGeoMap::mappingManagerInitialized()
{
    m_mappingManagerInitialized = true;

    m_map = m_mappingManager->createMap(this);
    m_gestureArea->setMap(m_map);

    // once mappingManagerInitilized_ is set zoomLevel() returns the default initialised
    // zoom level of the map controller. Overwrite it here to whatever the user chose.
    m_map->mapController()->setZoom(m_zoomLevel);

    //The zoom level limits are only restricted by the plugins values, if the user has set a more
    //strict zoom level limit before initialization nothing is done here.
    if (m_mappingManager->cameraCapabilities().minimumZoomLevel() > m_gestureArea->minimumZoomLevel())
        setMinimumZoomLevel(m_mappingManager->cameraCapabilities().minimumZoomLevel());

    if (m_gestureArea->maximumZoomLevel() < 0
            || m_mappingManager->cameraCapabilities().maximumZoomLevel() < m_gestureArea->maximumZoomLevel())
        setMaximumZoomLevel(m_mappingManager->cameraCapabilities().maximumZoomLevel());

    m_map->setActiveMapType(QGeoMapType());

    m_copyrights = new QDeclarativeGeoMapCopyrightNotice(this);
    connect(m_map, SIGNAL(copyrightsChanged(QImage)),
            m_copyrights.data(), SLOT(copyrightsChanged(QImage)));
    connect(m_map, SIGNAL(copyrightsChanged(QString)),
            m_copyrights.data(), SLOT(copyrightsChanged(QString)));
    connect(m_copyrights.data(), SIGNAL(linkActivated(QString)),
            this, SIGNAL(copyrightLinkActivated(QString)));

    connect(m_map,
            SIGNAL(updateRequired()),
            this,
            SLOT(update()));
    connect(m_map->mapController(),
            SIGNAL(centerChanged(QGeoCoordinate)),
            this,
            SLOT(mapCenterChanged(QGeoCoordinate)));
    connect(m_map->mapController(),
            SIGNAL(zoomChanged(qreal)),
            this,
            SLOT(mapZoomLevelChanged(qreal)));

    m_map->mapController()->setCenter(m_center);

    QList<QGeoMapType> types = m_mappingManager->supportedMapTypes();
    for (int i = 0; i < types.size(); ++i) {
        QDeclarativeGeoMapType *type = new QDeclarativeGeoMapType(types[i], this);
        m_supportedMapTypes.append(type);
    }

    if (!m_supportedMapTypes.isEmpty()) {
        QDeclarativeGeoMapType *type = m_supportedMapTypes.at(0);
        m_activeMapType = type;
        m_map->setActiveMapType(type->mapType());
    }

    // Map tiles are built in this call
    m_map->resize(width(), height());
    // This prefetches a buffer around the map
    m_map->prefetchData();
    m_map->update();

    connect(m_mappingManager, SIGNAL(supportedMapTypesChanged()), this, SLOT(onSupportedMapTypesChanged()));
    emit minimumZoomLevelChanged();
    emit maximumZoomLevelChanged();
    emit supportedMapTypesChanged();
    emit activeMapTypeChanged();

    // Any map items that were added before the plugin was ready
    // need to have setMap called again
    foreach (const QPointer<QDeclarativeGeoMapItemBase> &item, m_mapItems) {
        if (item)
            item.data()->setMap(this, m_map);
    }
}
Example #18
0
void Login::Login_layout_init()
{
    /*top*/
    Close_Btn = new Push_Btn();
    Min_Btn = new Push_Btn();
    Title_label = new QLabel();
    top_lable = new QLabel();
    top_img = new QMovie();  //Keep
    QFont TitleFont("楷体", 12, QFont::Bold);
    Title_label->setFixedSize(400,35);
    Title_label->setStyleSheet("background-color:rgb(23, 197, 104); color:white;");
    Min_Btn->Load_Pixmap_keven(":/SysButton/min");
    Close_Btn->Load_Pixmap_keven(":/SysButton/close");
    Title_label->setText(tr("Smart L"));
    Title_label->setFont(TitleFont);
    Title_label->setAlignment(Qt::AlignCenter);
    top_layout = new QHBoxLayout();
    top_layout->addWidget(Title_label);
    top_layout->addWidget(Min_Btn);
    top_layout->addWidget(Close_Btn);
    top_layout->setMargin(0);
    top_layout->setSpacing(0);

    /*middle*/
    User_Name = new QLineEdit();
    Passwd = new QLineEdit();
    Regiser_account = new QLabel();
    Forget_Passwd = new  QLabel();
    Auto_login = new QCheckBox();
    Remind_passwd = new QCheckBox();

    User_Name->setPlaceholderText(tr("Account"));
    User_Name->setFixedSize(150, 30);
    Passwd->setPlaceholderText(tr("Passwd"));
    Passwd->setEchoMode(QLineEdit::Password);
    Passwd->setFixedSize(150, 30);
    Regiser_account->setText("<a href = http://blog.csdn.net/ongoingcre>" + tr("Register") + "</a>");
    Regiser_account->setFixedSize(50,30);
    Forget_Passwd->setText("<a href = http://blog.csdn.net/ongoingcre>" + tr("Forget") + "</a>");
    Forget_Passwd->setFixedSize(50,30);
    Auto_login->setText(tr("Auto Login"));
    Auto_login->setFixedSize(100,30);
    Remind_passwd->setText(tr("Remind Passwd"));
    Remind_passwd->setFixedSize(100,30);
    //Regiser_account->setStyleSheet("background-color:red");

    middle_layout = new QGridLayout();
    middle_layout->addWidget(User_Name,0,0,Qt::AlignCenter);
    middle_layout->addWidget(Regiser_account,0,1,Qt::AlignRight);
    middle_layout->addWidget(Passwd,1,0,Qt::AlignCenter);
    middle_layout->addWidget(Forget_Passwd,1,1,Qt::AlignRight);
    middle_layout->addWidget(Auto_login,2,0,Qt::AlignCenter);
    middle_layout->addWidget(Remind_passwd,2,1,Qt::AlignCenter);
    //middle_layout->setMargin(0);
    middle_layout->setSpacing(25);
    middle_layout->setContentsMargins(100,75,80,15);
    middle_layout->setColumnStretch(6,1);


    /*bottom*/
    Login_Btn = new Bottom_Btn();
    Qrcode_Btn = new QPushButton();
    Qrcode_Btn->setFixedSize(35,25);
    Qrcode_Btn->setCursor(QCursor(Qt::PointingHandCursor));
    //Login_Btn->setFixedSize(200,35);
    Qrcode = new QLabel();
    Qrcode->setFixedSize(65,35);

    Login_Btn->Load_Beside_img("",tr("Login"),200,35,25);
    Login_Btn->setShortcut(Qt::Key_Enter);  //设置快捷键为Enter
    Login_Btn->setShortcut(QKeySequence::InsertParagraphSeparator); //回车快捷键
    Login_Btn->setFocus();
    QFont BottomFont("楷体", 10.5, QFont::Bold);
    Login_Btn->setFont(BottomFont);
    Qrcode_Btn->setIcon(QIcon(":/Mainmenu/qrcode"));
    Qrcode_Btn->setFlat(true);

    bottom_layout = new QHBoxLayout();
    //bottom_layout->addStretch(0);
    bottom_layout->addWidget(Login_Btn);
    bottom_layout->addWidget(Qrcode);
    bottom_layout->addWidget(Qrcode_Btn);
    bottom_layout->setMargin(0);
    bottom_layout->setSpacing(0);
    bottom_layout->setContentsMargins(100,0,0,15);
/**/
    page_1_login = new QWidget(this);
    page_1_login->setLayout(middle_layout);
    page_1_login->setStyleSheet("background-color:white");

    main_layout = new QStackedLayout();
    main_layout->addWidget(page_1_login);
    main_layout->addWidget(page_2_qrcode);
    main_layout->setMargin(0);
    main_layout->setSpacing(0);
    main_layout->setCurrentWidget(page_1_login);


    /*main layout*/
    layout = new QVBoxLayout(this);
    layout->addLayout(top_layout);
    layout->addLayout(main_layout);
    layout->addLayout(bottom_layout);
    //layout->addStretch(0);
    layout->setMargin(0);
    layout->setSpacing(0);
    this->setLayout(layout);


    /*自动补全*/
    QStringList word_list;
    word_list<<"admin"<<"user";
    m_completer = new QCompleter(word_list, this);
    m_completer->setCaseSensitivity(Qt::CaseInsensitive);
    User_Name->setCompleter(m_completer);
    /*SIGNAL TO SLOT*/
    connect(Close_Btn,SIGNAL(clicked()),this,SLOT(close()));
    connect(Regiser_account,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString )));
    connect(Forget_Passwd,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString )));
    connect(Login_Btn,SIGNAL(clicked()),this,SLOT(Login_response()));
    connect(Min_Btn,SIGNAL(clicked()),this,SLOT(hide()));
    connect(Qrcode_Btn,SIGNAL(clicked()),this,SLOT(Qrcode_Btn_clicked()));
}
QObject* GCF::Components::HelpSystemComponent::fetchObject(const QString& completeName) const
{
    QStringList comps = completeName.split('.');
    GCF::Components::HelpSystemComponent* that = const_cast<GCF::Components::HelpSystemComponent*>(this);

    if(comps.last() == "controller")
        return that;

    if(comps.last() == "helpEngine")
    {
        if( !d->helpEngine )
        {
            qDebug("Help Collection File is: %s", qPrintable(d->helpCollectionFile));
            d->helpEngine = new QHelpEngine(d->helpCollectionFile, that);
            bool success = d->helpEngine->setupData();
            if( !success )
                qDebug("Could not initialize help engine");

            d->contentModel = d->helpEngine->contentModel();
            d->contentWidget = d->helpEngine->contentWidget();
            d->indexModel = d->helpEngine->indexModel();
            d->indexWidget = d->helpEngine->indexWidget();
            d->helpSearchEngine = d->helpEngine->searchEngine();
            d->helpSearchEngine->reindexDocumentation();

            d->searchPanel = new QWidget;
            QVBoxLayout* layout = new QVBoxLayout(d->searchPanel);
            layout->setMargin(5);
            layout->addWidget( d->helpSearchEngine->queryWidget() );
            layout->addWidget( d->helpSearchEngine->resultWidget() );

            d->indexPanel = new QWidget;
            QLabel* lf = new QLabel("&Look For");
            d->indexFilterLineEdit = new QLineEdit;
            lf->setBuddy(d->indexFilterLineEdit);
            d->indexFilterLineEdit->installEventFilter(that);

            layout = new QVBoxLayout(d->indexPanel);
            layout->setMargin(5);
            layout->addWidget(lf);
            layout->addWidget(d->indexFilterLineEdit);
            layout->addWidget(d->indexWidget);

            connect(d->indexWidget, SIGNAL(linkActivated(QUrl,QString)),
                d->helpView, SLOT(showHelp(QUrl)));
            connect(d->indexWidget, SIGNAL(linksActivated(QMap<QString, QUrl>,QString)),
                d->helpView, SLOT(showHelp(QMap<QString, QUrl>,QString)));
            connect(d->helpSearchEngine->resultWidget(), SIGNAL(requestShowLink(QUrl)),
                    d->helpView, SLOT(showHelp(QUrl)));
            connect(d->helpSearchEngine->queryWidget(), SIGNAL(search()),
                    this, SLOT(slotBeginSearch()));
            connect(d->indexFilterLineEdit, SIGNAL(textEdited(const QString&)),
                    d->indexWidget, SLOT(filterIndices(const QString&)));
            connect(d->indexFilterLineEdit, SIGNAL(returnPressed()),
                    d->indexWidget, SLOT(activateCurrentItem()));
            connect(d->contentWidget, SIGNAL(clicked(const QModelIndex&)),
                   this,SLOT(slotContentItemClicked(const QModelIndex&)));
        }

        return d->helpEngine;
    }
Example #20
0
MainWindow::MainWindow( QWidget *parent )
:	QWidget( parent )
,	cardsGroup( new QActionGroup( this ) )
,	quitOnClose( false )
{
	setWindowFlags( Qt::Window|Qt::CustomizeWindowHint|Qt::WindowMinimizeButtonHint|Qt::WindowCloseButtonHint );
	setAttribute( Qt::WA_DeleteOnClose, true );
	setupUi( this );

	cards->hide();
	cards->hack();
	languages->hack();

	Settings s;
	// Mobile
	infoMobileCode->setValidator( new IKValidator( infoMobileCode ) );
	infoMobileCode->setText( s.value( "Client/MobileCode" ).toString() );
	infoMobileCell->setText( s.value( "Client/MobileNumber", "+372" ).toString() );
	connect( infoMobileCode, SIGNAL(textEdited(QString)), SLOT(enableSign()) );
	connect( infoMobileCell, SIGNAL(textEdited(QString)), SLOT(enableSign()) );
	connect( infoSignMobile, SIGNAL(toggled(bool)), SLOT(showCardStatus()) );

	// Buttons
	QButtonGroup *buttonGroup = new QButtonGroup( this );

	buttonGroup->addButton( settings, HeadSettings );
	buttonGroup->addButton( help, HeadHelp );
	buttonGroup->addButton( about, HeadAbout );

	buttonGroup->addButton( homeSign, HomeSign );
	buttonGroup->addButton( homeView, HomeView );
	buttonGroup->addButton( homeCrypt, HomeCrypt );

	introNext = introButtons->addButton( tr( "Next" ), QDialogButtonBox::ActionRole );
	buttonGroup->addButton( introNext, IntroNext );
	buttonGroup->addButton( introButtons->button( QDialogButtonBox::Cancel ), IntroBack );

	signButton = signButtons->addButton( tr("Sign"), QDialogButtonBox::AcceptRole );
	buttonGroup->addButton( signButton, SignSign );
	buttonGroup->addButton( signButtons->button( QDialogButtonBox::Cancel ), SignCancel );

	viewAddSignature = viewButtons->addButton( tr("Add signature"), QDialogButtonBox::ActionRole );
	buttonGroup->addButton( viewAddSignature, ViewAddSignature );
	buttonGroup->addButton( viewButtons->button( QDialogButtonBox::Close ), ViewClose );
	connect( buttonGroup, SIGNAL(buttonClicked(int)),
		SLOT(buttonClicked(int)) );

	connect( infoCard, SIGNAL(linkActivated(QString)), SLOT(parseLink(QString)) );
	connect( cards, SIGNAL(activated(QString)), qApp->signer(), SLOT(selectCard(QString)), Qt::QueuedConnection );
	connect( qApp->signer(), SIGNAL(dataChanged()), SLOT(showCardStatus()) );

	// Digidoc
	doc = new DigiDoc( this );

	// Translations
	lang << "et" << "en" << "ru";
	retranslate();
	QActionGroup *langGroup = new QActionGroup( this );
	for( int i = 0; i < lang.size(); ++i )
	{
		QAction *a = langGroup->addAction( new QAction( langGroup ) );
		a->setData( lang[i] );
		a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_0 + i );
	}
	addActions( langGroup->actions() );
	connect( langGroup, SIGNAL(triggered(QAction*)), SLOT(changeLang(QAction*)) );
	connect( cardsGroup, SIGNAL(triggered(QAction*)), SLOT(changeCard(QAction*)) );

	// Views
	signContentView->setColumnHidden( 2, true );
	viewContentView->setColumnHidden( 3, true );
	connect( signContentView, SIGNAL(remove(unsigned int)),
		SLOT(removeDocument(unsigned int)) );
	connect( viewContentView, SIGNAL(remove(unsigned int)),
		SLOT(removeDocument(unsigned int)) );
}
Example #21
0
MainWindow::MainWindow()
{
    // User interface ----------------------------------------------------------
    if (tr("LTR") == "RTL") {
        qApp->setLayoutDirection(Qt::RightToLeft);
    }
    setupUi(this);
    network_access_manager = new QNetworkAccessManager(this);
    default_printer = NULL;
#ifdef Q_OS_MAC
    this->setUnifiedTitleAndToolBarOnMac(true);
#endif
    progressBar = new QProgressBar(this);
    progressBar->setTextVisible(false);
    progressBar->resize(QSize(30, 10));
    statusBar()->addPermanentWidget(progressBar, 0);
    statusBar()->setFixedHeight(20);
    progressBar->setFixedWidth(150);
    progressBar->setFixedHeight(15);
    progressBar->setVisible(false);
    LQCategoryComboBox->setVisible(false);
    SQStatisticsLabel->setVisible(false);
    currentSvgChanged();
    btnApply = SQButtonBox->button(QDialogButtonBox::Apply);
    btnApply->setText(tr("Apply"));
    btnApply->setStatusTip(tr("Apply any changes you have made to the question"));
    btnApply->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png")));
    btnDiscard = SQButtonBox->button(QDialogButtonBox::Discard);
    btnDiscard->setText(tr("Discard"));
    btnDiscard->setStatusTip(tr("Discard any changes you have made to the question"));
    btnDiscard->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png")));
    SQQuestionTextEdit->setTitle(tr("Question:"));
    SQQuestionTextEdit->textEdit()->setStatusTip(tr("Text of the selected question"));
    ECTextEdit->setTitle(tr("Comments:"));
    ECTextEdit->textEdit()->setStatusTip(tr("Use this field for your comments, notes, reminders..."));
    EFTreeWidget->setMouseTracking(true);
    EFTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Fixed);
    EFTreeWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch);
    EFTreeWidget->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    EFButtonBox->button(QDialogButtonBox::Apply)->setText(tr("Apply"));
    EFButtonBox->button(QDialogButtonBox::Apply)->setStatusTip(tr("Apply any changes you have made to the categories"));
    EFButtonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png")));
    EFButtonBox->button(QDialogButtonBox::Discard)->setText(tr("Discard"));
    EFButtonBox->button(QDialogButtonBox::Discard)->setStatusTip(tr("Discard any changes you have made to the categories"));
    EFButtonBox->button(QDialogButtonBox::Discard)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png")));
    // Initialize variables ----------------------------------------------------
    // URLs
    docs_url = tr("http://itest.sourceforge.net/documentation/%1/en/").arg("1.4");
    // i18n
    QTranslator translator; translator.load(":/i18n/iTest-i18n.qm");
    itest_i18n.insert("English", "en");
    itest_i18n.insert(translator.translate("LanguageNames", "Slovak"), "sk");
    itest_i18n.insert(translator.translate("LanguageNames", "Russian"), "ru");
    itest_i18n.insert(translator.translate("LanguageNames", "Turkish"), "tr");
    itest_i18n.insert(translator.translate("LanguageNames", "Portuguese"), "pt");
    itest_i18n.insert(translator.translate("LanguageNames", "Spanish"), "es");
    itest_i18n.insert(translator.translate("LanguageNames", "Italian"), "it");
    itest_i18n.insert(translator.translate("LanguageNames", "Latvian"), "lv");
    itest_i18n.insert(translator.translate("LanguageNames", "Ukrainian"), "uk");
    itest_i18n.insert(translator.translate("LanguageNames", "Czech"), "cs");
    itest_i18n.insert(translator.translate("LanguageNames", "Hungarian"), "hu");
    itest_i18n.insert(translator.translate("LanguageNames", "German"), "de");
    // CURRENT_DB
    current_db_open = false;
    current_db_session = NULL;
    current_db_class = NULL;
    current_db_categories.resize(20);
    current_db_categories_enabled.resize(20);
    // Connect slots -----------------------------------------------------------
    tbtnAddQuestion->setDefaultAction(actionAdd);
    tbtnDuplicateQuestion->setDefaultAction(actionDuplicate);
    tbtnDeleteQuestion->setDefaultAction(actionDelete);
    QObject::connect(actionAdd, SIGNAL(triggered()), this, SLOT(addQuestion()));
    QObject::connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteQuestion()));
    QObject::connect(actionDuplicate, SIGNAL(triggered()), this, SLOT(duplicateQuestion()));
    QObject::connect(btnApply, SIGNAL(released()), this, SLOT(applyQuestionChanges()));
    QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(applyQuestionChanges()));
    QObject::connect(btnDiscard, SIGNAL(released()), this, SLOT(discardQuestionChanges()));
    QObject::connect(actionDiscard, SIGNAL(triggered()), this, SLOT(discardQuestionChanges()));

    QObject::connect(actionNew, SIGNAL(triggered()), this, SLOT(newDB()));
    QObject::connect(btnNew, SIGNAL(released()), this, SLOT(newDB()));
    QObject::connect(actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    QObject::connect(btnOpenOther, SIGNAL(released()), this, SLOT(open()));
    QObject::connect(btnOpenSelected, SIGNAL(released()), this, SLOT(openRecent()));
    QObject::connect(actionSave, SIGNAL(triggered()), this, SLOT(save()));
    QObject::connect(actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
    QObject::connect(actionSave_a_copy, SIGNAL(triggered()), this, SLOT(saveCopy()));
    QObject::connect(actionExport_CSV, SIGNAL(triggered()), this, SLOT(exportCSV()));
    QObject::connect(actionClose, SIGNAL(triggered()), this, SLOT(closeDB()));
    QObject::connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
    QObject::connect(actionAbout, SIGNAL(triggered()), this, SLOT(about()));

    QObject::connect(recentDBsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(openRecent(QListWidgetItem *)));
    QObject::connect(LQListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(setCurrentQuestion()));

    QObject::connect(actionFrom_A_to_Z, SIGNAL(triggered()), this, SLOT(sortQuestionsAscending()));
    QObject::connect(actionFrom_Z_to_A, SIGNAL(triggered()), this, SLOT(sortQuestionsDescending()));
    QObject::connect(actionBy_category, SIGNAL(triggered()), this, SLOT(sortQuestionsByCategory()));

    tbtnAddSVG->setDefaultAction(actionAdd_SVG);
    tbtnRemoveSVG->setDefaultAction(actionRemove_SVG);
    tbtnEditSVG->setDefaultAction(actionEdit_SVG);
    tbtnExportSVG->setDefaultAction(actionExport_SVG);
    QObject::connect(actionAdd_SVG, SIGNAL(triggered()), this, SLOT(addSvg()));
    QObject::connect(actionRemove_SVG, SIGNAL(triggered()), this, SLOT(removeSvg()));
    QObject::connect(actionEdit_SVG, SIGNAL(triggered()), this, SLOT(editSvg()));
    QObject::connect(actionExport_SVG, SIGNAL(triggered()), this, SLOT(exportSvg()));
    QObject::connect(SQSVGListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(previewSvg(QListWidgetItem *)));
    QObject::connect(SQSVGListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(currentSvgChanged()));

    tbtnMoveUp->setDefaultAction(actionMove_up);
    tbtnMoveDown->setDefaultAction(actionMove_down);
    QObject::connect(actionMove_up, SIGNAL(triggered()), this, SLOT(moveUp()));
    QObject::connect(actionMove_down, SIGNAL(triggered()), this, SLOT(moveDown()));
    QObject::connect(actionMove_to_top, SIGNAL(triggered()), this, SLOT(moveToTop()));
    QObject::connect(actionMove_to_bottom, SIGNAL(triggered()), this, SLOT(moveToBottom()));
    QObject::connect(actionHide, SIGNAL(triggered()), this, SLOT(hideQuestion()));
    QObject::connect(actionShow_hidden, SIGNAL(triggered()), this, SLOT(filterLQSearch()));

    rbtngrpFilterLQ = new QButtonGroup(this);
    rbtngrpFilterLQ->addButton(LQAllRadioButton);
    rbtngrpFilterLQ->addButton(LQEasyRadioButton);
    rbtngrpFilterLQ->addButton(LQMediumRadioButton);
    rbtngrpFilterLQ->addButton(LQDifficultRadioButton);
    rbtngrpFilterLQ->addButton(LQCategoryRadioButton);

    actgrpFilterLQ = new QActionGroup(this);
    actgrpFilterLQ->addAction(actionShow_all);
    actgrpFilterLQ->addAction(actionShow_easy);
    actgrpFilterLQ->addAction(actionShow_medium);
    actgrpFilterLQ->addAction(actionShow_difficult);
    actgrpFilterLQ->addAction(actionShow_category);

    QObject::connect(rbtngrpFilterLQ, SIGNAL(buttonReleased(QAbstractButton *)), this, SLOT(filterLQ(QAbstractButton *)));
    QObject::connect(actgrpFilterLQ, SIGNAL(triggered(QAction *)), this, SLOT(filterLQAction(QAction *)));
    QObject::connect(LQCategoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterLQCategoryChanged()));
    QObject::connect(LQSearchLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterLQSearch()));
    QObject::connect(tbtnSearchByGroup, SIGNAL(released()), this, SLOT(searchByGroup()));

    actgrpPage = new QActionGroup(this);
    actgrpPage->addAction(actionEdit_questions);
    actgrpPage->addAction(actionEdit_comments);
    actgrpPage->addAction(actionEdit_categories);
    actgrpPage->addAction(actionEdit_test);
    actgrpPage->addAction(actionSaved_sessions);
    actgrpPage->addAction(actionEdit_classes);

    QObject::connect(actgrpPage, SIGNAL(triggered(QAction *)), this, SLOT(setPage(QAction *)));

    //QObject::connect(btnApply, SIGNAL(released()), this, SLOT(setDatabaseModified()));
    //QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(setDatabaseModified()));
    QObject::connect(ECTextEdit, SIGNAL(textChanged()), this, SLOT(setDatabaseModified()));

    QObject::connect(actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates()));
    QObject::connect(network_access_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(httpRequestFinished(QNetworkReply *)));
    QObject::connect(actionDocumentation, SIGNAL(triggered()), this, SLOT(openDocumentation()));
    QObject::connect(SQStatisticsLabel, SIGNAL(linkActivated(QString)), this, SLOT(adjustQuestionDifficulty()));
    QObject::connect(actionPrint_questions, SIGNAL(triggered()), this, SLOT(showPrintQuestionsDialogue()));
    QObject::connect(actionOverall_statistics, SIGNAL(triggered()), this, SLOT(overallStatistics()));
    QObject::connect(actionChange_language, SIGNAL(triggered()), this, SLOT(changeLanguage()));

    QObject::connect(mainStackedWidget, SIGNAL(currentChanged(int)), this, SLOT(currentPageChanged(int)));
    // Disable all -------------------------------------------------------------
    setAllEnabled(false);
    // Categories -------------------------------------------------------------------
    setupCategoriesPage();
    // Server ------------------------------------------------------------------
    setupServer();
    // Session viewer ----------------------------------------------------------
    setupSessionViewer();
    // Class viewer ------------------------------------------------------------
    setupClassViewer();
    // -------------------------------------------------------------------------
#ifdef Q_OS_MAC
    show();
#endif
    // Load settings -----------------------------------------------------------
    loadSettings();
    // Ready -------------------------------------------------------------------
    statusBar()->showMessage(tr("Ready"), 10000);
    // Check app args ----------------------------------------------------------
    if (qApp->arguments().count() > 1) {
        openFile(qApp->arguments().at(1));
    }
    // -------------------------------------------------------------------------
#ifndef Q_OS_MAC
    show();
#endif
}
void AssetManagerWindow::addasset_slot(){
    //Decide if we should init and show, or just show
    if(mc_assetmanager_addasset_dialog_already_init == 0){
        //Init, then show.
        mc_asset_manager_addasset_dialog = new QDialog(0);
        mc_asset_manager_addasset_dialog->setWindowTitle("Add Asset Contract | Moneychanger");
        mc_asset_manager_addasset_dialog->setModal(1);
        
        //Gridlayout
        mc_asset_manager_addasset_gridlayout = new QGridLayout(0);
        mc_asset_manager_addasset_dialog->setLayout(mc_asset_manager_addasset_gridlayout);
        
        //Label (header)
        mc_asset_manager_addasset_header = new QLabel("<h2>Add Asset Contract</h2>",0);
        mc_asset_manager_addasset_gridlayout->addWidget(mc_asset_manager_addasset_header, 0,0, 1,1, Qt::AlignRight);
        
        //Label (Show Advanced Option(s)) (Also a button/connection)
        mc_asset_manager_addasset_subheader_toggleadvanced_options_label = new QLabel("<a href='#'>Advanced Option(s)</a>", 0);
        mc_asset_manager_addasset_gridlayout->addWidget(mc_asset_manager_addasset_subheader_toggleadvanced_options_label, 1,0, 1,1, Qt::AlignRight);
        //Connect with a re-action
        connect(mc_asset_manager_addasset_subheader_toggleadvanced_options_label, SIGNAL(linkActivated(QString)), this, SLOT(dialog_showadvanced_slot(QString)));
        
        
        //Label (instructions)
        mc_asset_manager_addasset_subheader_instructions = new QLabel("Below are some options that will help determine how your Asset will be added.");
        mc_asset_manager_addasset_subheader_instructions->setWordWrap(1);
        mc_asset_manager_addasset_subheader_instructions->setStyleSheet("QLabel{padding:0.5em;}");
        mc_asset_manager_addasset_gridlayout->addWidget(mc_asset_manager_addasset_subheader_instructions, 2,0, 1,1);
        
        //Label (Choose Source Question)
        mc_asset_manager_addasset_choosesource_label = new QLabel("<h3>Enter the Asset Contract</h3>");
        mc_asset_manager_addasset_choosesource_label->setStyleSheet("QLabel{padding:1em;}");
        mc_asset_manager_addasset_gridlayout->addWidget(mc_asset_manager_addasset_choosesource_label, 3,0, 1,1);
        
        //Combobox (Dropdown box: Choose Source)
        mc_asset_manager_addasset_choosesource_answer_selection = new QComboBox(0);
        mc_asset_manager_addasset_choosesource_answer_selection->addItem("Namecoin");
        mc_asset_manager_addasset_choosesource_answer_selection->addItem("No-Source");
        mc_asset_manager_addasset_choosesource_answer_selection->setCurrentIndex(1);
        mc_asset_manager_addasset_choosesource_answer_selection->setStyleSheet("QComboBox{padding:0.5em;}");
        mc_asset_manager_addasset_gridlayout->addWidget(mc_asset_manager_addasset_choosesource_answer_selection, 4,0, 1,1);
        
        //Create asset (button)
        mc_asset_manager_addasset_create_asset_btn = new QPushButton("Add an Asset Contract", 0);
        mc_asset_manager_addasset_create_asset_btn->setStyleSheet("QPushButton{padding:1em;}");
        mc_asset_manager_addasset_gridlayout->addWidget(mc_asset_manager_addasset_create_asset_btn, 5,0, 1,1, Qt::AlignHCenter);
        //Connect create asset button with a re-action;
        connect(mc_asset_manager_addasset_create_asset_btn, SIGNAL(clicked()), this, SLOT(dialog_createasset_slot()));
        
        /** Flag as already init **/
        mc_assetmanager_addasset_dialog_already_init = 1;
    }
    //Resize
    mc_asset_manager_addasset_dialog->resize(400, 300);
    //Show
    mc_asset_manager_addasset_dialog->show();
}
Example #23
0
    /**
     * @brief Creates dialog
     */
    ConnectionsDialog::ConnectionsDialog(SettingsManager *settingsManager) : QDialog()
    {
        setWindowIcon(GuiRegistry::instance().connectIcon());
        setWindowTitle("MongoDB Connections");

        // Remove help button (?)
        setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

        _settingsManager = settingsManager;
        VERIFY(connect(_settingsManager, SIGNAL(connectionAdded(ConnectionSettings *)), this, SLOT(add(ConnectionSettings*))));
        VERIFY(connect(_settingsManager, SIGNAL(connectionUpdated(ConnectionSettings *)), this, SLOT(update(ConnectionSettings*))));
        VERIFY(connect(_settingsManager, SIGNAL(connectionRemoved(ConnectionSettings *)), this, SLOT(remove(ConnectionSettings*))));

        QAction *addAction = new QAction("&Add", this);
        VERIFY(connect(addAction, SIGNAL(triggered()), this, SLOT(add())));

        QAction *editAction = new QAction("&Edit", this);
        VERIFY(connect(editAction, SIGNAL(triggered()), this, SLOT(edit())));

        QAction *cloneAction = new QAction("&Clone", this);
        VERIFY(connect(cloneAction, SIGNAL(triggered()), this, SLOT(clone())));

        QAction *removeAction = new QAction("&Remove", this);
        VERIFY(connect(removeAction, SIGNAL(triggered()), this, SLOT(remove())));

        _listWidget = new ConnectionsTreeWidget;
        GuiRegistry::instance().setAlternatingColor(_listWidget);
        _listWidget->setIndentation(5);

        QStringList colums;
        colums << "Name" << "Address" << "Auth. Database / User";
        _listWidget->setHeaderLabels(colums);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        _listWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch);
        _listWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch);
        _listWidget->header()->setSectionResizeMode(2, QHeaderView::Stretch);
#endif
        //_listWidget->setViewMode(QListView::ListMode);
        _listWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
        _listWidget->addAction(addAction);
        _listWidget->addAction(editAction);
        _listWidget->addAction(cloneAction);
        _listWidget->addAction(removeAction);
        _listWidget->setSelectionMode(QAbstractItemView::SingleSelection); // single item can be draged or droped
        _listWidget->setDragEnabled(true);
        _listWidget->setDragDropMode(QAbstractItemView::InternalMove);
        _listWidget->setMinimumHeight(300);
        _listWidget->setMinimumWidth(630);
        VERIFY(connect(_listWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(accept())));
        VERIFY(connect(_listWidget, SIGNAL(layoutChanged()), this, SLOT(listWidget_layoutChanged())));

        QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
        buttonBox->button(QDialogButtonBox::Save)->setIcon(GuiRegistry::instance().serverIcon());
        buttonBox->button(QDialogButtonBox::Save)->setText("C&onnect");
        VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())));
        VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())));

        QHBoxLayout *bottomLayout = new QHBoxLayout;
        bottomLayout->addWidget(buttonBox);

        QLabel *intro = new QLabel(
            "<a href='create'>Create</a>, "
            "<a href='edit'>edit</a>, <a href='remove'>remove</a>, <a href='clone'>clone</a> or reorder connections via drag'n'drop.");
        intro->setWordWrap(true);
        VERIFY(connect(intro, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString))));

        QVBoxLayout *firstColumnLayout = new QVBoxLayout;
        firstColumnLayout->addWidget(intro);
        firstColumnLayout->addWidget(_listWidget, 1);
        firstColumnLayout->addLayout(bottomLayout);

        QHBoxLayout *mainLayout = new QHBoxLayout(this);
        mainLayout->addLayout(firstColumnLayout, 1);

        // Populate list with connections
        QList<ConnectionSettings *> connections = _settingsManager->connections();
        for (QList<ConnectionSettings *>::iterator it = connections.begin(); it != connections.end(); ++it) {
            ConnectionSettings *connectionModel = *it;
            add(connectionModel);
        }

        // Highlight first item
        if (_listWidget->topLevelItemCount() > 0)
            _listWidget->setCurrentItem(_listWidget->topLevelItem(0));

        _listWidget->setFocus();
    }
Example #24
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    logFile = NULL;
    logIndex = 0;
    process = NULL;
    triggerCount = 0;
    volumeMeterWidget = NULL;

    QCoreApplication::setOrganizationName("VU Meter");
    QCoreApplication::setOrganizationDomain("https://garage.maemo.org/projects/vumeter");
    QCoreApplication::setApplicationName("VU Meter");

    QSettings settings;
    meter = settings.value(SettingsDialog::METER,
                           SettingsDialog::METER_DEFAULT).toInt();
    interpolationLevel = settings.value(SettingsDialog::INTERPOLATION_LEVEL,
                                        SettingsDialog::INTERPOLATION_LEVEL_DEFAULT).toInt();

    ui->setupUi(this);

    adapter = new PulseAudioAdapter();

    changeMeter();
    setDbScale();

    ui->currentVolume->setNum(0);
    ui->maximumVolume->setNum(0);

#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
    sources = new QStringList();
    sources->append("Microphone");
    sources->append("Bluetooth");
    sources->append("Monitor");
#else
    sources = adapter->getAvailableSources();
#endif
    ui->sourcesComboBox->addItems(*sources);

    /*
#ifdef Q_WS_MAEMO_5
    ui->sourcesComboBox->setEditable(true);
    ui->sourcesComboBox->lineEdit()->setAlignment(Qt::AlignHCenter);
    ui->sourcesComboBox->lineEdit()->setReadOnly(true);
#endif
    */

    connect(ui->sourcesComboBox, SIGNAL(activated(int)), this, SLOT(sourceChanged(int)));

#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
    adapter->connectAudioStream("source.hw0");
    //connect_to_vu_meter_stream("source.hw0", this, pow(2, interpolationLevel));
#else
    adapter->connectAudioStream(sources->at(0));
//    connect_to_vu_meter_stream(sources->at(0).toLocal8Bit().constData(), this, pow(2, interpolationLevel));
#endif

    connect(adapter, SIGNAL(audioDataReceived(float)), this, SLOT(updateValues(float)), Qt::QueuedConnection);
    connect(ui->maxLabel, SIGNAL(linkActivated(QString)), this, SLOT(resetMaxValue()));

    connect(ui->radioButtonDb, SIGNAL(clicked()), this, SLOT(setDbScale()));
    connect(ui->radioButtonLinear, SIGNAL(clicked()), this, SLOT(setLinearScale()));

    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settingsDialog()));
}
StreamPostWidget::StreamPostWidget(DATA::FbStreamPost *post, QWidget *parent) :
    QWidget(parent),
    m_post(post),
    m_triedBothIcons(false)
{



    m_nam = new QNetworkAccessManager(this);
    connect(m_nam,SIGNAL(finished(QNetworkReply*)),
            this, SLOT(gotNetworkReply(QNetworkReply*)));

    //this->setStyleSheet("background : white;");
    this->setAutoFillBackground(true);
    QPalette palette = this->palette();
    palette.setColor(QPalette::Background, Qt::white);
    setPalette(palette);


    QHBoxLayout *mainLayout = new QHBoxLayout();
    QFrame *f = new QFrame();
    f->setMinimumWidth(10);
    f->setFrameShape(QFrame::VLine);
    mainLayout->insertWidget(1,f);
    mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
    m_contentLayout = new QVBoxLayout();
    m_contentLayout->setSizeConstraint(QLayout::SetMinimumSize);

    if (post->isFromUser())
        this->setWindowTitle(post->getPoster().getName());
    else
        this->setWindowTitle(post->getPage().getName());

    if (post->getMessage() != "" || (post->getTargetId().compare("") != 0))
    {
        QLabel *message = new QLabel();
        QString text = post->getMessage();
        if (post->getTargetId().compare("") != 0)
            text.prepend("-> " + post->getTarget().getName() + ": ");
        message->setText(UTIL::hyperLink(text));
        message->setTextInteractionFlags(Qt::TextBrowserInteraction);
        message->setWordWrap(true);
        message->setMinimumWidth(450);
        message->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        connect(message, SIGNAL(linkActivated(QString)),
                this, SIGNAL(contentClicked(QString)));
        m_contentLayout->addWidget(message,0,Qt::AlignTop);
    }


    QString ageHtml = "<style type=\"text/css\">a { text-decoration: none; }</style>"
                      "<font style=\"font-size : 8pt;\">" +
                      UTIL::ageString(post->getCreatedTime()) + " ";
    if (post->getAttribution() != "" && !post->getAttribution().startsWith("via"))
        ageHtml.append("via ");
    ageHtml.append(post->getAttribution() + "</font>");

    QLabel *age = new QLabel(ageHtml);
    m_ageLineLayout = new QHBoxLayout();
    m_ageLineLayout->insertWidget(1,age,1);

    // Get the app icon, prefer the one in attachment if present
    if (post->getAttachment()->getIcon().toString() != "")
    {
        QNetworkRequest nr;
        nr.setUrl(post->getAttachment()->getIcon());
        QNetworkReply *reply = m_nam->get(nr);
        m_outstandingNetworkRequests.insert(reply, AppIcon);
    }
    else if (m_post->getAppInfo().getIconUrl() != "")
    {
        m_triedBothIcons = true;
        QNetworkRequest nr;
        nr.setUrl(QUrl(m_post->getAppInfo().getIconUrl()));
        QNetworkReply *reply = m_nam->get(nr);
        m_outstandingNetworkRequests.insert(reply, AppIcon);
    }



    if (!post->getAttachment()->isEmpty())
    {
        DATA::FbStreamAttachment *attachment = post->getAttachment();
        FbAttachmentWidget *aw = new FbAttachmentWidget(attachment);
        aw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        connect(aw, SIGNAL(userClickedUrl(QString)),
                this, SIGNAL(contentClicked(QString)));
        m_contentLayout->addWidget(aw);
    }

    m_contentLayout->addLayout(m_ageLineLayout,0);
    m_contentLayout->addStretch();
    m_contentLayout->addSpacing(10);


    GUI::FbCommentManager *manager = new FbCommentManager(m_post->getPostId(),
                                                          FbCommentManager::PostId,
                                                          m_post->getCommentList()->canRemove());
    manager->setMaximumHeight(400);

    QString fbObjectId = m_post->getPostId();
    GUI::FbLikeManager *likeManager = new FbLikeManager(fbObjectId, m_post->userLikes());
    connect(likeManager, SIGNAL(userChangedLike(bool)),
            this, SLOT(likeChanged(bool)));

    QHBoxLayout *hLayout = new QHBoxLayout();
    m_showAddCommentButton = new QToolButton();
    m_showAddCommentButton->setAutoFillBackground(true);
    palette = m_showAddCommentButton->palette();
    palette.setColor(QPalette::Button,QColor(82,110,166));
    m_showAddCommentButton->setPalette(palette);
    m_showAddCommentButton->setIcon(QIcon(":/uiImages/addComment_50_50.jpg"));
    m_showAddCommentButton->setIconSize(QSize(40,40));
    m_showAddCommentButton->setToolTip("Comment");
    connect(m_showAddCommentButton, SIGNAL(clicked()),
            manager, SLOT(showAddComment()));
    hLayout->addWidget(m_showAddCommentButton,0);

    m_likeButton = new QToolButton();
    this->likeChanged(m_post->userLikes());
    m_likeButton->setIconSize(QSize(40,40));

    connect(m_likeButton, SIGNAL(clicked()),
            likeManager, SLOT(toggleUserLikes()));
    hLayout->addWidget(m_likeButton,0);
    hLayout->addStretch(1);

    m_contentLayout->addLayout(hLayout,0);
    m_contentLayout->addWidget(likeManager,0);
    m_contentLayout->addWidget(manager,2);

    //manager->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
    mainLayout->insertLayout(2,m_contentLayout,1);
    setLayout(mainLayout);


    getPosterPixmap();

    QDesktopWidget *dw = QApplication::desktop();
    QRect r = dw->screenGeometry();
    move(r.width() - 240, 40);


}
Example #26
0
SetupDialog::SetupDialog(QWidget *parent) :
    QDialog(parent),
    _ui(new Ui::SetupDialog),
    _loadingAnimation(":/resources/icons/loading.gif"),
    _haveKey(false)
{
    _ui->setupUi(this);

    _ui->loadingIconLabel->setMovie(&_loadingAnimation);
    _ui->advancedPageRadioButton->hide();
    _ui->errorLabel->hide();
    _ui->machineKeyLabel->hide();
    _ui->machineKeyLineEdit->hide();
    _ui->locateMachineKeyLabel->hide();

    connect(_ui->welcomePageRadioButton, SIGNAL(clicked()), this, SLOT(skipToPage()));
    connect(_ui->restorePageRadioButton, SIGNAL(clicked()), this, SLOT(skipToPage()));
    connect(_ui->advancedPageRadioButton, SIGNAL(clicked()), this, SLOT(skipToPage()));
    connect(_ui->registerAccountPageRadioButton, SIGNAL(clicked()), this, SLOT(skipToPage()));
    connect(_ui->donePageRadioButton, SIGNAL(clicked()), this, SLOT(skipToPage()));

    connect(_ui->wizardStackedWidget, SIGNAL(currentChanged(int)), this, SLOT(wizardPageChanged(int)));

    // Welcome page
    connect(_ui->advancedSetupCheckBox, SIGNAL(toggled(bool)), _ui->advancedPageRadioButton, SLOT(setVisible(bool)));
    connect(_ui->welcomePageSkipButton, &QPushButton::clicked, [=](){commitSettings(true);});
    connect(_ui->welcomePageProceedButton, SIGNAL(clicked()), this, SLOT(setNextPage()));

    // Advanced setup page
    connect(_ui->tarsnapPathBrowseButton, SIGNAL(clicked()), this, SLOT(showTarsnapPathBrowse()));
    connect(_ui->tarsnapPathLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateAdvancedSetupPage()));
    connect(_ui->tarsnapCacheBrowseButton, SIGNAL(clicked()), this, SLOT(showTarsnapCacheBrowse()));
    connect(_ui->tarsnapCacheLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateAdvancedSetupPage()));
    connect(_ui->appDataBrowseButton, SIGNAL(clicked()), this, SLOT(showAppDataBrowse()));
    connect(_ui->appDataPathLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateAdvancedSetupPage()));
    connect(_ui->advancedPageProceedButton, SIGNAL(clicked()), this, SLOT(setNextPage()));

    // Restore page
    connect(_ui->restoreNoButton, SIGNAL(clicked()), this, SLOT(restoreNo()));
    connect(_ui->restoreYesButton, SIGNAL(clicked()), this, SLOT(restoreYes()));

    // Register page
    connect(_ui->tarsnapUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateRegisterPage()));
    connect(_ui->tarsnapPasswordLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateRegisterPage()));
    connect(_ui->machineNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateRegisterPage()));
    connect(_ui->machineKeyLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validateRegisterPage()));
    connect(_ui->locateMachineKeyLabel, SIGNAL(linkActivated(QString)), this, SLOT(registerHaveKeyBrowse(QString)));
    connect(_ui->registerMachineButton, SIGNAL(clicked()), this, SLOT(registerMachine()));

    // Done page
    connect(_ui->doneButton, SIGNAL(clicked()), this, SLOT(commitSettings()));

#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
    _appDataDir = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
#else
    _appDataDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#endif
    QDir keysDir(_appDataDir);
    if(!keysDir.exists())
        keysDir.mkpath(_appDataDir);
    _ui->appDataPathLineEdit->setText(_appDataDir);

    _tarsnapCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
    QDir cacheDir(_tarsnapCacheDir);
    if(!cacheDir.exists())
        cacheDir.mkpath(_tarsnapCacheDir);
    _ui->tarsnapCacheLineEdit->setText(_tarsnapCacheDir);

    _tarsnapCLIDir = Utils::findTarsnapClientInPath("", true);
    _ui->tarsnapPathLineEdit->setText(_tarsnapCLIDir);
    _ui->machineNameLineEdit->setText(QHostInfo::localHostName());
    _ui->wizardStackedWidget->setCurrentWidget(_ui->welcomePage);
}
void GraphicalTimetableLine::init()
{
    if ( !m_svg.hasElement("background") ) {
        setFailedToLaunch( true, i18n("No 'background' element found in the SVG") );
    }

    m_zoomInButton = new Plasma::ToolButton( this );
    m_zoomOutButton = new Plasma::ToolButton( this );
    m_zoomInButton->setIcon( KIcon("zoom-in") );
    m_zoomOutButton->setIcon( KIcon("zoom-out") );
    m_zoomInButton->setZValue( 999999 );
    m_zoomOutButton->setZValue( 999999 );
    connect( m_zoomInButton, SIGNAL(clicked()), this, SLOT(zoomIn()) );
    connect( m_zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomOut()) );

    m_title = new Plasma::Label( this );
    QFont font = Plasma::Theme::defaultTheme()->font( Plasma::Theme::DefaultFont );
    font.setPixelSize( 14 );
    font.setBold( true );
    m_title->setFont( font );
    m_title->setWordWrap( false );
    m_title->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
    m_title->setZValue( 999999 );

    m_courtesy = new Plasma::Label;
    m_courtesy->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    connect( m_courtesy, SIGNAL(linkActivated(QString)),
                KToolInvocation::self(), SLOT(invokeBrowser(QString)) );
    QLabel *labelInfo = m_courtesy->nativeWidget();
    labelInfo->setOpenExternalLinks( true );
    labelInfo->setWordWrap( true );
    m_courtesy->setText( courtesyText() );
    m_courtesy->setZValue( 999999 );

    m_departureView = new QGraphicsWidget( this );
    m_departureView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    m_departureView->translate( 0, -m_title->size().height() - 25 );

    QGraphicsGridLayout *l = new QGraphicsGridLayout( this );
    l->addItem( m_zoomInButton, 0, 0 );
    l->addItem( m_zoomOutButton, 0, 1 );
    l->addItem( m_title, 0, 2 );
    l->addItem( m_departureView, 1, 0, 1, 3 );
    l->addItem( m_courtesy, 2, 0, 1, 3 );

    m_stopSettings.set( ServiceProviderSetting,
                        config().readEntry(QLatin1String("serviceProvider"), QString()) );
    m_stopSettings.set( StopNameSetting,
                        config().readEntry(QLatin1String("stopName"), QString()) );

    m_timelineLength = config().readEntry( QLatin1String("timelineLength"), 10 );
    m_showTimetable = config().readEntry( QLatin1String("showTimetable"), true );
    m_drawTransportLine = config().readEntry( QLatin1String("drawTransportLine"), true );

    QVariantList vehicleTypes = config().readEntry( QLatin1String("vehicleTypes"), QVariantList() );
    if ( vehicleTypes.isEmpty() ) {
        m_vehicleTypes << UnknownVehicleType << Tram << Bus << TrolleyBus << InterurbanTrain
                << Subway << Metro << RegionalTrain << RegionalExpressTrain << InterregionalTrain
                << IntercityTrain << HighSpeedTrain << Ship << Plane << Feet;
    } else {
        foreach ( const QVariant &vehicleType, vehicleTypes ) {
            m_vehicleTypes << static_cast<VehicleType>( vehicleType.toInt() );
        }
    }

    if ( m_stopSettings.stopList().isEmpty() ) {
        setConfigurationRequired( true, i18n("Please select a stop name") );
    } else if ( m_stopSettings.get<QString>(ServiceProviderSetting).isEmpty() ) {
        setConfigurationRequired( true, i18n("Please select a service provider") );
    } else {
        setConfigurationRequired( false );
    }

    if ( !configurationRequired() ) {
        m_sourceName = QString("Departures %1|stop=%2|timeoffset=0")
                    .arg(m_stopSettings.get<QString>(ServiceProviderSetting))
                    .arg(m_stopSettings.stop(0).nameOrId());
        dataEngine("publictransport")->connectSource( m_sourceName,
                this, 60000, Plasma::AlignToMinute );
    }

    createTooltip();
}
PackageDetails::PackageDetails(OCI::Package *package,int count, int packagecount, QObject *parent )
{
    setObjectName( "pk" );
    setStyleSheet( "#pk{background-color : white; border : 1px solid rgb(196,181,147);}");
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setSpacing( 0 );
    QHBoxLayout *packageLayout = new QHBoxLayout;

    m_packageMetadata = new PackageMetadata();
    m_packageMetadata->getData( package->name() );
    

    m_summary = new QLabel( i18n("<b>Summary:</b> %1").arg(package->summary()) );
    m_fetchingAnimation.setFileName("/usr/share/one-click-installer/res/ticks-endless.gif");
    m_version = new QLabel( i18n("Fetching...") );
    m_size = new QLabel( i18n("Fetching...") );
    if (m_fetchingAnimation.isValid()) {
       m_version->setMovie(&m_fetchingAnimation);
       m_size->setMovie(&m_fetchingAnimation);
       m_fetchingAnimation.start();
    };

    QObject::connect( m_packageMetadata, SIGNAL( finished( QString,QString ) ), this, SLOT( dataChanged( QString,QString ) ) );

     m_showDescription = new QLabel( QString( "<a href = \"%1\">%2</a>" ).arg( count ).arg( i18n("Show Details") ));
    m_showDescription->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
    m_description = new QLabel( QString( "%1" ).arg( package->description() ) );
    m_description->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );

    m_descriptionVisible = false;

    QObject::connect( m_showDescription, SIGNAL( linkActivated( QString ) ), this, SLOT( showPackageDescription( QString ) ) );

    m_size->setStyleSheet( "background-color : white;  padding-left : 3px;" );
    m_size->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
    m_version->setStyleSheet( "background-color : white; padding-left : 3px;" );
    m_version->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
    m_summary->setStyleSheet( "background-color : white; border-left : 1px solid rgb(196,181,147); border-right : 1px solid rgb(196,181,147); padding-left : 3px; border-bottom : 1px solid rgb(196,181,147);" );
    m_summary->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
    m_showDescription->setStyleSheet( "background-color : white;border-right : 1px solid rgb(196,181,147); " );
    m_showDescription->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
    m_description->setStyleSheet( "background-color : white; border-bottom : 1px solid rgb(196,181,147); border-left : 1px solid rgb(196,181,147); border-right : 1px solid rgb(196,181,147);" );
    m_description->setContentsMargins( 10, 10, 10, 10 );
    m_description->setWordWrap( true );

    if( packagecount == 1 ) {
        m_singlePackage = new QLabel( package->name() );
        m_singlePackage->setStyleSheet( "background-color : white; border-left : 1px solid rgb(196,181,147);" );
        m_singlePackage->setContentsMargins( 10, 10, 10, 10 );
        m_singlePackage->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
        packageLayout->addWidget( m_singlePackage );
    } else {
        m_packageName = new QCheckBox( package->name() );
        m_packageName->setChecked( true );
        m_packageName->setContentsMargins( 10, 10, 10, 10 );
        m_packageName->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Expanding );
        m_packageName->setStyleSheet( "background-color : white; border-left : 1px solid rgb(196,181,147); padding-left : 3px;" );
        QObject::connect( m_packageName, SIGNAL( toggled( bool ) ), this, SIGNAL( installableStateToggled( bool )  ) );
        packageLayout->addWidget( m_packageName );
    }
    
    packageLayout->addWidget( m_version );
    packageLayout->addWidget( m_size );
    packageLayout->addWidget( m_showDescription );
    mainLayout->addLayout( packageLayout );
    mainLayout->addWidget( m_summary );
    setLayout( mainLayout );
}
Example #29
0
loginFrame::loginFrame(QTcpSocket *socket,QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::loginFrame)
{
    ui->setupUi(this);
    aboutDlg = new aboutDialog();
    connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(loginSlot()));
    this->socket = socket;
    connect(ui->label_4,SIGNAL(linkActivated(QString)),this,SLOT(showRegisterDlg()));
    connect(socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error()));
    errorBox = new QMessageBox(this);
    connect(ui->comboBox,SIGNAL(activated(int)),this,SLOT(setSelectedText(int)));
    connect(ui->comboBox,SIGNAL(highlighted(int)),this,SLOT(showSelectedItem(int)));
    ui->comboBox_2->view()->setFixedWidth(50);
    connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(showSettingPanel()));
    //右键菜单
    ui->comboBox->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->comboBox,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showContextMenu(QPoint)));
    menu = new QMenu(ui->comboBox);
    deleteAction = menu->addAction(QIcon(":/images/no.jpg")
                                            ,QString::fromLocal8Bit("删除账号信息"));
    selectAction = menu->addAction(QIcon(":/images/yes.jpg")
                                            ,QString::fromLocal8Bit("选择账号"));
    connect(deleteAction,SIGNAL(triggered(bool)),this,SLOT(deleteUserInfo()));
    connect(selectAction,SIGNAL(triggered(bool)),this,SLOT(selectUserInfo()));
    //变量初始化
    this->isAutoLogin = false;
    this->isSavePassword = false;
    connect(ui->checkBox_password,SIGNAL(stateChanged(int)),this,SLOT(setSavePassword(int)));
    connect(ui->checkBox_autoLogin,SIGNAL(stateChanged(int)),this,SLOT(setAutoLogin(int)));
//    connect(ui->comboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(autoWritePasw(int)));
    connect(ui->comboBox->lineEdit(),SIGNAL(textChanged(QString)),this,SLOT(setEditState()));
    this->isauto = false;
    readRegistryData();
    timer = new QTimer();
    timer->setInterval(1000);
    timer->setSingleShot(true);
    //如果在构造函数未完成就直接登录,会发生异常,所以等构造完一段时间后再自动登录
    connect(timer,SIGNAL(timeout()),this,SLOT(autoLogin()));
    timer->start();
    //背景
    this->setWindowFlags(Qt::FramelessWindowHint);
    QPixmap pixmap(":/images/about_Back.png");
    QPixmap pixmap2 = pixmap.scaled(this->size());
    QPalette palette;
    palette.setBrush(this->backgroundRole(),QBrush(pixmap2) );
    this->setPalette(palette);
    this->setMask(pixmap2.mask());
    this->setAutoFillBackground(true);
    this->setMouseTracking(true);
    //最小化和关闭按钮
    ui->pushButton_min->setStyleSheet(
            "QPushButton { background-image: url(:/images/min.bmp); }"
            "QPushButton:hover { background-image: url(:/images/min_highlight.bmp); }"
            "QPushButton:pressed { background-image: url(:/images/min_pushed.bmp); }");
    ui->pushButton_close->setStyleSheet(
            "QPushButton { background-image: url(:/images/colse_normal.bmp); }"
            "QPushButton:hover { background-image: url(:/images/close_highlight.bmp); }"
            "QPushButton:pressed { background-image: url(:/images/close_pushed.bmp); }");
    connect(ui->pushButton_min,SIGNAL(clicked()),this,SLOT(showMinimized()));
    connect(ui->pushButton_close,SIGNAL(clicked()),this,SLOT(close()));
    //事件过滤器,点击logo时显示about窗口
    ui->label_logo->installEventFilter(this);
    //系统设置面板
    connect(ui->checkBox_password_2,SIGNAL(stateChanged(int)),this,SLOT(setSavePassword(int)));
    connect(ui->checkBox_autoLogin_2,SIGNAL(stateChanged(int)),this,SLOT(setAutoLogin(int)));
    this->test_socket = new QTcpSocket();
    connect(ui->pushButton_test,SIGNAL(clicked()),this,SLOT(testServerConnection()));
    connect(this->test_socket,SIGNAL(connected()),this,SLOT(showTestConnected()));
    connect(this->test_socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(showTestError(QAbstractSocket::SocketError)));
    connect(ui->pushButton_cancel,SIGNAL(clicked()),this,SLOT(settingCancel()));
    connect(ui->pushButton_ok,SIGNAL(clicked()),this,SLOT(settingOK()));
}
Example #30
0
KisSplashScreen::KisSplashScreen(const QString &version, const QPixmap &pixmap, bool themed, QWidget *parent, Qt::WindowFlags f)
    : QWidget(parent, Qt::SplashScreen | Qt::FramelessWindowHint | f)
{
    setupUi(this);
    setWindowIcon(KisIconUtils::loadIcon("calligrakrita"));

    QString color = "#FFFFFF";
    if (themed && qApp->palette().background().color().value() >100) {
        color = "#000000";
    }


    lblSplash->setPixmap(pixmap);
    bnClose->hide();
    connect(bnClose, SIGNAL(clicked()), this, SLOT(close()));
    chkShowAtStartup->hide();
    connect(chkShowAtStartup, SIGNAL(toggled(bool)), this, SLOT(toggleShowAtStartup(bool)));

    KConfigGroup cfg( KSharedConfig::openConfig(), "SplashScreen");
    bool hideSplash = cfg.readEntry("HideSplashAfterStartup", false);
    chkShowAtStartup->setChecked(hideSplash);

    lblLinks->setTextFormat(Qt::RichText);
    lblLinks->setText(i18n("<html>"
                           "<head/>"
                           "<body>"
                           "<p align=\"center\"><span style=\" color:%1;\"><b>Links</b></span></p>"

                           "<p><a href=\"https://krita.org/support-us/donations/\"><span style=\" text-decoration: underline; color:%1;\">Support Krita</span></a></p>"

                           "<p><a href=\"http://krita.org/resources\"><span style=\" text-decoration: underline; color:%1;\">Getting Started</span></a></p>"
                           "<p><a href=\"http://userbase.kde.org/Krita/Manual\"><span style=\" text-decoration: underline; color:%1;\">Manual</span></a></p>"
                           "<p><a href=\"http://krita.org\"><span style=\" text-decoration: underline; color:%1;\">Krita Website</span></a></p>"
                           "<p><a href=\"http://forum.kde.org/viewforum.php?f=136\"><span style=\" text-decoration: underline; color:%1;\">User Community</span></a></p>"

                           "<p><a href=\"https://projects.kde.org/projects/calligra\"><span style=\" text-decoration: underline; color:%1;\">Source Code</span></a></p>"

                           "<p><a href=\"http://store.steampowered.com/app/280680/\"><span style=\" text-decoration: underline; color:%1;\">Krita on Steam</span></a></p>"
                           "</body>"
                           "</html>", color));

    lblVersion->setText(i18n("Version: %1", version));
    lblVersion->setStyleSheet("color:" + color);

    KConfigGroup cfg2( KSharedConfig::openConfig(), "RecentFiles");
    int i = 1;

    QString recent = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<p align=\"center\"><b><span style=\" color:%1;\">Recent Files</span></b></p>", color);

    QString path;
    QStringList recentfiles;

    do {
        path = cfg2.readPathEntry(QString("File%1").arg(i), QString());
        if (!path.isEmpty()) {
            QString name = cfg2.readPathEntry(QString("Name%1").arg(i), QString());
            QUrl url(path);
            if (name.isEmpty())
                name = url.fileName();

            if (!url.isLocalFile() || QFile::exists(url.toLocalFile())) {
                recentfiles.insert(0, QString("<p><a href=\"%1\"><span style=\"color:%3;\">%2</span></a></p>").arg(path).arg(name).arg(color));
            }
        }

        i++;
    } while (!path.isEmpty() || i <= 8);

    recent += recentfiles.join("\n");
    recent += "</body>"
            "</html>";
    lblRecent->setText(recent);
    connect(lblRecent, SIGNAL(linkActivated(QString)), SLOT(linkClicked(QString)));
}