Esempio n. 1
0
void MainWindow::setUpApp( const QString& volume )
{
	this->setLocalizationLanguage() ;
	m_ui = new Ui::MainWindow ;
	m_ui->setupUi( this ) ;

	this->setFixedSize( this->size() ) ;

	m_ui->tableWidget->setColumnWidth( 0,220 ) ;
	m_ui->tableWidget->setColumnWidth( 1,320 ) ;
	m_ui->tableWidget->setColumnWidth( 2,145 ) ;
	m_ui->tableWidget->setColumnWidth( 4,87 ) ;
	m_ui->tableWidget->setColumnWidth( 5,87 ) ;
	m_ui->tableWidget->hideColumn( 3 ) ;

#if QT_VERSION < QT_VERSION_CHECK( 5,0,0 )
	m_ui->tableWidget->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ) ;
#else
	m_ui->tableWidget->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ) ;
#endif
	m_ui->tableWidget->verticalHeader()->setMinimumSectionSize( 30 ) ;

	this->setAcceptDrops( true ) ;
	this->setWindowIcon( QIcon( ":/zuluMount.png" ) ) ;

	m_ui->tableWidget->setMouseTracking( true ) ;

	connect( m_ui->tableWidget,SIGNAL( itemEntered( QTableWidgetItem * ) ),this,SLOT( itemEntered( QTableWidgetItem * ) ) ) ;
	connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ),
		 this,SLOT( slotCurrentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbmount,SIGNAL( clicked() ),this,SLOT( pbMount() ) ) ;
	connect( m_ui->pbupdate,SIGNAL( clicked()),this,SLOT( pbUpdate() ) ) ;
	connect( m_ui->pbclose,SIGNAL( clicked() ),this,SLOT( pbClose() ) ) ;
	connect( m_ui->tableWidget,SIGNAL( itemClicked( QTableWidgetItem * ) ),this,SLOT( itemClicked( QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbunlockencfs,SIGNAL( clicked() ),this,SLOT( unlockencfs() ) ) ;

	connect( this,SIGNAL( unlistVolume( QString ) ),this,SLOT( removeVolume( QString ) ) ) ;

	this->setUpShortCuts() ;

	this->setUpFont() ;

	m_trayIcon = new QSystemTrayIcon( this ) ;
	m_trayIcon->setIcon( QIcon( ":/zuluMount.png" ) ) ;

	auto trayMenu = new QMenu( this ) ;

	m_autoMountAction = new QAction( this ) ;
	m_autoMount = this->autoMount() ;
	m_autoMountAction->setCheckable( true ) ;
	m_autoMountAction->setChecked( m_autoMount ) ;

	m_autoMountAction->setText( tr( "Automount Volumes" ) ) ;

	connect( m_autoMountAction,SIGNAL( toggled( bool ) ),this,SLOT( autoMountToggled( bool ) ) ) ;

	trayMenu->addAction( m_autoMountAction ) ;

	auto autoOpenFolderOnMount = new QAction( this ) ;
	autoOpenFolderOnMount->setCheckable( true ) ;
	m_autoOpenFolderOnMount = this->autoOpenFolderOnMount() ;
	autoOpenFolderOnMount->setChecked( m_autoOpenFolderOnMount ) ;
	autoOpenFolderOnMount->setText( tr( "Auto Open Mount Point" ) ) ;
	connect( autoOpenFolderOnMount,SIGNAL( toggled( bool ) ),this,SLOT( autoOpenFolderOnMount( bool ) ) ) ;

	trayMenu->addAction( autoOpenFolderOnMount ) ;

	auto ac = new QAction( this ) ;
	ac->setText( tr( "Show The Interface" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( raiseWindow() ) ) ;

	trayMenu->addAction( ac ) ;

	ac = new QAction( this ) ;
	ac->setText( tr( "Unmount All" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( unMountAll() ) ) ;

	trayMenu->addAction( ac ) ;

	m_favorite_menu = trayMenu->addMenu( tr( "Favorites" ) ) ;
	connect( m_favorite_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( favoriteClicked( QAction * ) ) ) ;
	connect( m_favorite_menu,SIGNAL( aboutToShow() ),this,SLOT( showFavorites() ) ) ;

	m_not_hidden_volume_menu = trayMenu->addMenu( tr( "Hide Volume From View" ) ) ;
	connect( m_not_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromVisibleVolumeList( QAction * ) ) ) ;
	connect( m_not_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showVisibleVolumeList() ) ) ;

	m_hidden_volume_menu = trayMenu->addMenu( tr( "Unhide Volume From View" ) ) ;
	connect( m_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromHiddenVolumeList( QAction * ) ) ) ;
	connect( m_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showHiddenVolumeList() ) ) ;

	ac = new QAction( this ) ;
	ac->setText( tr( "About" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( licenseInfo() ) ) ;
	trayMenu->addAction( ac ) ;

	trayMenu->addAction( tr( "Quit" ),this,SLOT( pbClose() ) ) ;
	m_trayIcon->setContextMenu( trayMenu ) ;

	connect( m_trayIcon,SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
		 this,SLOT( slotTrayClicked( QSystemTrayIcon::ActivationReason ) ) ) ;

	m_trayIcon->show() ;

	QString dirPath = utility::homePath() + "/.zuluCrypt/" ;
	QDir dir( dirPath ) ;

	if( !dir.exists() ){
		dir.mkdir( dirPath ) ;
	}

	this->disableAll() ;

	this->startAutoMonitor() ;

	this->updateVolumeList( zuluMountTask::updateVolumeList().await() ) ;

	if( volume.isEmpty() ) {
		this->enableAll() ;
	}else{
		this->showMoungDialog( volume ) ;
	}
}
Esempio n. 2
0
STUserProfileView::STUserProfileView(STUserPane *parent) :
    STScrolledPane(parent)
{
    m_followersView=new STUserProfileNumberView(contentsView());
    m_followersView->setLabelText(":/stella/res/FollowersText.png");
    m_followersView->setToolTip(tr("Number of Followers"));

    m_friendsView=new STUserProfileNumberView(contentsView());
    m_friendsView->setLabelText(":/stella/res/FollowingText.png");
    m_friendsView->setToolTip(tr("Number of Following Users"));

    m_tweetsView=new STUserProfileNumberView(contentsView());
    m_tweetsView->setLabelText(":/stella/res/TweetsText.png");
    m_tweetsView->setToolTip(tr("Number of Tweets"));

    m_favoritesView=new STUserProfileNumberView(contentsView());
    m_favoritesView->setLabelText(":/stella/res/FavoritesText.png");
    m_favoritesView->setToolTip(tr("Number of Favorites"));

    m_listedView=new STUserProfileNumberView(contentsView());
    m_listedView->setLabelText(":/stella/res/ListedText.png");
    m_listedView->setToolTip(tr("Number of Lists User is Added to"));

    m_bioLabel=new STLinkedLabelView(contentsView());
    m_bioLabel->setBgColor(QColor(70,70,70));
    m_bioLabel->setTextColor(QColor(140,140,140));
    m_bioLabel->setContents(STFont::defaultBoldFont(),
                            tr("BIO"));

    m_bioText=new STLinkedLabelView(contentsView());
    m_bioText->setBgColor(QColor(70,70,70));
    m_bioText->setTextColor(QColor(240,240,240));
    m_bioText->setSelectable(true);
    m_bioText->setFlag(ItemIsFocusable);

    m_urlLabel=new STLinkedLabelView(contentsView());
    m_urlLabel->setBgColor(QColor(70,70,70));
    m_urlLabel->setTextColor(QColor(140,140,140));
    m_urlLabel->setContents(STFont::defaultBoldFont(),
                            tr("URL"));

    m_urlText=new STLinkedLabelView(contentsView());
    m_urlText->setBgColor(QColor(70,70,70));
    m_urlText->setTextColor(QColor(240,240,240));
    m_urlText->setSelectable(true);
    m_urlText->setFlag(ItemIsFocusable);

    m_locLabel=new STLinkedLabelView(contentsView());
    m_locLabel->setBgColor(QColor(70,70,70));
    m_locLabel->setTextColor(QColor(140,140,140));
    m_locLabel->setContents(STFont::defaultBoldFont(),
                            tr("LOC"));

    m_locText=new STLinkedLabelView(contentsView());
    m_locText->setBgColor(QColor(70,70,70));
    m_locText->setTextColor(QColor(240,240,240));
    m_locText->setSelectable(true);
    m_locText->setFlag(ItemIsFocusable);

    m_sinceLabel=new STLinkedLabelView(contentsView());
    m_sinceLabel->setBgColor(QColor(70,70,70));
    m_sinceLabel->setTextColor(QColor(140,140,140));
    m_sinceLabel->setContents(STFont::defaultBoldFont(),
                            tr("SINCE"));

    m_sinceText=new STLinkedLabelView(contentsView());
    m_sinceText->setBgColor(QColor(70,70,70));
    m_sinceText->setTextColor(QColor(240,240,240));
    m_sinceText->setSelectable(true);
    m_sinceText->setFlag(ItemIsFocusable);

    connect(m_followersView, SIGNAL(activated()),
            this, SLOT(showFollowers()));
    connect(m_friendsView, SIGNAL(activated()),
            this, SLOT(showFriends()));
    connect(m_tweetsView, SIGNAL(activated()),
            parent, SLOT(showTweets()));
    connect(m_favoritesView, SIGNAL(activated()),
            parent, SLOT(showFavorites()));
    connect(m_listedView, SIGNAL(activated()),
            this, SLOT(showAddedLists()));

    connect(m_bioText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                            STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));
    connect(m_urlText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                            STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));
    connect(m_locText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                            STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));
    connect(m_sinceText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                              STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));


    m_lastWidth=0;

}