mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 12:09:53 +00:00
Improve operation widget appearance
This commit is contained in:
parent
c3d02c0b41
commit
3d699bd533
2 changed files with 21 additions and 28 deletions
|
@ -13,21 +13,21 @@ void CSVDoc::Operation::updateLabel(int threads)
|
|||
{
|
||||
if (threads == -1 || ((threads == 0) != mStalling))
|
||||
{
|
||||
std::string name("unknown operation");
|
||||
std::string name("Unknown operation");
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
case CSMDoc::State_Saving:
|
||||
name = "saving";
|
||||
name = "Saving";
|
||||
break;
|
||||
case CSMDoc::State_Verifying:
|
||||
name = "verifying";
|
||||
name = "Verifying";
|
||||
break;
|
||||
case CSMDoc::State_Searching:
|
||||
name = "searching";
|
||||
name = "Searching";
|
||||
break;
|
||||
case CSMDoc::State_Merging:
|
||||
name = "merging";
|
||||
name = "Merging";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ void CSVDoc::Operation::setBarColor(int type)
|
|||
"QProgressBar::chunk {"
|
||||
"background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 %1, stop:.50 %2 stop: .51 %3 stop:1 %4);"
|
||||
"text-align: center;"
|
||||
"margin: 2px 1px 1p 2px;"
|
||||
"margin: 2px 2px 2px 2px;"
|
||||
"}";
|
||||
|
||||
QString topColor = "#F2F6F8";
|
||||
|
@ -121,10 +121,10 @@ void CSVDoc::Operation::setBarColor(int type)
|
|||
|
||||
case CSMDoc::State_Searching:
|
||||
|
||||
topColor = "#EBF1F6";
|
||||
midTopColor = "#ABD3EE";
|
||||
midBottomColor = "#89C3EB";
|
||||
bottomColor = "#D5EBFB"; // blue gloss #4
|
||||
topColor = "#6DB3F2";
|
||||
midTopColor = "#54A3EE";
|
||||
midBottomColor = "#3690F0";
|
||||
bottomColor = "#1E69DE"; // blue gloss #3
|
||||
break;
|
||||
|
||||
case CSMDoc::State_Verifying:
|
||||
|
@ -142,13 +142,6 @@ void CSVDoc::Operation::setBarColor(int type)
|
|||
midBottomColor = "#B68D4C";
|
||||
bottomColor = "#E9D4B3"; // l Brown 3D
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
topColor = "#F2F6F8";
|
||||
bottomColor = "#E0EFF9";
|
||||
midTopColor = "#D8E1E7";
|
||||
midBottomColor = "#B5C6D0"; // gray gloss for undefined ops
|
||||
}
|
||||
|
||||
mProgressBar->setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor));
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
|
||||
#include "operation.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr int operationLineHeight = 40;
|
||||
}
|
||||
|
||||
CSVDoc::Operations::Operations()
|
||||
{
|
||||
/// \todo make widget height fixed (exactly the height required to display all operations)
|
||||
|
@ -20,7 +25,7 @@ CSVDoc::Operations::Operations()
|
|||
widgetContainer->setLayout(mLayout);
|
||||
setWidget(widgetContainer);
|
||||
setVisible(false);
|
||||
setFixedHeight(widgetContainer->height());
|
||||
setFixedHeight(operationLineHeight);
|
||||
setTitleBarWidget(new QWidget(this));
|
||||
}
|
||||
|
||||
|
@ -33,9 +38,6 @@ void CSVDoc::Operations::setProgress(int current, int max, int type, int threads
|
|||
return;
|
||||
}
|
||||
|
||||
int oldCount = static_cast<int>(mOperations.size());
|
||||
int newCount = oldCount + 1;
|
||||
|
||||
Operation* operation = new Operation(type, this);
|
||||
connect(operation, qOverload<int>(&Operation::abortOperation), this, &Operations::abortOperation);
|
||||
|
||||
|
@ -43,8 +45,8 @@ void CSVDoc::Operations::setProgress(int current, int max, int type, int threads
|
|||
mOperations.push_back(operation);
|
||||
operation->setProgress(current, max, threads);
|
||||
|
||||
if (oldCount > 0)
|
||||
setFixedHeight(height() / oldCount * newCount);
|
||||
int newCount = static_cast<int>(mOperations.size());
|
||||
setFixedHeight(operationLineHeight * newCount);
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
@ -54,16 +56,14 @@ void CSVDoc::Operations::quitOperation(int type)
|
|||
for (std::vector<Operation*>::iterator iter(mOperations.begin()); iter != mOperations.end(); ++iter)
|
||||
if ((*iter)->getType() == type)
|
||||
{
|
||||
int oldCount = static_cast<int>(mOperations.size());
|
||||
int newCount = oldCount - 1;
|
||||
|
||||
mLayout->removeItem((*iter)->getLayout());
|
||||
|
||||
(*iter)->deleteLater();
|
||||
mOperations.erase(iter);
|
||||
|
||||
if (oldCount > 1)
|
||||
setFixedHeight(height() / oldCount * newCount);
|
||||
int newCount = static_cast<int>(mOperations.size());
|
||||
if (newCount > 0)
|
||||
setFixedHeight(operationLineHeight * newCount);
|
||||
else
|
||||
setVisible(false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue